/[soft]/drakx-kbd-mouse-x11/trunk/tools/display_driver_helper
ViewVC logotype

Diff of /drakx-kbd-mouse-x11/trunk/tools/display_driver_helper

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3920 by anssi, Thu Apr 5 02:49:31 2012 UTC revision 3921 by anssi, Thu Apr 5 02:49:35 2012 UTC
# Line 2  Line 2 
2  #  #
3  # Display driver helper  # Display driver helper
4  #  #
5  # Copyright (c) 2010, 2011 Anssi Hannula <anssi.hannula@iki.fi>  # Copyright (c) 2010, 2011, 2012 Anssi Hannula <anssi.hannula@iki.fi>
6  #  #
7  # - Load drivers for specified modaliases, skipping disabled display drivers  # - Load drivers for specified modaliases, skipping disabled display drivers
8  #   that would cause conflicts (KMS vs. vesa, KMS vs. proprietary).  #   that would cause conflicts (KMS vs. vesa, KMS vs. proprietary).
# Line 47  CONFLICTS_radeon="fglrx" Line 47  CONFLICTS_radeon="fglrx"
47  # See end of script for descriptions of global variables.  # See end of script for descriptions of global variables.
48  check_driver() {  check_driver() {
49          local name="$1"          local name="$1"
50            # modalias is optional, only needed to set MODOPTIONS for radeon
51            # this should not be set when not intending to load the module
52            local modalias="$2"
53    
54            MODOPTIONS=
55    
56          case "$name" in          case "$name" in
57          i915)          i915)
58                  # implicitely loaded by X.org                  # implicitely loaded by X.org
# Line 61  check_driver() { Line 67  check_driver() {
67                  # TODO: this check could be omitted if radeon was explicitely                  # TODO: this check could be omitted if radeon was explicitely
68                  # specified in xorg.conf - but that is only known by check_xorg.                  # specified in xorg.conf - but that is only known by check_xorg.
69                  check_gl /etc/fglrx/pxpress-free.ld.so.conf && return 1                  check_gl /etc/fglrx/pxpress-free.ld.so.conf && return 1
70    
71                  IS_KMS=1                  IS_KMS=1
72                  # radeon needs to be loaded before X server                  # radeon KMS needs to be loaded before X server
73                  NEEDS_LOAD_NOW=1                  NEEDS_LOAD_NOW=1
74    
75                    # check if firmware is needed and present (random fw checked)
76                    if [ -n "$modalias" ] && [ ! -e "/lib/firmware/radeon/R700_rlc.bin" ]; then
77                            # no firmware, lets check if it is needed
78                            pciid="${modalias#pci:v00001002d0000}"
79                            pciid="${pciid%sv*}"
80                            case "$pciid" in
81                            # All Radeons up to PALM (see radeon_probe.c)
82                            31??|3E??|4???|5???|7???|68??|94??|95??|961?|971?|98??)
83                                    # The radeon driver reportedly has some issues
84                                    # when loaded without firmware - it doesn't fallback to noaccel
85                                    # nicely as it should, instead the framebuffer gets messed up.
86                                    # However, these cards are still supported by usermode modesetting,
87                                    # so just disable KMS. (Mageia bug #3466)
88                                    # TODO: actually fix the driver to not mess up framebuffer when no firmware
89                                    # is present and disable accel cleanly so that this workaround
90                                    # wouldn't be needed -Anssi
91                                    MODOPTIONS="$MODOPTIONS modeset=0"
92                                    IS_KMS=
93                                    # needs to be loaded now in order to set the module option
94                                    NEEDS_LOAD_NOW=1
95                                    ;;
96                            ????)
97                                    # Cards newer than PALM don't support UMS, so don't load the driver
98                                    # at all (it might still get done by X server, though).
99                                    return 1
100                                    ;;
101                            *)
102                                    # Modalias parse error, strange. Load normally...
103                                    ;;
104                            esac
105                    fi
106                  ;;                  ;;
107          nouveau)          nouveau)
108                  # implicitely loaded by X.org                  # implicitely loaded by X.org
# Line 256  load_driver() { Line 295  load_driver() {
295          local load_default=1          local load_default=1
296    
297          for modulename in $(/sbin/modprobe -Rq "$modalias"); do          for modulename in $(/sbin/modprobe -Rq "$modalias"); do
298                  check_driver "$modulename"                  check_driver "$modulename" "$modalias"
299                  case $? in                  case $? in
300                  1)      # a driver which needs handling by this script matches                  1)      # a driver which needs handling by this script matches
301                          # the modalias, but was not configured - do not run                          # the modalias, but was not configured - do not run
# Line 278  load_driver() { Line 317  load_driver() {
317                          [ -z "$NEEDS_LOAD_NOW" ] && /bin/plymouth --ping 2>/dev/null && return 0                          [ -z "$NEEDS_LOAD_NOW" ] && /bin/plymouth --ping 2>/dev/null && return 0
318                          /bin/plymouth quit 2>/dev/null                          /bin/plymouth quit 2>/dev/null
319                  fi                  fi
320                  /sbin/modprobe -b "$modulename" && return 0                  /sbin/modprobe -b "$modulename" $MODOPTIONS && return 0
321          done          done
322    
323          # no specially handled modules were loaded, so load all modules normally          # no specially handled modules were loaded, so load all modules normally
# Line 310  get_active_kms_drivers() { Line 349  get_active_kms_drivers() {
349                  modalias="$(cat "$device/modalias")"                  modalias="$(cat "$device/modalias")"
350                  for modulename in $(/sbin/modprobe -Rq "$modalias"); do                  for modulename in $(/sbin/modprobe -Rq "$modalias"); do
351                          IS_KMS=                          IS_KMS=
352                          check_driver "$modulename" || continue                          check_driver "$modulename" "$modalias" || continue
353                          [ -n "$IS_KMS" ] && echo $modulename                          [ -n "$IS_KMS" ] && echo $modulename
354                  done                  done
355          done          done
# Line 402  DKMS_AUTOLOAD_MODULE= Line 441  DKMS_AUTOLOAD_MODULE=
441  # "nvidia" in loaded modules list).  # "nvidia" in loaded modules list).
442  UNSURE=  UNSURE=
443    
444    # Extra module options - used to disable radeon modesetting when no firmware
445    # is present and it is needed.
446    MODOPTIONS=
447    
448  case "$1" in  case "$1" in
449  --load)  --load)
450          load_driver "$2"          load_driver "$2"

Legend:
Removed from v.3920  
changed lines
  Added in v.3921

  ViewVC Help
Powered by ViewVC 1.1.28