Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0024d6069a67438a676b5587fa066984cca824f6
      
https://github.com/WebKit/WebKit/commit/0024d6069a67438a676b5587fa066984cca824f6
  Author: Adrian Perez de Castro <[email protected]>
  Date:   2026-05-05 (Tue, 05 May 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/egl/GLContext.cpp
    M Source/WebCore/platform/graphics/egl/GLContext.h
    M Source/WebCore/platform/graphics/egl/GLDisplay.cpp
    M Source/WebCore/platform/graphics/egl/GLDisplay.h
    M Source/WebCore/platform/graphics/gbm/PlatformDisplayGBM.h
    M Source/WebCore/platform/graphics/vulkan/VulkanTypes.cpp
    M Source/WebCore/platform/graphics/vulkan/VulkanTypes.h
    M Source/WebCore/platform/graphics/vulkan/VulkanUtilities.cpp

  Log Message:
  -----------
  [WPE][GTK] Choose Vulkan device that matches the one used by the platform 
display
https://bugs.webkit.org/show_bug.cgi?id=313491

Reviewed by Nikolas Zimmermann.

Add a Vulkan::Instance::deviceForDisplay() utility that can use the
following heuristics to determine which Vulkan device corresponds to
the device being used by the EGL display:

0. Use the information provided by the GL_EXT_memory_object extension
   to fetch the device and driver UUIDs, which can then be matched
   against those reported by Vulkan.

1. Try to obtain the DRM device information, and for devices with
   PCI-like busses match the vendor and device identifiers, otherwise
   match the major+minor device node numbers. There are two ways tried
   to obtain the DRM device:

     a. For GBM displays, reuse the logic from DRMDeviceManager used
        to pick the render node. If the gbm_device was not yet
        initialized, try to use the DRM device node path.

     b. Use the EGL_EXT_device_query and EGL_EXT_device_drm[_render_node]
        extensions to obtain paths to the render node or the main device
        node.

2. Split the list of Vulkan devices in "software based" and "hardware
   based", then figure out which of these kinds the platform device is.
   If there is only one device of the same kind, then use that.

Determining whether a platform display is "software based" is done using
the EGL_EXT_device_query, first checking EGL_EXT_device_type when
available, then try detecting the EGL_MESA_device_software marker extension,
and finally checking for the strings "llvmpipe" or "swrast" in the renderer
name.

* Source/WebCore/platform/graphics/egl/GLContext.cpp:
(WebCore::GLContext::glExtensions const):
* Source/WebCore/platform/graphics/egl/GLContext.h:
* Source/WebCore/platform/graphics/egl/GLDisplay.cpp:
(WebCore::GLDisplay::isSoftwareRendered const):
* Source/WebCore/platform/graphics/egl/GLDisplay.h:
* Source/WebCore/platform/graphics/gbm/PlatformDisplayGBM.h:
* Source/WebCore/platform/graphics/vulkan/VulkanTypes.cpp:
(WebCore::Vulkan::PhysicalDeviceIDProperties::deviceUUID const):
(WebCore::Vulkan::PhysicalDeviceIDProperties::driverUUID const):
(WebCore::Vulkan::drmFileDescriptorForGBMDisplay):
(WebCore::Vulkan::drmFileDescriptorForDisplay):
(WebCore::Vulkan::Instance::deviceForDisplay):
* Source/WebCore/platform/graphics/vulkan/VulkanTypes.h:
(WebCore::Vulkan::PhysicalDevice::PhysicalDevice):
* Source/WebCore/platform/graphics/vulkan/VulkanUtilities.cpp:
(WebCore::Vulkan::initializeIfNeeded):

Canonical link: https://commits.webkit.org/312643@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to