Changeset 5e26f0b


Ignore:
Timestamp:
03/03/14 09:28:38 (5 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.1, releng/10.0.2
Children:
4f9718b
Parents:
c1e0e78
Message:

Add a important fix to video detection. For some reason on 10.x Xorg isn't detecting
video cards with difference BusID settings... This causes chaos when the board
is on a weird pci device, or has multiple video devices installed.

Now we will first probe for vgapci0, and setup an xorg.conf based upon that using
the correct BusID value.

If that fails, we will then test vgapci1, and lastly fallback to vesa mode

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • overlays/install-overlay/root/functions.sh

    r1a4b7a1 r5e26f0b  
    2323 
    2424  # Try the second card, since many optimus / amd hybrids have Intel on secondary 
    25   cfg_second_card 
    26   if [ $? -ne 0 ] ; then 
    27     # Check if this system has a nvidia device, and run nvidia-xconfig 
    28     kldstat | grep -q 'nvidia' 
    29     if [ $? -eq 0 ] ; then 
    30        echo "Detected NVIDIA, creating xorg.conf" 
    31        nvidia-xconfig 2>/dev/null 
    32     fi 
    33   fi 
    34  
     25  cfg_card_busid "1" 
    3526 
    3627} 
    3728 
    38 cfg_second_card() 
     29cfg_card_busid() 
    3930{ 
    40   # This is a script to try an xorg.conf file configured to use the second vgapci1 device 
    41   # For most systems this wont do anything, but on a number of newer hybrid 
    42   # intel/amd or intel/nvidia laptops this may fix a problem where the intel card (which works) 
    43   # is the secondary pcivga1 device, and the non-functional AMD/NVIDIA optimus  shows up first. 
     31  whichcard="$1" 
    4432 
     33  # This script will manually set BusID for the first or second vgapciX device 
     34  # For some reason in 10.0, it no longer auto-probes for different VGA devices :( 
    4535  inCard=0 
    4636  pciconf -lv > /tmp/.pciconf.$$ 
     
    6757             1) card2=`echo $line | cut -d "'" -f 2` 
    6858                card2bus="$busID" 
    69                 ;; 
     59                ;; 
    7060             *) ;; 
    7161          esac 
     
    7565  rm /tmp/.pciconf.$$ 
    7666 
    77   # No secondary card, return 1 
    78   if [ -z "$card2" ] ; then return 1; fi 
     67  # Which card are we configuring 
     68  if [ "$whichcard" = "1" ] ; then 
     69    cfgCard="$card1" 
     70    cfgCardBusID="$card1bus" 
     71  else 
     72    cfgCard="$card2" 
     73    cfgCardBusID="$card2bus" 
     74  fi 
    7975 
    80   # Is this secondary an Intel chipset? 
    81   echo "$card2" | grep -q -i -e "intel" 
    82   if [ $? -ne 0 ] ; then return 1 ; fi 
     76  # No detected, return 1 
     77  if [ -z "$cfgCard" ] ; then return 1; fi 
    8378 
    84   # Found a second card, lets try an xorg config for it 
    85   cp /root/cardDetect/XF86Config.default /etc/X11/xorg.conf 
    86   echo " 
     79  # Is this an Intel chipset? 
     80  echo "$cfgCard" | grep -q -i -e "intel" 
     81  if [ $? -eq 0 ] ; then 
     82     driver="intel" 
     83  fi 
     84  echo "$cfgCard" | grep -q -i -e "nvidia" 
     85  if [ $? -eq 0 ] ; then 
     86     driver="nvidia" 
     87  fi 
     88 
     89  # Found a card, lets try an xorg config for it 
     90  cp ${PROGDIR}/cardDetect/XF86Config.default /etc/X11/xorg.conf 
     91  if [ -n "$driver" ] ; then 
     92    echo " 
    8793Section \"Device\" 
    8894        Identifier      \"Card0\" 
    89         Driver          \"intel\" 
    90         BusID           \"${card2bus}\" 
     95        Driver          \"$driver\" 
     96        BusID           \"${cfgCardBusID}\" 
    9197EndSection 
    9298  " >> /etc/X11/xorg.conf 
    93  
    94   echo "Hybrid video detected! Using Intel chipset..." 
    95   sleep 3 
     99  else 
     100    echo " 
     101Section \"Device\" 
     102        Identifier      \"Card0\" 
     103        BusID           \"${cfgCardBusID}\" 
     104EndSection 
     105  " >> /etc/X11/xorg.conf 
     106  fi 
    96107 
    97108  return 0 
     
    109120  then 
    110121    # Failed to start X 
    111     # Lets try again with its own internal video detection 
     122    # Lets try again with a secondary video card 
    112123    rm /etc/X11/xorg.conf 2>/dev/null 
     124    cfg_card_busid "2" 
    113125 
    114126    startx 
  • src-qt4/pc-xgui/resources/bin/rundetect.sh

    r1a4b7a1 r5e26f0b  
    2929# Start the script now 
    3030 
    31 cfg_second_card() 
     31cfg_card_busid() 
    3232{ 
     33  whichcard="$1" 
     34 
    3335  # This is a script to try an xorg.conf file configured to use the second vgapci1 device 
    3436  # For most systems this wont do anything, but on a number of newer hybrid 
     
    6769  rm /tmp/.pciconf.$$ 
    6870 
    69   # No secondary card, return 1 
    70   if [ -z "$card2" ] ; then return 1; fi 
    71  
    72   # Is this secondary an Intel chipset? 
    73   echo "$card2" | grep -q -i -e "intel" 
    74   if [ $? -ne 0 ] ; then return 1 ; fi 
    75  
    76   # Found a second card, lets try an xorg config for it 
     71  # Which card are we configuring 
     72  if [ "$whichcard" = "1" ] ; then 
     73    cfgCard="$card1" 
     74    cfgCardBusID="$card1bus" 
     75  else 
     76    cfgCard="$card2" 
     77    cfgCardBusID="$card2bus" 
     78  fi 
     79 
     80  # No detected, return 1 
     81  if [ -z "$cfgCard" ] ; then return 1; fi 
     82 
     83  # Is this an Intel chipset? 
     84  echo "$cfgCard" | grep -q -i -e "intel" 
     85  if [ $? -eq 0 ] ; then 
     86     driver="intel" 
     87  fi 
     88  echo "$cfgCard" | grep -q -i -e "nvidia" 
     89  if [ $? -eq 0 ] ; then 
     90     driver="nvidia" 
     91  fi 
     92 
     93  # Found a card, lets try an xorg config for it 
    7794  cp ${PROGDIR}/cardDetect/XF86Config.default /etc/X11/xorg.conf 
    78   echo " 
     95  if [ -n "$driver" ] ; then 
     96    echo " 
    7997Section \"Device\" 
    8098        Identifier      \"Card0\" 
    81         Driver          \"intel\" 
    82         BusID           \"${card2bus}\" 
     99        Driver          \"$driver\" 
     100        BusID           \"${cfgCardBusID}\" 
    83101EndSection 
    84102  " >> /etc/X11/xorg.conf 
    85  
    86   echo "Hybrid video detected! Using Intel chipset..." 
    87   sleep 3 
     103  else 
     104    echo " 
     105Section \"Device\" 
     106        Identifier      \"Card0\" 
     107        BusID           \"${cfgCardBusID}\" 
     108EndSection 
     109  " >> /etc/X11/xorg.conf 
     110  fi 
    88111 
    89112  return 0 
     
    172195      cp ${PROGDIR}/cardDetect/XF86Config.compat /etc/X11/xorg.conf 
    173196    else 
    174       cfg_second_card 
     197      cfg_card_busid "1" 
    175198      if [ $? -ne 0 ] ; then 
    176199        # Check if this system has a nvidia device, and run nvidia-xconfig 
     
    184207    fi 
    185208  elif [ "${ATTEMPT}" = "1" ] ; then 
     209    cfg_card_busid "2" 
     210 
    186211    # Failed to start X 
    187212    # Now lets have it try some magic itself 
Note: See TracChangeset for help on using the changeset viewer.