system76 / firmware-open

System76 Open Firmware
Other
949 stars 86 forks source link

dGPU is used as boot VGA device #431

Open crawfxrd opened 1 year ago

crawfxrd commented 1 year ago

The dGPU is being used as boot VGA device instead of the iGPU.

Steps to reproduce

  1. Boot system in hybrid graphics mode with external display attached to any dGPU port
  2. Check grep . /sys/devices/pci0000:00/0000:00:{02.0,01.0/0000:01:00.0}/boot_vga

Expected behavior

Actual behavior

Additional info

coreboot looks correct:

[DEBUG]  found VGA at PCI: 00:02.0
[DEBUG]  found VGA at PCI: 01:00.0
[DEBUG]  Setting up VGA for PCI: 00:02.0
[DEBUG]  Setting PCI_BRIDGE_CTL_VGA for bridge DOMAIN: 0000
[DEBUG]  Setting PCI_BRIDGE_CTL_VGA for bridge Root Device

linux incorrectly overrides the boot VGA device:

[    0.372557] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.372557] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.372557] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.372557] pci 0000:01:00.0: vgaarb: setting as boot VGA device (overriding previous)
[    0.372557] pci 0000:01:00.0: vgaarb: bridge control possible
[    0.372557] pci 0000:01:00.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.372557] vgaarb: loaded

edk2 creates Graphics Info HOB from the coreboot FB:

Found coreboot video frame buffer information
physical_address: 0x90000000
x_resolution: 0x780
y_resolution: 0x4B0
bits_per_pixel: 0x20
bytes_per_line: 0x1E00
red_mask_size: 0x8
red_mask_pos: 0x10
green_mask_size: 0x8
green_mask_pos: 0x8
blue_mask_size: 0x8
blue_mask_pos: 0x0
reserved_mask_size: 0x8
reserved_mask_pos: 0x18
Created graphics info hob

although GraphicsDeviceInfo HOB is not created:

[GraphicsOutputDxe]: GraphicsDeviceInfo HOB doesn't exist!

GraphicsConsole enumerates the dGPU device first:

Found PCI Display device
...
GraphicsConsole video resolution 2560 x 1440
Graphics Console Started, Mode: 2
...
Found PCI Display device
...
GraphicsConsole video resolution 1920 x 1200
Graphics Console Started, Mode: 2
crawfxrd commented 1 year ago

oryp8 is also affected on 4136ef8f2b09.

crawfxrd commented 1 year ago

system76/edk2@d3b38ea28a2d is suspicious. This commit was upstreamed in tianocore/edk2@2b4b8013fe45.