On 8/11/2025 11:26 AM, Mario Limonciello (AMD) wrote:
> Systems with more than one GPU userspace doesn't know which one to be
> used to treat as primary. The concept of primary is important to be
> able to decide which GPU is used for display and which is used for
> rendering. If it's guessed wrong then both GPUs will be kept awake
> burning a lot of power.
>
> Historically it would use the "boot_vga" attribute but this isn't
> present on modern GPUs.
>
> This series started out as changes to VGA arbiter to try to handle a case
> of a system with 2 GPUs that are not VGA devices and avoid changes to
> userspace. This was discussed but decided not to overload the VGA arbiter
> for non VGA devices.
>
> Instead move the x86 specific detection of framebuffer resources into x86
> specific code that the fbcon can use to properly identify the primary
> device. This code is still called from the VGA arbiter, and the logic does
> not change there. To avoid regression default to VGA arbiter and only fall
> back to looking up with x86 specific detection method.
>
> In order for userspace to also be able to discover which device was the
> primary video display device create a new sysfs file 'boot_display'.
>
> A matching userspace implementation for this file is available here:
> Link: https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/merge_requests/39
> Link: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2038
>
> Dave Airlie has been pinged for a comment on this approach.
> Dave had suggested in the past [1]:
>
> "
> But yes if that doesn't work, then maybe we need to make the boot_vga
> flag mean boot_display_gpu, and fix it in the kernel
> "
>
> This was one of the approached tried in earlier revisions and it was
> rejected in favor of creating a new sysfs file (which is what this
> version does).
>
> As the dependendent symbols are in 6.17-rc1 this can merge through
> drm-misc-next.
>
> Link: https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/merge_requests/37#note_2938602 [1]
>
> ---
> v10:
> * Add patches that didn't merge to v6.17-rc1 in
> * Move sysfs file to drm ownership
>
> Mario Limonciello (AMD) (4):
> Fix access to video_is_primary_device() when compiled without
> CONFIG_VIDEO
> PCI/VGA: Replace vga_is_firmware_default() with a screen info check
> fbcon: Use screen info to find primary device
> DRM: Add a new 'boot_display' attribute
>
> Documentation/ABI/testing/sysfs-class-drm | 8 +++++
> arch/parisc/include/asm/video.h | 2 +-
> arch/sparc/include/asm/video.h | 2 ++
> arch/x86/include/asm/video.h | 2 ++
> arch/x86/video/video-common.c | 25 +++++++++++++-
> drivers/gpu/drm/drm_sysfs.c | 41 +++++++++++++++++++++++
> drivers/pci/vgaarb.c | 31 +++--------------
> 7 files changed, 83 insertions(+), 28 deletions(-)
> create mode 100644 Documentation/ABI/testing/sysfs-class-drm
>
>
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
Bjorn,
Any feedback for this series?
Thanks,