[PATCH v2 0/2] MR9916: win32u: Fixup Vulkan deviceName to match win32u GPU name.
-- v2: win32u: Fixup Vulkan deviceName to match win32u GPU name. https://gitlab.winehq.org/wine/wine/-/merge_requests/9916
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/vulkan.c | 8 ++++++++ dlls/winevulkan/make_vulkan | 1 + dlls/winevulkan/vulkan_thunks.c | 4 ++-- include/wine/vulkan_driver.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 2b25e44eace..69721c2161b 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -1711,6 +1711,13 @@ static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) properties2->properties.deviceName, device_luid_valid, luid.HighPart, luid.LowPart ); } +static void win32u_vkGetPhysicalDeviceProperties( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties *properties ) +{ + struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); + + physical_device->instance->p_vkGetPhysicalDeviceProperties( physical_device->host.physical_device, properties ); +} + static void win32u_vkGetPhysicalDeviceProperties2( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties2 *properties2 ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); @@ -2876,6 +2883,7 @@ static struct vulkan_funcs vulkan_funcs = .p_vkGetPhysicalDeviceImageFormatProperties2 = win32u_vkGetPhysicalDeviceImageFormatProperties2, .p_vkGetPhysicalDeviceImageFormatProperties2KHR = win32u_vkGetPhysicalDeviceImageFormatProperties2KHR, .p_vkGetPhysicalDevicePresentRectanglesKHR = win32u_vkGetPhysicalDevicePresentRectanglesKHR, + .p_vkGetPhysicalDeviceProperties = win32u_vkGetPhysicalDeviceProperties, .p_vkGetPhysicalDeviceProperties2 = win32u_vkGetPhysicalDeviceProperties2, .p_vkGetPhysicalDeviceProperties2KHR = win32u_vkGetPhysicalDeviceProperties2KHR, .p_vkGetPhysicalDeviceSurfaceCapabilities2KHR = win32u_vkGetPhysicalDeviceSurfaceCapabilities2KHR, diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 792f1d955e2..7426b6835dc 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -221,6 +221,7 @@ USER_DRIVER_FUNCS = { "vkGetPhysicalDeviceImageFormatProperties2", "vkGetPhysicalDeviceImageFormatProperties2KHR", "vkGetPhysicalDevicePresentRectanglesKHR", + "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceProperties2", "vkGetPhysicalDeviceProperties2KHR", "vkGetPhysicalDeviceSurfaceCapabilities2KHR", diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index dc22cf5ebe5..d265b8a0767 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -58035,7 +58035,7 @@ static NTSTATUS thunk64_vkGetPhysicalDeviceProperties(void *args) TRACE("%p, %p\n", params->physicalDevice, params->pProperties); - vulkan_physical_device_from_handle(params->physicalDevice)->instance->p_vkGetPhysicalDeviceProperties(vulkan_physical_device_from_handle(params->physicalDevice)->host.physical_device, params->pProperties); + vk_funcs->p_vkGetPhysicalDeviceProperties(params->physicalDevice, params->pProperties); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -58051,7 +58051,7 @@ static NTSTATUS thunk32_vkGetPhysicalDeviceProperties(void *args) TRACE("%#x, %#x\n", params->physicalDevice, params->pProperties); - vulkan_physical_device_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->p_vkGetPhysicalDeviceProperties(vulkan_physical_device_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host.physical_device, &pProperties_host); + vk_funcs->p_vkGetPhysicalDeviceProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pProperties_host); convert_VkPhysicalDeviceProperties_host_to_win32(&pProperties_host, (VkPhysicalDeviceProperties32 *)UlongToPtr(params->pProperties)); return STATUS_SUCCESS; } diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index d2e2db3e360..9c18f6d20db 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -333,6 +333,7 @@ struct vulkan_funcs PFN_vkGetPhysicalDeviceImageFormatProperties2 p_vkGetPhysicalDeviceImageFormatProperties2; PFN_vkGetPhysicalDeviceImageFormatProperties2KHR p_vkGetPhysicalDeviceImageFormatProperties2KHR; PFN_vkGetPhysicalDevicePresentRectanglesKHR p_vkGetPhysicalDevicePresentRectanglesKHR; + PFN_vkGetPhysicalDeviceProperties p_vkGetPhysicalDeviceProperties; PFN_vkGetPhysicalDeviceProperties2 p_vkGetPhysicalDeviceProperties2; PFN_vkGetPhysicalDeviceProperties2KHR p_vkGetPhysicalDeviceProperties2KHR; PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR p_vkGetPhysicalDeviceSurfaceCapabilities2KHR; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9916
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/opengl.c | 4 ++-- dlls/win32u/sysparams.c | 3 ++- dlls/win32u/vulkan.c | 44 ++++++++++++++++++++++++++---------- dlls/win32u/win32u_private.h | 9 +++++++- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index ad4390486d7..70851f0139a 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2402,9 +2402,9 @@ static BOOL win32u_query_renderer( UINT attribute, void *value ) switch (attribute) { case GL_DEVICE_LUID_EXT: - return get_gpu_luid_from_uuid( &egl->device_uuid, (LUID *)value, &mask ); + return get_gpu_info_from_uuid( &egl->device_uuid, (LUID *)value, &mask, NULL ); case GL_DEVICE_NODE_MASK_EXT: - return get_gpu_luid_from_uuid( &egl->device_uuid, &luid, value ); + return get_gpu_info_from_uuid( &egl->device_uuid, &luid, value, NULL ); default: FIXME( "Unsupported attribute %#x\n", attribute ); set_gl_error( GL_INVALID_ENUM ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6081b35cf23..945b03c0b15 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -8064,7 +8064,7 @@ BOOL get_gpu_uuid_from_luid( const LUID *luid, GUID *uuid ) } /* Find the GPU LUID corresponding to a device UUID */ -BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ) +BOOL get_gpu_info_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask, char *name ) { BOOL found = FALSE; struct gpu *gpu; @@ -8076,6 +8076,7 @@ BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ) if (!IsEqualGUID( uuid, &gpu->uuid )) continue; *luid = gpu->luid; *node_mask = 1; + if (name) unicodez_to_ascii( name, gpu->name ); found = TRUE; break; } diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 69721c2161b..d30843ef8f3 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -448,11 +448,10 @@ static VkResult convert_instance_create_info( struct mempool *pool, VkInstanceCr if (instance->obj.extensions.has_VK_KHR_win32_surface && vulkan_funcs.host_extensions.has_VK_EXT_surface_maintenance1) instance->obj.extensions.has_VK_EXT_surface_maintenance1 = 1; - if (use_external_memory()) - { + if (vulkan_funcs.host_extensions.has_VK_KHR_get_physical_device_properties2) instance->obj.extensions.has_VK_KHR_get_physical_device_properties2 = 1; + if (use_external_memory()) instance->obj.extensions.has_VK_KHR_external_memory_capabilities = 1; - } /* VK_KHR_win32_keyed_mutex only requires external memory extensions, but we will use * external semaphore fds to implement it, so we enable the instance extensions too */ @@ -1676,8 +1675,11 @@ static void *find_vk_struct( void *s, VkStructureType t ) return NULL; } -static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) +static void get_physical_device_properties2( struct vulkan_physical_device *physical_device, VkPhysicalDeviceProperties2 *properties2, + PFN_vkGetPhysicalDeviceProperties2 p_vkGetPhysicalDeviceProperties2 ) { + VkPhysicalDeviceIDProperties id_host = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES }; + VkPhysicalDeviceProperties2 properties2_host; VkPhysicalDeviceVulkan11Properties *vk11; VkPhysicalDeviceIDProperties *id; VkBool32 device_luid_valid; @@ -1688,9 +1690,21 @@ static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) vk11 = find_vk_struct( properties2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES ); id = find_vk_struct( properties2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES ); - if (!vk11 && !id) return; - uuid = (const GUID *)(id ? id->deviceUUID : vk11->deviceUUID); - device_luid_valid = get_gpu_luid_from_uuid( uuid, &luid, &node_mask ); + if (!vk11 && !id) + { + properties2_host = *properties2; + id_host.pNext = properties2->pNext; + properties2_host.pNext = &id_host; + p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, &properties2_host ); + properties2->properties = properties2_host.properties; + } + else p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, properties2 ); + + if (id) uuid = (const GUID *)id->deviceUUID; + else if (vk11) uuid = (const GUID *)vk11->deviceUUID; + else uuid = (const GUID *)id_host.deviceUUID; + + device_luid_valid = get_gpu_info_from_uuid( uuid, &luid, &node_mask, properties2->properties.deviceName ); if (!device_luid_valid) WARN( "luid for %s not found\n", debugstr_guid(uuid) ); if (id) @@ -1714,24 +1728,30 @@ static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) static void win32u_vkGetPhysicalDeviceProperties( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties *properties ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); + VkPhysicalDeviceProperties2 properties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 }; - physical_device->instance->p_vkGetPhysicalDeviceProperties( physical_device->host.physical_device, properties ); + if (!physical_device->instance->extensions.has_VK_KHR_get_physical_device_properties2) + { + physical_device->instance->p_vkGetPhysicalDeviceProperties( physical_device->host.physical_device, properties ); + return; + } + get_physical_device_properties2( physical_device, &properties2, + physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR ); + *properties = properties2.properties; } static void win32u_vkGetPhysicalDeviceProperties2( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties2 *properties2 ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); - physical_device->instance->p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, properties2 ); - fill_luid_property( properties2 ); + get_physical_device_properties2( physical_device, properties2, physical_device->instance->p_vkGetPhysicalDeviceProperties2 ); } static void win32u_vkGetPhysicalDeviceProperties2KHR( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties2 *properties2 ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); - physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR( physical_device->host.physical_device, properties2 ); - fill_luid_property( properties2 ); + get_physical_device_properties2( physical_device, properties2, physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR ); } static VkResult win32u_vkGetPhysicalDeviceSurfaceFormatsKHR( VkPhysicalDevice client_physical_device, VkSurfaceKHR client_surface, diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 0f9d17644b5..f3c15f1be79 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -190,7 +190,7 @@ extern void user_lock(void); extern void user_unlock(void); extern void user_check_not_lock(void); extern BOOL get_gpu_uuid_from_luid( const LUID *luid, GUID *uuid ); -extern BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ); +extern BOOL get_gpu_info_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask, char *name ); /* d3dkmtc. */ @@ -402,6 +402,13 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) return (p - dst) * sizeof(WCHAR); } +static inline UINT unicodez_to_ascii( char *dst, const WCHAR *src ) +{ + char *p = dst; + while ((*p++ = *src++)); + return p - dst; +} + static inline BOOL is_win9x(void) { return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9916
On Mon Jan 19 16:19:25 2026 +0000, Paul Gofman wrote: > changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/9916/diffs?diff_id=238698&start_sha=5291292d7373cefa94aafc732bfa380a74ac3044#b25729bb1124b7420380f2d759cf4d27db2715cc_1678_1678) v2: - rename `get_fixed_up_physical_device_properties2` to get_physical_device_properties2. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9916#note_127340
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9916
participants (3)
-
Paul Gofman -
Paul Gofman (@gofman) -
Rémi Bernon