2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: package/*/xorg-server/xcfgt2.sh
4 # Copyright (C) 2005 - 2024 The T2 SDE Project
5 # Copyright (C) 2005 - 2022 Rene Rebe - ExactCODE
7 # This Copyright note is generated by scripts/Create-CopyPatch,
8 # more information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License version 2.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 # Quick T2 SDE live X driver matching ...
18 eval "[ \"\$$1\" ] && $1=\"\${$1}$2\"" || true
19 eval "$1=\"\${$1}\$x\""
24 echo "XcfgT2 (C) 2005 - 2023 Rene Rebe, ExactCODE"
27 if [ -d /sys
/devices
/virtual
/dmi
/id
]; then
28 for i
in sys_vendor product_name chassi_vendor board_name product_serial board_serial
; do
29 var_append sysid
':' "$(cat /sys/devices/virtual/dmi/id/$i 2>/dev/null)"
33 # Apple Inc.:MacBookPro3,1:Apple Inc.:Mac-F4238BC8::
34 # PhoenixAward:945GM:PhoenixAward:945GM:0123456789:
35 # ::IntelCorporation:D945GCLF2::
36 # ASUSTeK Computer INC.:900:ASUSTeK Computer INC.:900:EeePC-1234567890:EeePC
37 echo "SystemID: $sysid"
39 card
="`lspci | sed -n 's/.*[^-]VGA[^:]*: //p'`" # not Non-VGA
40 [ "$card" ] || card
="`cat /sys/class/graphics/fb0/name 2>/dev/null`"
42 echo "Video card: $card"
45 depth
= # safe default for even older cards
46 # fallback to either vesa or fbdev ...
48 i
*86*|x86
*64) xdrv
=vesa
;;
53 *radeon
*) xdrv
=radeon
;;
54 *geforce
*) xdrv
=nouveau
;;
55 *cirrus
*) xdrv
=cirrus
;;
56 *savage
*) xdrv
=savage
;;
57 *virge
*) xdrv
=s3virge
;;
59 *intel
*8*|
*intel
*9*|
*intel
*mobile
*) xdrv
=intel
;;
60 *intel
*7*) xdrv
=i740
;;
62 *trident
*) xdrv
=trident depth
=16 ;;
63 *rendition
*) xdrv
=rendition
;;
64 *neo
*) xdrv
=neomagic
;;
65 *tseng
*) xdrv
=tseng
;;
67 *parhelia
*) xdrv
=mtx
;;
70 *cyrix
*) xdrv
=cyrix
;;
71 *silicon\ motion
*) xdrv
=siliconmotion
;;
72 *chips
*) xdrv
=chips
;;
74 *3dfx
*) xdrv
="tdfx" ;;
75 *permedia
*|
*glint
*) xdrv
="glint" ;;
77 *vmware
*) xdrv
="vmware" ;;
80 *ark\ logic
*) xdrv
="ark" ;;
81 *dec
*tga
*) xdrv
="tga" ;;
83 *national\ semi
*|
*amd
*) xdrv
=nsc
;;
86 *sis
*|
*xgi
*) xdrv
=sis depth
=16 ;;
88 *chrome
*|
*castlerock
*) xdrv
=openchrome
;;
91 creator\
3d|elite\
3d
) xdrv
=sunffb
;;
92 bwtwo
) xdrv
=sunbw2 depth
=1 ;;
93 cgthree
) xdrv
=suncg3 depth
=8 ;;
94 gx
*|tgx
*) xdrv
=suncg6 depth
=8 ;;
95 cgfourteen
) xdrv
=suncg6 depth
=32 ;;
96 tcx8
) xdrv
=suntcx depth
=8 ;;
97 tcx24
) xdrv
=suntcx depth
=32 ;;
98 *leo
) xdrv
=sunsun depth
=32 ;;
100 # must be last so *nv* does not match one of the above
104 # maybe binary nvidia driver?
105 [ "$xdrv" = nv
-a -f /usr
/X11
/lib
/xorg
/modules
/drivers
/nvidia_drv.so
] &&
108 cmdline
="$(< /proc/cmdline)"
111 xdriver
="xdriver= $cmdline" xdriver
=${xdriver##*xdriver=} xdriver
=${xdriver%% *}
112 [ "$xdriver" ] && xdrv
="$xdriver"
115 fbdev|nv|nvidia|sunffb
) depth
=24 ;;
120 xdepth
="xdepth= $cmdline" xdepth
=${xdepth##*xdepth=} xdepth
=${xdepth%% *}
121 [ "$xdepth" ] && depth
="$xdepth"
124 # use the nvidia binary only driver - if available ...
125 if [ "$xdrv" = "nvidia" ]; then
126 echo "Installing nvidia GL libraries and headers ..."
127 rm -rf /usr
/X11
/lib
/libGL.
*
128 cp -arv /usr
/src
/nvidia
/lib
/* /usr
/X11
/lib
/
129 cp -arv /usr
/src
/nvidia
/X11R
6/lib
/* /usr
/X11
/lib
/
130 cp -arv /usr
/src
/nvidia
/include
/* /usr
/X11
/lib
/GL
/
131 ln -sf /usr
/X11
/lib
/xorg
/modules
/extensions
/{libglx.so
.1.0.
*,libglx.so
}
133 echo "Updating dynamic library database ..."
134 ldconfig
/usr
/X11
/lib
142 # manual, boot command line overrides
143 xmodes
="xmodes= $cmdline" xmodes
=${xmodes##*xmodes=}; xmodes
=${xmodes%% *}
144 xddc
="xddc= $cmdline" xddc
=${xddc##*xddc=}; xddc
=${xddc%% *}
146 [ "$xmodes" ] && modes
="$(echo $xmodes | sed 's/,/ /g; s/[^ ]\+/"&"/g')"
147 [ "$xddc" ] && ddc
="$xddc"
150 # if ddcprobe available, ddc not disabled and no manual modes
151 if type -p ddcprobe
> /dev
/null
&& [ "$ddc" = 1 ] && [ -z "$modes" ]; then
152 echo "Probing for DDC information ..."
155 if grep -q failed
$tmp; then
156 echo "DDC read failed"
158 defx
=`grep "Horizontal blank time" $tmp | cut -d : -f 2 |
159 sort -nu | tail -n 1`
160 defy
=`grep "Vertical blank time" $tmp | cut -d : -f 2 |
161 sort -nu | tail -n 1`
169 if [ $defx -eq 0 -o $x -le $defx ] &&
170 [ $defy -eq 0 -o $y -le $defy ]; then
172 modes
="$modes \"${x}x${y}\""
174 echo "mode $x $y skipped"
176 done < <( grep -A 1000 '^Established' $tmp |
177 grep -B 1000 '^Standard\|^Detailed' |
178 sed -e 's/[\t ]*\([^ ]*\).*/\1/' -e '/^[A-Z]/d' |
183 # if still no mode try to determine from FB (mostly for
184 # non PC workstations / embedded devices with system FB)
185 if [ -z "$modes" ]; then
186 for mode
in `sed -n 's/.:\([[:digit:]]\+x[[:digit:]]\+\)[[:alpha:]]*-[[:digit:]]\+/\1/p' \
187 /sys/class/graphics/fb0/modes 2>/dev/null | sort -r -n -u`; do
188 modes
="$modes \"$mode\""
193 # still no modes, use backward / safe compatible defaults
194 if [ -z "$modes" ]; then
195 echo "No modes from DDC or FB detection, using defaults!"
196 modes
='"1024x768" "800x600" "640x480"'
197 horiz_sync
="HorizSync 24.0 - 65.0"
198 vert_refresh
="VertRefresh 50 - 75"
202 echo "X Driver: $xdrv"
203 echo "Using modes: $modes"
204 echo " @ depth: $depth"
205 [ "$hoiz_sync" -o "$vert_refresh" ] &&
206 echo " horiz: $horiz_sync" &&
207 echo " vert: $vert_refresh"
209 [ -f /etc
/X11
/xorg.conf
] && cp /etc
/X11
/xorg.conf
/etc
/X11
/xorg.conf.bak
211 sed -e "s/\$xdrv/$xdrv/g" -e "s/\$modes/$modes/g" -e "s/\$depth/$depth/g" \
212 -e "s/\$horiz_sync/$horiz_sync/g" \
213 -e "s/\$vert_refresh/$vert_refresh/g" \
214 /etc
/X11
/xorg.conf.template
> /etc
/X11
/xorg.conf
216 if [ -z "$depth" ]; then
217 sed -i '/DefaultDepth/d' /etc
/X11
/xorg.conf
220 if [ "$ddc" = 0 ]; then
221 echo "Adding NoDDC option"
222 sed -i 's/.*Ident.*Card.*/&\n Option\t"NoDDC"\n/' /etc
/X11
/xorg.conf