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.

156 lines
4.0 KiB

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