Changeset 6569d2b


Ignore:
Timestamp:
01/15/14 15:08:15 (9 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
dae1602
Parents:
7d266ba
Message:

Do some more Xorg voodoo for (NVIDIA/AMD)/Intel Hybrids.

Basically, during the first xorg setup, check if we have a second video
card, and if it is an "Intel" video. If so, we will attempt to start X using that
card first.

This should fix some issues we've been seeing with hybrids, where it "black-screens" the system
when it attempts to use the first device, which often cannot be accessed directly.

Files:
2 edited

Legend:

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

    r8e745d8 r6569d2b  
    55detect_x()  
    66{ 
    7   # First check if we are running as a VirtualBox guest 
    8   pciconf -lv | grep -q "VirtualBox" 
    9   if [ $? -eq 0 ] ; then cp /root/cardDetect/xorg.conf.virtualbox /etc/X11/xorg.conf; fi 
    10  
    11   # Check if this system has a nvidia device, and run nvidia-xconfig 
    12   kldstat | grep -q 'nvidia' 
    13   if [ $? -eq 0 ] ; then 
    14      echo "Detected NVIDIA, creating xorg.conf" 
    15      nvidia-xconfig 2>/dev/null 
    16   fi 
    17  
    187  # Check if the user requested VESA mode 
    198  xvesa="NO" 
     
    2211        xvesa=$v 
    2312  fi 
     13 
    2414  # If we are starting in VESA only mode 
    2515  if [ "$xvesa" = "YES" ]; then 
     
    2717    return 
    2818  fi 
     19 
     20  # First check if we are running as a VirtualBox guest 
     21  pciconf -lv | grep -q "VirtualBox" 
     22  if [ $? -eq 0 ] ; then cp /root/cardDetect/xorg.conf.virtualbox /etc/X11/xorg.conf ; return; fi 
     23 
     24  # 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 
    2935 
    3036} 
     
    7278  if [ -z "$card2" ] ; then return 1; fi 
    7379 
     80  # Is this secondary an Intel chipset? 
     81  echo "$card2" | grep -q -i -e "intel" 
     82  if [ $? -ne 0 ] ; then return 1 ; fi 
     83 
    7484  # Found a second card, lets try an xorg config for it 
    7585  cp /root/cardDetect/XF86Config.default /etc/X11/xorg.conf 
     
    7787Section \"Device\" 
    7888        Identifier      \"Card0\" 
     89        Driver          \"intel\" 
    7990        BusID           \"${card2bus}\" 
    8091EndSection 
     
    95106  if [ ! -e "/tmp/.xstarted" ] 
    96107  then 
    97     # Failed to auto-start X with its own internal video detection 
    98     # Now lets try some magic 
     108    # Failed to start X 
     109    # Lets try again with its own internal video detection 
    99110    rm /etc/X11/xorg.conf 2>/dev/null 
    100  
    101     echo "ERROR: Failed to start X with default video card... Trying secondary mode..." 
    102     cfg_second_card 
    103     if [ $? -ne 0 ] ; then 
    104       # Try the Intel driver, since nvidia/vesa will fail on optimus cards 
    105       cp /root/cardDetect/XF86Config.intel /etc/X11/xorg.conf 
    106     fi 
    107111 
    108112    startx 
  • src-qt4/pc-xgui/resources/bin/rundetect.sh

    rd0b124c r6569d2b  
    7070  if [ -z "$card2" ] ; then return 1; fi 
    7171 
     72  # Is this secondary an Intel chipset? 
     73  echo "$card2" | grep -q -i -e "intel" 
     74  if [ $? -ne 0 ] ; then return 1 ; fi 
     75 
    7276  # Found a second card, lets try an xorg config for it 
    7377  cp ${PROGDIR}/cardDetect/XF86Config.default /etc/X11/xorg.conf 
     
    7579Section \"Device\" 
    7680        Identifier      \"Card0\" 
     81        Driver          \"intel\" 
    7782        BusID           \"${card2bus}\" 
    7883EndSection 
     
    164169      cp ${PROGDIR}/cardDetect/XF86Config.compat /etc/X11/xorg.conf 
    165170    else 
    166       # Check if this system has a nvidia device, and run nvidia-xconfig 
    167       kldstat | grep -q 'nvidia' 
    168       if [ $? -eq 0 ] ; then 
    169          echo "Detected NVIDIA, creating xorg.conf" 
    170          nvidia-xconfig 2>/dev/null 
     171      cfg_second_card 
     172      if [ $? -ne 0 ] ; then 
     173        # Check if this system has a nvidia device, and run nvidia-xconfig 
     174        kldstat | grep -q 'nvidia' 
     175        if [ $? -eq 0 ] ; then 
     176           echo "Detected NVIDIA, creating xorg.conf" 
     177           nvidia-xconfig 2>/dev/null 
     178        fi 
    171179      fi 
    172180      AUTORES="YES" 
    173181    fi 
    174182  elif [ "${ATTEMPT}" = "1" ] ; then 
    175     # Failed to auto-start X with its own internal video detection 
    176     # Now lets try some magic 
     183    # Failed to start X 
     184    # Now lets have it try some magic itself 
    177185    rm /etc/X11/xorg.conf 2>/dev/null 
    178186 
    179187    echo "`clear`" >/dev/console 
    180188    echo "ERROR: Failed to start X with default video card... Trying secondary mode..." >/dev/console 
    181     cfg_second_card 
    182     if [ $? -ne 0 ] ; then 
    183       # Try the Intel driver, since nvidia/vesa will fail on optimus cards 
    184       cp ${PROGDIR}/cardDetect/XF86Config.intel /etc/X11/xorg.conf 
    185     fi 
    186189  else 
    187190    # Still failed, drop to VESA failsafe 
Note: See TracChangeset for help on using the changeset viewer.