xfree86: Allow overriding primary GPU detection from an OutputClass section

Allow using:

Option "PrimaryGPU" "yes"

In an OutputClass section to override the default primary GPU device
selection which selects the GPU used as output by the firmware.

If multiple output devices match an OutputClass section with
the PrimaryGPU option set, the first one enumerated becomes the
primary GPU.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans De Goede 2016-12-12 17:03:16 +01:00 committed by Adam Jackson
parent ab1a65b775
commit d75ffcdbf8
2 changed files with 30 additions and 1 deletions

View File

@ -286,6 +286,7 @@ xf86platformProbe(void)
{ {
int i; int i;
Bool pci = TRUE; Bool pci = TRUE;
XF86ConfOutputClassPtr cl;
config_odev_probe(xf86PlatformDeviceProbe); config_odev_probe(xf86PlatformDeviceProbe);
@ -301,6 +302,24 @@ xf86platformProbe(void)
} }
} }
/* First see if there is an OutputClass match marking a device as primary */
for (i = 0; i < xf86_num_platform_devices; i++) {
struct xf86_platform_device *dev = &xf86_platform_devices[i];
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (!OutputClassMatches(cl, dev))
continue;
if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
cl->identifier, dev->attribs->path);
primaryBus.type = BUS_PLATFORM;
primaryBus.id.plat = dev;
return 0;
}
}
}
/* Then check for pci_device_is_boot_vga() */
for (i = 0; i < xf86_num_platform_devices; i++) { for (i = 0; i < xf86_num_platform_devices; i++) {
struct xf86_platform_device *dev = &xf86_platform_devices[i]; struct xf86_platform_device *dev = &xf86_platform_devices[i];

View File

@ -1285,11 +1285,21 @@ When an output device has been matched to the
.B OutputClass .B OutputClass
section, any section, any
.B Option .B Option
entries are applied to the device. See the entries are applied to the device. One
.B OutputClass
specific
.B Option
is recognized. See the
.B Device .B Device
section below for a description of the remaining section below for a description of the remaining
.B Option .B Option
entries. entries.
.TP 7
.BI "Option \*qPrimaryGPU\*q \*q" boolean \*q
This option specifies that the matched device should be treated as the
primary GPU, replacing the selection of the GPU used as output by the
firmware. If multiple output devices match an OutputClass section with
the PrimaryGPU option set, the first one enumerated becomes the primary GPU.
.SH "DEVICE SECTION" .SH "DEVICE SECTION"
The config file may have multiple The config file may have multiple
.B Device .B Device