-- v2: winex11.drv: Attach currently active Vulkan onscreen surface in vulkan_surface_update_offscreen(). win32u: Don't invalidate existing Vulkan surface when a new one is created for window. win32u: Check for NULL hwnd before calling vulkan_surface_presented() driver callback.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/win32u/vulkan.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 84657e4c16f..ba6a7f604b4 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -701,6 +701,7 @@ void vulkan_detach_surfaces( struct list *surfaces ) driver_funcs->p_vulkan_surface_detach( surface->hwnd, surface->driver_private ); list_remove( &surface->entry ); list_init( &surface->entry ); + surface->hwnd = NULL; } }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/win32u/vulkan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index ba6a7f604b4..1e7cc917f23 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -480,7 +480,8 @@ static VkResult win32u_vkQueuePresentKHR( VkQueue client_queue, const VkPresentI struct surface *surface = swapchain->surface; RECT client_rect;
- driver_funcs->p_vulkan_surface_presented( surface->hwnd, surface->driver_private, swapchain_res ); + if (surface->hwnd) + driver_funcs->p_vulkan_surface_presented( surface->hwnd, surface->driver_private, swapchain_res );
if (swapchain_res < VK_SUCCESS) continue; if (!NtUserGetClientRect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) ))
From: Paul Gofman pgofman@codeweavers.com
--- dlls/win32u/vulkan.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 1e7cc917f23..6d8a5ef1b29 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -75,45 +75,6 @@ static struct swapchain *swapchain_from_handle( VkSwapchainKHR handle ) return CONTAINING_RECORD( obj, struct swapchain, obj ); }
-static int window_surface_compare( const void *key, const struct rb_entry *entry ) -{ - const struct surface *surface = RB_ENTRY_VALUE( entry, struct surface, window_entry ); - HWND key_hwnd = (HWND)key; - - if (key_hwnd < surface->hwnd) return -1; - if (key_hwnd > surface->hwnd) return 1; - return 0; -} - -static pthread_mutex_t window_surfaces_lock = PTHREAD_MUTEX_INITIALIZER; -static struct rb_tree window_surfaces = {.compare = window_surface_compare}; - -static void window_surfaces_insert( struct surface *surface ) -{ - struct surface *previous; - struct rb_entry *ptr; - - pthread_mutex_lock( &window_surfaces_lock ); - - if (!(ptr = rb_get( &window_surfaces, surface->hwnd ))) - rb_put( &window_surfaces, surface->hwnd, &surface->window_entry ); - else - { - previous = RB_ENTRY_VALUE( ptr, struct surface, window_entry ); - rb_replace( &window_surfaces, &previous->window_entry, &surface->window_entry ); - previous->hwnd = 0; /* make sure previous surface becomes invalid */ - } - - pthread_mutex_unlock( &window_surfaces_lock ); -} - -static void window_surfaces_remove( struct surface *surface ) -{ - pthread_mutex_lock( &window_surfaces_lock ); - if (surface->hwnd) rb_remove( &window_surfaces, &surface->window_entry ); - pthread_mutex_unlock( &window_surfaces_lock ); -} - static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance client_instance, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *ret ) { @@ -161,7 +122,6 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance client_instance, cons instance->p_insert_object( instance, &surface->obj.obj );
if (dummy) NtUserDestroyWindow( dummy ); - window_surfaces_insert( surface );
*ret = surface->obj.client.surface; return VK_SUCCESS; @@ -189,7 +149,6 @@ static void win32u_vkDestroySurfaceKHR( VkInstance client_instance, VkSurfaceKHR driver_funcs->p_vulkan_surface_destroy( surface->hwnd, surface->driver_private );
instance->p_remove_object( instance, &surface->obj.obj ); - window_surfaces_remove( surface );
free( surface ); }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winex11.drv/vulkan.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 14711537636..e462559ea82 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -161,7 +161,15 @@ static void vulkan_surface_update_offscreen( HWND hwnd, struct x11drv_vulkan_sur BOOL offscreen = needs_offscreen_rendering( hwnd, FALSE ); struct x11drv_win_data *data;
- if (offscreen == surface->offscreen) return; + if (offscreen == surface->offscreen) + { + if (!offscreen && (data = get_win_data( hwnd ))) + { + attach_client_window( data, surface->window ); + release_win_data( data ); + } + return; + } surface->offscreen = offscreen;
if (!surface->offscreen)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151100
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000000510102, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
v2: - check for detached surface in win32u instead of driver.
This merge request was approved by Rémi Bernon.