OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
3.9 KiB

  1. #!/bin/bash
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: package/.../xorg-server/xcfgt2.sh
  6. # Copyright (C) 2005-2006 The T2 SDE Project
  7. # Copyright (C) 2005-2006 Rene Rebe
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. # Quick T2 live X driver matching ...
  17. tmp=`mktemp`
  18. card="`lspci | sed -n 's/.*VGA .*: //p'`"
  19. [ "$card" ] || card="`cat /sys/class/graphics/fb0/name`"
  20. echo "Video card: $card"
  21. # defaults
  22. # no driver? fallback to either vesa or fbdev ...
  23. case `uname -m` in
  24. i*86*|x86*64) xdrv=vesa ;;
  25. *) xdrv=fbdev ;;
  26. esac
  27. depth=16
  28. modules=
  29. case `echo "$card" | tr A-Z a-z` in
  30. *radeon*) xdrv=radeon ;;
  31. *geforce*) xdrv=nv ;;
  32. *cirrus*) xdrv=cirrus ;;
  33. *savage*) xdrv=savage ;;
  34. *unichrome*|*castlerock*) xdrv=via ;;
  35. *virge*) xdrv=s3virge ;;
  36. *s3*) xdrv=s3 ;;
  37. *intel*7*) xdrv=i740 ;;
  38. *intel*8*|*intel*9*|*intel*mobile*) xdrv=i810 ;;
  39. *trident*) xdrv=trident ;;
  40. *rendition*) xdrv=rendition ;;
  41. *neo*) xdrv=neomagic ;;
  42. *tseng*) xdrv=tseng ;;
  43. *parhelia*) xdrv=mtx ;;
  44. *matrox*) xdrv=mga ;;
  45. *cyrix*) xdrv=cyrix ;;
  46. *silicon\ motion*) xdrv=siliconmotion ;;
  47. *chips*) xdrv=chips ;;
  48. *3dfx*) xdrv="tdfx" ;;
  49. *permedia*|*glint*) xdrv="glint" ;;
  50. *vmware*) xdrv="vmware" ;;
  51. *ark\ logic*) xdrv="ark" ;;
  52. *dec*tga*) xdrv="tga" ;;
  53. *national\ semi*|*amd*) xdrv=nsc ;;
  54. *ati\ *) xdrv=ati ;;
  55. *sis*|*xgi*) xdrv=sis ;;
  56. creator\ 3d|elite\ 3d) xdrv=sunffb ; depth=24 ;;
  57. # must be last so *nv* does not match one of the above
  58. *nv*) xdrv=nv ;;
  59. esac
  60. # use the nvidia binary only driver - if available ...
  61. if [ "$xdrv" = nv -a -f /usr/X11/lib/xorg/modules/drivers/nvidia_drv.o ]; then
  62. xdrv=nvidia
  63. echo "Installing nvidia GL libraries and headers ..."
  64. rm -rf /usr/X11/lib/libGL.*
  65. cp -arv /usr/src/nvidia/lib/* /usr/X11/lib/
  66. cp -arv /usr/src/nvidia/X11R6/lib/* /usr/X11/lib/
  67. cp -arv /usr/src/nvidia/include/* /usr/X11/lib/GL/
  68. ln -sf /usr/X11/lib/xorg/modules/extensions/{libglx.so.1.0.*,libglx.so}
  69. echo "Updating dynamic library database ..."
  70. ldconfig /usr/X11/lib
  71. fi
  72. echo "X Driver: $xdrv"
  73. horiz_sync=""
  74. vert_refresh=""
  75. modes=""
  76. if [[ `uname -m` = i*86 ]]; then
  77. ddcprobe > $tmp
  78. if grep -q failed $tmp ; then
  79. echo "DDC read failed"
  80. else
  81. grep "Standard timing" $tmp
  82. defx=`grep "Horizontal blank time" $tmp | cut -d : -f 2 |
  83. sort -nu | tail -n 1`
  84. defy=`grep "Vertical blank time" $tmp | cut -d : -f 2 |
  85. sort -nu | tail -n 1`
  86. defx=${defx:-0}
  87. defy=${defy:-0}
  88. while read m ; do
  89. x=${m/x*/}
  90. y=${m/*x/}
  91. if [ $defx -eq 0 -o $x -le $defx ] &&
  92. [ $defy -eq 0 -o $y -le $defy ]; then
  93. echo "mode $x $y ok"
  94. modes="$modes \"${x}x${y}\""
  95. else
  96. echo "mode $x $y skipped"
  97. fi
  98. done < <( grep -A 1000 '^Established' $tmp |
  99. grep -B 1000 '^Standard\|^Detailed' |
  100. sed -e 's/[\t ]*\([^ ]*\).*/\1/' -e '/^[A-Z]/d' |
  101. sort -rn | uniq )
  102. fi
  103. fi
  104. if [ -z "$modes" ]; then
  105. modes="`sed -n 's/.:\(.*x.*\)-[[:digit:]]\+/"\1"/p ; q' /sys/class/graphics/fb0/modes`"
  106. fi
  107. if [ -z "$modes" ]; then
  108. echo "No modes from DDC or FB detection, using defaults!"
  109. modes='"1024x768" "800x600" "640x480"'
  110. horiz_sync="HorizSync 24.0 - 65.0"
  111. vert_refresh="VertRefresh 50 - 75"
  112. fi
  113. echo "Using modes: $modes"
  114. echo " @ depth: $depth"
  115. [ "$hoiz_sync" -o "$vert_refresh" ] &&
  116. echo " horiz: $horiz_sync" &&
  117. echo " vert: $vert_refresh"
  118. [ -f /etc/X11/xorg.conf ] && cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
  119. sed -e "s/\$xdrv/$xdrv/g" -e "s/\$modes/$modes/g" -e "s/\$depth/$depth/g" \
  120. -e "s/\$horiz_sync/$horiz_sync/g" \
  121. -e "s/\$vert_refresh/$vert_refresh/g" \
  122. /etc/X11/xorg.conf.template > /etc/X11/xorg.conf
  123. rm $tmp