[PATCH weston 2/2] compositor-drm: prefer primary GPU over other GPUs

David Herrmann dh.herrmann at googlemail.com
Mon Oct 29 08:42:32 PDT 2012


Hi Dave

On Sun, Oct 28, 2012 at 7:26 PM, Dave Airlie <airlied at gmail.com> wrote:
> On Sat, Oct 27, 2012 at 10:54 PM, David Herrmann
> <dh.herrmann at googlemail.com> wrote:
>> This rewrites the GPU detection of the DRM backend and uses the new PCI
>> helpers to find the primary GPU. If no primary GPU is found, the first GPU
>> on the seat is used.
>
> In X I've found we only do that for seat 0, for other seats we just
> use the gpu assigned to the seat.

The logic I implemented is to look for the primary-GPU only on the
seat where this GPU is assigned to. So if the user assigned it to
another seat than seat0, we will use the primary-GPU on this seat.
All other seats are unaffected by this change.

I don't think hardcoding to seat0 helps here, as a user is not
required to use this seat at all. They can even make udev assign every
device to some random seat and then no device will every be unattached
or attached to seat0.

Also note that this logic only applies if _multiple_ GPUs are assigned
to a single seat. If only one GPU is assigned, we automatically use
it.

>>
>> This is useful for systems with multiple GPUs that share
>> display-controllers. We want to use the boot/primary GPU instead of
>> possible offload-GPUs.
>> Note that the kernel does not provide this information, yet, so we need to
>> retrieve it via the PCI bus. It is also unclear whether the kernel will
>> ever report this data as this is hardly possible to detect properly in the
>> kernel.
>
> That's how the kernel provides is via sysfs pci support, the concept
> of primary GPU only makes sense for PCI devices where you have VGA
> routing bits to pick the current VGA device.

My comment was rather about the information which GPU can be used
independently by user-space. Anyway, I wasn't aware that the kernel
provides a boot_vga sysfs attribute with the same information. So I
can rewrite this patch to use this attribute instead of using
libpciaccess.

Thanks!
David


More information about the wayland-devel mailing list