https://bugs.winehq.org/show_bug.cgi?id=53870
Bug ID: 53870 Summary: vkGetPhysicalDeviceSurfaceCapabilities2KHR passes invalid VkSurfaceKHR handle to driver Product: Wine Version: 7.20 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winevulkan Assignee: wine-bugs@winehq.org Reporter: alexandros.frantzis@collabora.com Distribution: ---
Created attachment 73397 --> https://bugs.winehq.org/attachment.cgi?id=73397 Relevant log entries of Chrome failing to initialize Vulkan
Hi!
With:
commit 000a7bbb5a10ca9144b7ab7a23c4716edf1a83b0 Author: Jacek Caban jacek@codeweavers.com Date: Fri Sep 23 21:37:45 2022 +0200
winevulkan: Use host Vulkan structures for private thunks arguments.
calling vkGetPhysicalDeviceSurfaceCapabilities2KHR (on 32-bit builds at least) ends up passing the wrong VkSurfaceKHR handle to the driver. This can be reproduced with "chrome.exe --use-angle=vulkan --in-process-gpu". I have attached the relevant parts from a debug trace of a broken run, annotated with few comments (and some extra trace points for clarity).
The issue seems to be in this generated thunk:
static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceCapabilities2KHR(void *args) { ... convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_host(params->pSurfaceInfo, &pSurfaceInfo_host); params->result = wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(params->physicalDevice, &pSurfaceInfo_host, params->pSurfaceCapabilities); ... }
The conversion function populates pSurfaceInfo_host.surface with the driver_surface handle, which is not what wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR expects.
Note that the conversion works fine when we have a direct call to the driver function, for example in the vkGetPhysicalDeviceSurfaceFormats2KHR thunk:
static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceFormats2KHR(void *args) { ... convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_host(params->pSurfaceInfo, &pSurfaceInfo_host); params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(wine_phys_dev_from_handle(params->physicalDevice)->phys_dev, &pSurfaceInfo_host, params->pSurfaceFormatCount, params->pSurfaceFormats); ... }
For verification I hacked thunk32_vkGetPhysicalDeviceSurfaceCapabilities2KHR to to use the original surface in pSurfaceInfo_host and this fixed the issue for me.
Thanks!
https://bugs.winehq.org/show_bug.cgi?id=53870
alexandros.frantzis@collabora.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #1 from alexandros.frantzis@collabora.com --- This issues has been fixed by:
commit 67c9ff6f2e28b50d85fdd3bd8397341b719fb506 Author: Jacek Caban jacek@codeweavers.com Date: Thu Oct 27 20:09:43 2022 +0200
winevulkan: Don't check thunk_type in VkParam.needs_unwrapping.
released in wine-7.21.
Thanks!
https://bugs.winehq.org/show_bug.cgi?id=53870
Jacek Caban jacek@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |67c9ff6f2e28b50d85fdd3bd839 | |7341b719fb506 Regression SHA1| |000a7bbb5a10ca9144b7ab7a23c | |4716edf1a83b0 CC| |jacek@codeweavers.com Keywords| |regression
--- Comment #2 from Jacek Caban jacek@codeweavers.com --- Thanks for the report.
https://bugs.winehq.org/show_bug.cgi?id=53870
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.22.