Ignore:
Timestamp:
03/03/14 09:28:38 (8 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
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

File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.