[PATCH xserver 4/4] xfree86: promote one GPU screen if (NumScreens == 0 && NumGPUScreens > 0)

Laszlo Ersek lersek at redhat.com
Wed Sep 7 10:41:40 UTC 2016


On 09/07/16 12:33, Hans de Goede wrote:
> On 07-09-16 12:20, Laszlo Ersek wrote:
>> On 09/07/16 11:54, Hans de Goede wrote:

>>> Ah, see now we're getting somewhere, so maybe we just need to
>>> teach xf86IsPrimaryPlatform to also accept devices marked
>>> as primary by the xf86PciProbe() iow, make it deal with
>>> primaryBus.type == BUS_PCI and in that case compare the
>>> pci busid and if they match return TRUE ?
>>
>> Nota bene: this is *exactly* what xf86IsPrimaryPci() does, as far as I
>> can see, just approaching it from the "other side". Compare:
>>
>> static Bool
>> xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
>> {
>>     return ((primaryBus.type == BUS_PLATFORM) && (plat ==
>> primaryBus.id.plat));
>> }
>>
>> versus
>>
>> Bool
>> xf86IsPrimaryPci(struct pci_device *pPci)
>> {
>>     if (primaryBus.type == BUS_PCI)
>>         return pPci == primaryBus.id.pci;
>> #ifdef XSERVER_PLATFORM_BUS
>>     if (primaryBus.type == BUS_PLATFORM)
>>         if (primaryBus.id.plat->pdev)
>>             if (MATCH_PCI_DEVICES(primaryBus.id.plat->pdev, pPci))
>>                 return TRUE;
>> #endif
>>     return FALSE;
>> }
>>
>> So xf86IsPrimaryPci() accepts a platform device as primary PCI device
>> if the "deep description" matches, but xf86IsPrimaryPlatform() does
>> not implement the "vice versa".
>>
>> I didn't recommend extending xf86IsPrimaryPlatform() like this (that
>> is, to practically unify the two "is primary?" functions) because I
>> found it extremely confusing that the two separate enumeration paths
>> (platform *and* PCI) would *both* have to "look the other way" for
>> determining a primary. I mean, what sense does it make to accept a
>> BUS_PLATFORM device as primary PCI device, but then *also* accept a
>> BUS_PCI device as primary platform device? One of those should really
>> be unnecessary, dependent on the order between the enumerations.
>>
>>>
>>> I think that should fix your problem and it matches the intend
>>> of how things are supposed to work.
>>
>> Yes, unifying xf86IsPrimaryPlatform() and xf86IsPrimaryPci() would
>> likely work (both including the same "deep comparison"), but as I said
>> above, I can't fathom why "looking the other way" would be necessary
>> in both places.
> 
> The problem really is that the new platform-bus and the old pci-bus
> code overlap, platform-bus can handle any type of device including
> pci devices (but also e.g. usb) where as the pci code can only
> handle pci devices. Some drivers only support the old style
> pci-probe methods, but the primary device detection code is
> server based, not driver based, so we might end up with
> a primary device which only has a pci-bus capable driver
> which was detected as primary by the platform code, or
> as in your case the other way around.
> 
> TL;DR: I believe that modifying the xf86IsPrimaryPlatform()
> code to more or less mirror xf86IsPrimaryPci is the right thing
> to do, please give this a try.

Will do, thanks!
Laszlo



More information about the xorg-devel mailing list