Commit d519cf6c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Move thread detach from winex11.

parent dc7dcbee
...@@ -185,6 +185,10 @@ static void nulldrv_vulkan_surface_destroy( HWND hwnd, void *private ) ...@@ -185,6 +185,10 @@ static void nulldrv_vulkan_surface_destroy( HWND hwnd, void *private )
{ {
} }
static void nulldrv_vulkan_surface_detach( HWND hwnd, void *private )
{
}
static void nulldrv_vulkan_surface_presented( HWND hwnd, VkResult result ) static void nulldrv_vulkan_surface_presented( HWND hwnd, VkResult result )
{ {
} }
...@@ -203,6 +207,7 @@ static const struct vulkan_driver_funcs nulldrv_funcs = ...@@ -203,6 +207,7 @@ static const struct vulkan_driver_funcs nulldrv_funcs =
{ {
.p_vulkan_surface_create = nulldrv_vulkan_surface_create, .p_vulkan_surface_create = nulldrv_vulkan_surface_create,
.p_vulkan_surface_destroy = nulldrv_vulkan_surface_destroy, .p_vulkan_surface_destroy = nulldrv_vulkan_surface_destroy,
.p_vulkan_surface_detach = nulldrv_vulkan_surface_detach,
.p_vulkan_surface_presented = nulldrv_vulkan_surface_presented, .p_vulkan_surface_presented = nulldrv_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR,
.p_get_host_surface_extension = nulldrv_get_host_surface_extension, .p_get_host_surface_extension = nulldrv_get_host_surface_extension,
...@@ -257,6 +262,7 @@ void vulkan_detach_surfaces( struct list *surfaces ) ...@@ -257,6 +262,7 @@ void vulkan_detach_surfaces( struct list *surfaces )
LIST_FOR_EACH_ENTRY( surface, surfaces, struct surface, entry ) LIST_FOR_EACH_ENTRY( surface, surfaces, struct surface, entry )
{ {
driver_funcs->p_vulkan_surface_detach( surface->hwnd, surface->driver_private );
list_remove( &surface->entry ); list_remove( &surface->entry );
list_init( &surface->entry ); list_init( &surface->entry );
} }
......
...@@ -178,6 +178,10 @@ static void macdrv_vulkan_surface_destroy(HWND hwnd, void *private) ...@@ -178,6 +178,10 @@ static void macdrv_vulkan_surface_destroy(HWND hwnd, void *private)
wine_vk_surface_destroy(mac_surface); wine_vk_surface_destroy(mac_surface);
} }
static void macdrv_vulkan_surface_detach(HWND hwnd, void *private)
{
}
static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result) static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result)
{ {
} }
...@@ -199,6 +203,7 @@ static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = ...@@ -199,6 +203,7 @@ static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs =
{ {
.p_vulkan_surface_create = macdrv_vulkan_surface_create, .p_vulkan_surface_create = macdrv_vulkan_surface_create,
.p_vulkan_surface_destroy = macdrv_vulkan_surface_destroy, .p_vulkan_surface_destroy = macdrv_vulkan_surface_destroy,
.p_vulkan_surface_detach = macdrv_vulkan_surface_detach,
.p_vulkan_surface_presented = macdrv_vulkan_surface_presented, .p_vulkan_surface_presented = macdrv_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR,
......
...@@ -132,6 +132,10 @@ static void wayland_vulkan_surface_destroy(HWND hwnd, void *private) ...@@ -132,6 +132,10 @@ static void wayland_vulkan_surface_destroy(HWND hwnd, void *private)
wine_vk_surface_destroy(client); wine_vk_surface_destroy(client);
} }
static void wayland_vulkan_surface_detach(HWND hwnd, void *private)
{
}
static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result) static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result)
{ {
struct wayland_surface *wayland_surface; struct wayland_surface *wayland_surface;
...@@ -171,6 +175,7 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = ...@@ -171,6 +175,7 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs =
{ {
.p_vulkan_surface_create = wayland_vulkan_surface_create, .p_vulkan_surface_create = wayland_vulkan_surface_create,
.p_vulkan_surface_destroy = wayland_vulkan_surface_destroy, .p_vulkan_surface_destroy = wayland_vulkan_surface_destroy,
.p_vulkan_surface_detach = wayland_vulkan_surface_detach,
.p_vulkan_surface_presented = wayland_vulkan_surface_presented, .p_vulkan_surface_presented = wayland_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR,
......
...@@ -107,24 +107,6 @@ void destroy_vk_surface( HWND hwnd ) ...@@ -107,24 +107,6 @@ void destroy_vk_surface( HWND hwnd )
pthread_mutex_unlock( &vulkan_mutex ); pthread_mutex_unlock( &vulkan_mutex );
} }
void vulkan_thread_detach(void)
{
struct wine_vk_surface *surface, *next;
DWORD thread_id = GetCurrentThreadId();
pthread_mutex_lock(&vulkan_mutex);
LIST_FOR_EACH_ENTRY_SAFE(surface, next, &surface_list, struct wine_vk_surface, entry)
{
if (surface->hwnd_thread_id != thread_id)
continue;
TRACE("Detaching surface %p, hwnd %p.\n", surface, surface->hwnd);
XReparentWindow(gdi_display, surface->window, get_dummy_parent(), 0, 0);
XSync(gdi_display, False);
}
pthread_mutex_unlock(&vulkan_mutex);
}
static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private )
{ {
VkResult res; VkResult res;
...@@ -192,6 +174,20 @@ static void X11DRV_vulkan_surface_destroy( HWND hwnd, void *private ) ...@@ -192,6 +174,20 @@ static void X11DRV_vulkan_surface_destroy( HWND hwnd, void *private )
wine_vk_surface_release(x11_surface); wine_vk_surface_release(x11_surface);
} }
static void X11DRV_vulkan_surface_detach( HWND hwnd, void *private )
{
struct wine_vk_surface *x11_surface = private;
struct x11drv_win_data *data;
TRACE( "%p %p\n", hwnd, private );
if ((data = get_win_data( hwnd )))
{
detach_client_window( data, x11_surface->window );
release_win_data( data );
}
}
static void X11DRV_vulkan_surface_presented(HWND hwnd, VkResult result) static void X11DRV_vulkan_surface_presented(HWND hwnd, VkResult result)
{ {
} }
...@@ -214,6 +210,7 @@ static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = ...@@ -214,6 +210,7 @@ static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs =
{ {
.p_vulkan_surface_create = X11DRV_vulkan_surface_create, .p_vulkan_surface_create = X11DRV_vulkan_surface_create,
.p_vulkan_surface_destroy = X11DRV_vulkan_surface_destroy, .p_vulkan_surface_destroy = X11DRV_vulkan_surface_destroy,
.p_vulkan_surface_detach = X11DRV_vulkan_surface_detach,
.p_vulkan_surface_presented = X11DRV_vulkan_surface_presented, .p_vulkan_surface_presented = X11DRV_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR,
...@@ -247,12 +244,4 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, const struct vulkan_d ...@@ -247,12 +244,4 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, const struct vulkan_d
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
void destroy_vk_surface( HWND hwnd )
{
}
void vulkan_thread_detach(void)
{
}
#endif /* SONAME_LIBVULKAN */ #endif /* SONAME_LIBVULKAN */
...@@ -1604,7 +1604,7 @@ static void client_window_events_disable( struct x11drv_win_data *data, Window c ...@@ -1604,7 +1604,7 @@ static void client_window_events_disable( struct x11drv_win_data *data, Window c
/********************************************************************** /**********************************************************************
* detach_client_window * detach_client_window
*/ */
static void detach_client_window( struct x11drv_win_data *data, Window client_window ) void detach_client_window( struct x11drv_win_data *data, Window client_window )
{ {
if (data->client_window != client_window || !client_window) return; if (data->client_window != client_window || !client_window) return;
...@@ -1940,7 +1940,6 @@ void X11DRV_DestroyWindow( HWND hwnd ) ...@@ -1940,7 +1940,6 @@ void X11DRV_DestroyWindow( HWND hwnd )
release_win_data( data ); release_win_data( data );
free( data ); free( data );
destroy_gl_drawable( hwnd ); destroy_gl_drawable( hwnd );
destroy_vk_surface( hwnd );
} }
......
...@@ -641,7 +641,6 @@ extern void sync_gl_drawable( HWND hwnd, BOOL known_child ); ...@@ -641,7 +641,6 @@ extern void sync_gl_drawable( HWND hwnd, BOOL known_child );
extern void set_gl_drawable_parent( HWND hwnd, HWND parent ); extern void set_gl_drawable_parent( HWND hwnd, HWND parent );
extern void destroy_gl_drawable( HWND hwnd ); extern void destroy_gl_drawable( HWND hwnd );
extern void destroy_vk_surface( HWND hwnd ); extern void destroy_vk_surface( HWND hwnd );
extern void vulkan_thread_detach(void);
extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); extern void wait_for_withdrawn_state( HWND hwnd, BOOL set );
extern Window init_clip_window(void); extern Window init_clip_window(void);
...@@ -650,6 +649,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data ) ...@@ -650,6 +649,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
extern void update_net_wm_states( struct x11drv_win_data *data ); extern void update_net_wm_states( struct x11drv_win_data *data );
extern void make_window_embedded( struct x11drv_win_data *data ); extern void make_window_embedded( struct x11drv_win_data *data );
extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap );
extern void detach_client_window( struct x11drv_win_data *data, Window client_window );
extern void destroy_client_window( HWND hwnd, Window client_window ); extern void destroy_client_window( HWND hwnd, Window client_window );
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha );
extern void change_systray_owner( Display *display, Window systray_window ); extern void change_systray_owner( Display *display, Window systray_window );
......
...@@ -696,7 +696,6 @@ void X11DRV_ThreadDetach(void) ...@@ -696,7 +696,6 @@ void X11DRV_ThreadDetach(void)
if (data) if (data)
{ {
vulkan_thread_detach();
if (data->xim) XCloseIM( data->xim ); if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set ); if (data->font_set) XFreeFontSet( data->display, data->font_set );
XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */ XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define __WINE_VULKAN_DRIVER_H #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ /* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */
#define WINE_VULKAN_DRIVER_VERSION 33 #define WINE_VULKAN_DRIVER_VERSION 34
struct vulkan_funcs struct vulkan_funcs
{ {
...@@ -46,6 +46,7 @@ struct vulkan_driver_funcs ...@@ -46,6 +46,7 @@ struct vulkan_driver_funcs
{ {
VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *, void **); VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *, void **);
void (*p_vulkan_surface_destroy)(HWND, void *); void (*p_vulkan_surface_destroy)(HWND, void *);
void (*p_vulkan_surface_detach)(HWND, void *);
void (*p_vulkan_surface_presented)(HWND, VkResult); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment