Skip to content

Commit

Permalink
Reland: vulkan: add EGL_ANGLE_platform_angle_vulkan_device_uuid
Browse files Browse the repository at this point in the history
Implement the ability to select a specific device and driver combination
through a few new selection criteria:

    VkPhysicalDeviceIDProperties::deviceUUID
    VkPhysicalDeviceIDProperties::driverUUID
    VkPhysicalDeviceDriverProperties::driverID

Earlier version had problems due to a test build issue. Per syoussefi@,
going to rework the test into a separate CL so that we get the core
change merged.

Bug: angleproject:351866412
Change-Id: I0a3f4f1a2154a06bf6286a037c9ad4834ef4dda2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6165286
Reviewed-by: Yuly Novikov <[email protected]>
Commit-Queue: Yuly Novikov <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
Auto-Submit: Steven Noonan <[email protected]>
  • Loading branch information
tycho authored and Angle LUCI CQ committed Jan 10, 2025
1 parent 7f46db8 commit 3226a3d
Show file tree
Hide file tree
Showing 21 changed files with 334 additions and 65 deletions.
136 changes: 136 additions & 0 deletions extensions/EGL_ANGLE_platform_angle_vulkan_device_uuid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Name

ANGLE_platform_angle_vulkan_device_uuid

Name Strings

EGL_ANGLE_platform_angle_vulkan_device_uuid

Contributors

Steven Noonan

Contacts

Steven Noonan <[email protected]>

Status

Draft

Version

Version 1, 2024-12-13

Number

EGL Extension XXX

Extension Type

EGL client extension

Dependencies

This extension requires EGL 1.5 and the ANGLE_platform_angle_vulkan
extension.

Overview

This extension enables developers to specify additional selection criteria
when creating an ANGLE Vulkan context, ensuring that the context is
associated with a particular physical device and driver combination,
providing more precise control over device selection.

New Types

None

New Procedures and Functions

None

New Tokens

Accepted as an attribute name in the <attrib_list> argument of
eglGetPlatformDisplay:

EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID_ANGLE 0x34F0
EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID_ANGLE 0x34F1
EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID_ANGLE 0x34F2

Additions to the EGL Specification

None

New Behavior

The EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID attribute may be passed to
eglGetPlatformDisplay to specify the device UUID of the desired Vulkan
device for the ANGLE context. The EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID
attribute may be passed to select a device by its driver's VkDriverId
value.

Attributes introduced by this extension must be used in conjunction with
the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute set to
EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE. If it is not, eglGetPlatformDisplay
will generate an EGL_BAD_ATTRIBUTE error and return EGL_NO_DISPLAY.

The value provided for EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID must be
a valid pointer to a 16-byte Vulkan device UUID, or a NULL pointer
indicating that any device is acceptable. The UUID value should match the
deviceUUID field of VkPhysicalDeviceIDProperties for a VkPhysicalDevice in
the system.

The value provided for EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID must be
a valid pointer to a 16-byte Vulkan driver UUID, or a NULL pointer
indicating that any driver is acceptable. The UUID value should match the
driverUUID field of VkPhysicalDeviceIDProperties for a VkPhysicalDevice in
the system.

The value provided for EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID must be
a VkDriverId value corresponding to the driverID field of the
VkPhysicalDeviceDriverProperties structure for a device in the system.

If no VkPhysicalDevice is found matching all of the provided search
criteria, the implementation may fall back to any other available
VkPhysicalDevice.

Usage Example

// Illustrates using all of the attributes at once
uint8_t deviceUUID[16] = { /* UUID value */ };
uint8_t driverUUID[16] = { /* UUID value */ };
VkDriverId driverId = VK_DRIVER_ID_MESA_HONEYKRISP;

EGLAttrib attribs[] = {
EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE,
EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID_ANGLE, (EGLAttrib)deviceUUID,
EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID_ANGLE, (EGLAttrib)driverUUID,
EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID_ANGLE, (EGLAttrib)driverId,
EGL_NONE
};

EGLDisplay display =
eglGetPlatformDisplay(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, attribs);

if (display == EGL_NO_DISPLAY) {
// Handle display creation failure
}

Issues

1) Why provide support for specifying all three of device UUID, driver
UUID, and driver ID?

RESOLVED: The goal is to uniquely identify a specific VkPhysicalDevice
within the system, and systems may have multiple graphics drivers (or
even driver versions) which all support using the same underlying
physical device. The combination of device UUID, driver UUID, and driver
ID is currently found to be sufficient to uniquely identify any
particular driver/device combination found in real-world scenarios.

Revision History

Version 1, 2024-07-09 (Steven Noonan)
- Initial draft
7 changes: 7 additions & 0 deletions include/EGL/eglext_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
#define EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE 0x34A5
#endif /* EGL_ANGLE_platform_angle_vulkan */

#ifndef EGL_ANGLE_platform_angle_vulkan_device_uuid
#define EGL_ANGLE_platform_angle_vulkan_device_uuid 1
#define EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID_ANGLE 0x34F0
#define EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID_ANGLE 0x34F1
#define EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID_ANGLE 0x34F2
#endif /* EGL_ANGLE_platform_angle_vulkan_device_uuid */

#ifndef EGL_ANGLE_platform_angle_metal
#define EGL_ANGLE_platform_angle_metal 1
#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489
Expand Down
2 changes: 1 addition & 1 deletion scripts/code_generation_hashes/Extension_files.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"doc/ExtensionSupport.md":
"9fedcc1a67af79d93c2da1105c9bada6",
"scripts/egl_angle_ext.xml":
"0a03416ded6719c24d8198f58f8ad0c6",
"63ccd7de2f7fde008f209087eba07a57",
"scripts/extension_data/intel_630_linux.json":
"3b86832de6a7095f4617e273cba6d45e",
"scripts/extension_data/intel_630_win10.json":
Expand Down
2 changes: 1 addition & 1 deletion scripts/code_generation_hashes/GL_EGL_WGL_loader.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts/egl_angle_ext.xml":
"0a03416ded6719c24d8198f58f8ad0c6",
"63ccd7de2f7fde008f209087eba07a57",
"scripts/generate_loader.py":
"93c78a8d11323fa311fed5118fbcf083",
"scripts/gl_angle_ext.xml":
Expand Down
2 changes: 1 addition & 1 deletion scripts/code_generation_hashes/GL_EGL_entry_points.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts/egl_angle_ext.xml":
"0a03416ded6719c24d8198f58f8ad0c6",
"63ccd7de2f7fde008f209087eba07a57",
"scripts/entry_point_packed_egl_enums.json":
"a72ae855c6b403912103b519139951a1",
"scripts/entry_point_packed_gl_enums.json":
Expand Down
2 changes: 1 addition & 1 deletion scripts/code_generation_hashes/interpreter_utils.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts/egl_angle_ext.xml":
"0a03416ded6719c24d8198f58f8ad0c6",
"63ccd7de2f7fde008f209087eba07a57",
"scripts/gen_interpreter_utils.py":
"10ba16ee78604763fc883525dd275de8",
"scripts/gl_angle_ext.xml":
Expand Down
2 changes: 1 addition & 1 deletion scripts/code_generation_hashes/proc_table.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts/egl_angle_ext.xml":
"0a03416ded6719c24d8198f58f8ad0c6",
"63ccd7de2f7fde008f209087eba07a57",
"scripts/gen_proc_table.py":
"240b4a4f4c9e9592c712cfbbdc6d4d35",
"scripts/gl_angle_ext.xml":
Expand Down
12 changes: 12 additions & 0 deletions scripts/egl_angle_ext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@
<enum name="EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE"/>
</require>
</extension>
<extension name="EGL_ANGLE_platform_angle_vulkan_device_uuid" supported="egl">
<require>
<enum name="EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID_ANGLE"/>
<enum name="EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID_ANGLE"/>
<enum name="EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID_ANGLE"/>
</require>
</extension>
<extension name="EGL_ANGLE_robust_resource_initialization" supported="egl">
<require>
<enum name="EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE"/>
Expand Down Expand Up @@ -662,6 +669,11 @@
<enum value="0x34DE" name="EGL_SYNC_GLOBAL_FENCE_ANGLE"/>
<enum value="0x34DF" name="EGL_PLATFORM_ANGLE_TYPE_WEBGPU_ANGLE"/>
</enums>
<enums namespace="EGL" start="0x34F0" end="0x34FF" vendor="ANGLE">
<enum value="0x34F0" name="EGL_PLATFORM_ANGLE_VULKAN_DEVICE_UUID_ANGLE"/>
<enum value="0x34F1" name="EGL_PLATFORM_ANGLE_VULKAN_DRIVER_UUID_ANGLE"/>
<enum value="0x34F2" name="EGL_PLATFORM_ANGLE_VULKAN_DRIVER_ID_ANGLE"/>
</enums>
<enums namespace="EGL" vendor="ANGLE">
<enum value="0x0001" name="EGL_LOW_POWER_ANGLE"/>
<enum value="0x0002" name="EGL_HIGH_POWER_ANGLE"/>
Expand Down
Loading

0 comments on commit 3226a3d

Please sign in to comment.