Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-testing-src > by-pkgid > 5ec91459ac2cbffe091d78878ad44115 > files > 11

x11-server-xgl-0.0.1-0.20060714.11mdv2007.0.src.rpm

#!/bin/sh
# to be sourced

CONFIG=/etc/sysconfig/xgl
[ -r $CONFIG ] && . $CONFIG

[ "$DESKTOP" = "failsafe" -o "$DESKTOP" = "drak3d" ] && XGL=no

if [ "$XGL" = "auto" ]; then
    # auto-start Xgl if direct rendering is available
    # and GLX_EXT_texture_from_pixmap is not available in server and client GLX extensions
    # (this would mean AIGLX can be preferred)
    if grep -q no3ddesktop /proc/cmdline; then
	XGL=no
    elif glxinfo 2>/dev/null | awk 'BEGIN { no_direct = 1; in_client = 0; server_tfp = 0; client_tfp = 0 } /direct rendering: Yes/ { no_direct = 0 } /GLX_EXT_texture_from_pixmap/ { if (in_client) { client_tfp = 1 } else { server_tfp = 1 } } /client glx extensions:/ { in_client = 1 } /GLX extensions/ { exit } END { exit or(no_direct, and(server_tfp, client_tfp)) }'; then
	XGL=yes
    else
	XGL=no
    fi
fi

if [ "$XGL" = "yes" ]; then
	[ -z "$XGL_DISPLAY" ] && XGL_DISPLAY=:93
	[ -z "$XGL_OPTIONS" ] && XGL_OPTIONS="-fullscreen -accel xv:pbuffer -accel glx:pbuffer"
	xauth -i -n list | while read dpy proto key; do [[ $dpy == *$DISPLAY ]] && echo add ${dpy/%$DISPLAY/$XGL_DISPLAY} $proto $key; done | xauth -q -n
	Xgl $XGL_DISPLAY $XGL_OPTIONS &
	DISPLAY=$XGL_DISPLAY
	export DISPLAY
fi