Commit e53b68ac authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

win32u: Move wine_get_wgl_driver() from DC driver.

To get rid of get_dc_ptr() and thus not to fail concurrent __wine_get_wgl_driver(). Signed-off-by: 's avatarPaul Gofman <pgofman@codeweavers.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent dfb7428f
......@@ -346,8 +346,10 @@ static struct user_driver_funcs lazy_load_driver =
NULL,
/* vulkan support */
NULL,
/* opengl support */
NULL,
/* thread management */
NULL
NULL,
};
void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version )
......
......@@ -36,6 +36,8 @@
#include "winternl.h"
#include "winerror.h"
#include "ntgdi_private.h"
#include "wine/wgl.h"
#include "wine/wgl_driver.h"
#include "wine/debug.h"
......@@ -763,6 +765,7 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD
dc->attr->vis_rect.top = 0;
dc->attr->vis_rect.right = NtGdiGetDeviceCaps( hdc, DESKTOPHORZRES );
dc->attr->vis_rect.bottom = NtGdiGetDeviceCaps( hdc, DESKTOPVERTRES );
dc->is_display = !!is_display;
DC_InitDC( dc );
release_dc_ptr( dc );
......@@ -1364,3 +1367,33 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH
release_dc_ptr(dc);
return ret;
}
/***********************************************************************
* __wine_get_wgl_driver (win32u.@)
*/
struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
{
BOOL is_display, is_memdc;
DC *dc;
if (version != WINE_WGL_DRIVER_VERSION)
{
ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n",
version, WINE_WGL_DRIVER_VERSION );
return NULL;
}
if (!(dc = get_dc_obj( hdc ))) return NULL;
if (dc->attr->disabled)
{
GDI_ReleaseObj( hdc );
return NULL;
}
is_display = dc->is_display;
is_memdc = get_gdi_object_type( hdc ) == NTGDI_OBJ_MEMDC;
GDI_ReleaseObj( hdc );
if (is_display) return user_driver->pwine_get_wgl_driver( version );
if (is_memdc) return dibdrv_get_wgl_driver();
return (void *)-1;
}
......@@ -603,15 +603,10 @@ static struct opengl_funcs opengl_funcs =
};
/**********************************************************************
* dibdrv_wine_get_wgl_driver
* dibdrv_get_wgl_driver
*/
static struct opengl_funcs * CDECL dibdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
struct opengl_funcs *dibdrv_get_wgl_driver(void)
{
if (version != WINE_WGL_DRIVER_VERSION)
{
ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n", version, WINE_WGL_DRIVER_VERSION );
return NULL;
}
if (!osmesa_funcs && !(osmesa_funcs = init_opengl_lib()))
{
static int warned;
......@@ -715,7 +710,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
dibdrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
GDI_PRIORITY_DIB_DRV /* priority */
};
......@@ -1177,13 +1171,6 @@ static INT CDECL windrv_StretchDIBits( PHYSDEV dev, INT x_dst, INT y_dst, INT wi
return ret;
}
static struct opengl_funcs * CDECL windrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
{
dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
if (dev->funcs == &dib_driver) dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
return dev->funcs->wine_get_wgl_driver( dev, version );
}
static const struct gdi_dc_funcs window_driver =
{
NULL, /* pAbortDoc */
......@@ -1277,6 +1264,5 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
windrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
GDI_PRIORITY_DIB_DRV + 10 /* priority */
};
......@@ -571,11 +571,6 @@ static NTSTATUS CDECL nulldrv_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSO
return STATUS_PROCEDURE_NOT_FOUND;
}
static struct opengl_funcs * CDECL nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
{
return (void *)-1;
}
const struct gdi_dc_funcs null_driver =
{
nulldrv_AbortDoc, /* pAbortDoc */
......@@ -669,7 +664,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_UnrealizePalette, /* pUnrealizePalette */
nulldrv_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */
nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */
nulldrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
GDI_PRIORITY_NULL_DRV /* priority */
};
......@@ -928,6 +922,11 @@ static const struct vulkan_funcs * CDECL nulldrv_wine_get_vulkan_driver( UINT ve
return NULL;
}
static struct opengl_funcs * CDECL nulldrv_wine_get_wgl_driver( UINT version )
{
return (void *)-1;
}
static void CDECL nulldrv_ThreadDetach( void )
{
}
......@@ -1070,6 +1069,8 @@ static const struct user_driver_funcs lazy_load_driver =
.pSystemParametersInfo = nulldrv_SystemParametersInfo,
/* vulkan support */
.pwine_get_vulkan_driver = loaderdrv_wine_get_vulkan_driver,
/* opengl support */
.pwine_get_wgl_driver = nulldrv_wine_get_wgl_driver,
/* thread management */
.pThreadDetach = nulldrv_ThreadDetach,
};
......@@ -1133,6 +1134,7 @@ void CDECL __wine_set_display_driver( struct user_driver_funcs *driver, UINT ver
SET_USER_FUNC(WindowPosChanged);
SET_USER_FUNC(SystemParametersInfo);
SET_USER_FUNC(wine_get_vulkan_driver);
SET_USER_FUNC(wine_get_wgl_driver);
SET_USER_FUNC(ThreadDetach);
#undef SET_USER_FUNC
......@@ -1375,20 +1377,3 @@ NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNE
return get_display_driver()->pD3DKMTCheckVidPnExclusiveOwnership( desc );
}
/***********************************************************************
* __wine_get_wgl_driver (win32u.@)
*/
struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
{
struct opengl_funcs *ret = NULL;
DC * dc = get_dc_ptr( hdc );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, wine_get_wgl_driver );
ret = physdev->funcs->wine_get_wgl_driver( physdev, version );
release_dc_ptr( dc );
}
return ret;
}
......@@ -524,7 +524,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -4351,7 +4351,6 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_FONT_DRV /* priority */
};
......
......@@ -58,6 +58,7 @@ typedef struct tagDC
DCHOOKPROC hookProc; /* DC hook */
BOOL bounds_enabled:1; /* bounds tracking is enabled */
BOOL path_open:1; /* path is currently open (only for saved DCs) */
BOOL is_display:1; /* DC is for display device */
RECT device_rect; /* rectangle for the whole device */
int pixel_format; /* pixel format (for memory DCs) */
......@@ -206,6 +207,7 @@ extern UINT get_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries,
extern UINT set_dib_dc_color_table( HDC hdc, UINT startpos, UINT entries,
const RGBQUAD *colors ) DECLSPEC_HIDDEN;
extern void dibdrv_set_window_surface( DC *dc, struct window_surface *surface ) DECLSPEC_HIDDEN;
extern struct opengl_funcs *dibdrv_get_wgl_driver(void) DECLSPEC_HIDDEN;
/* driver.c */
extern const struct gdi_dc_funcs null_driver DECLSPEC_HIDDEN;
......
......@@ -2121,6 +2121,5 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_PATH_DRV /* priority */
};
......@@ -261,16 +261,9 @@ BOOL CDECL ANDROID_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devm
/**********************************************************************
* ANDROID_wine_get_wgl_driver
*/
static struct opengl_funcs * CDECL ANDROID_wine_get_wgl_driver( PHYSDEV dev, UINT version )
static struct opengl_funcs * CDECL ANDROID_wine_get_wgl_driver( UINT version )
{
struct opengl_funcs *ret;
if (!(ret = get_wgl_driver( version )))
{
dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
ret = dev->funcs->wine_get_wgl_driver( dev, version );
}
return ret;
return get_wgl_driver( version );
}
......@@ -279,7 +272,6 @@ static const struct user_driver_funcs android_drv_funcs =
.dc_funcs.pCreateCompatibleDC = ANDROID_CreateCompatibleDC,
.dc_funcs.pCreateDC = ANDROID_CreateDC,
.dc_funcs.pDeleteDC = ANDROID_DeleteDC,
.dc_funcs.wine_get_wgl_driver = ANDROID_wine_get_wgl_driver,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
.pGetKeyNameText = ANDROID_GetKeyNameText,
......@@ -302,6 +294,7 @@ static const struct user_driver_funcs android_drv_funcs =
.pWindowMessage = ANDROID_WindowMessage,
.pWindowPosChanging = ANDROID_WindowPosChanging,
.pWindowPosChanged = ANDROID_WindowPosChanged,
.pwine_get_wgl_driver = ANDROID_wine_get_wgl_driver,
};
......
......@@ -268,7 +268,6 @@ static const struct user_driver_funcs macdrv_funcs =
.dc_funcs.pGetDeviceCaps = macdrv_GetDeviceCaps,
.dc_funcs.pGetDeviceGammaRamp = macdrv_GetDeviceGammaRamp,
.dc_funcs.pSetDeviceGammaRamp = macdrv_SetDeviceGammaRamp,
.dc_funcs.wine_get_wgl_driver = macdrv_wine_get_wgl_driver,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
.pActivateKeyboardLayout = macdrv_ActivateKeyboardLayout,
......@@ -309,6 +308,7 @@ static const struct user_driver_funcs macdrv_funcs =
.pWindowPosChanged = macdrv_WindowPosChanged,
.pWindowPosChanging = macdrv_WindowPosChanging,
.pwine_get_vulkan_driver = macdrv_wine_get_vulkan_driver,
.pwine_get_wgl_driver = macdrv_wine_get_wgl_driver,
};
......
......@@ -263,7 +263,7 @@ extern BOOL query_drag_operation(macdrv_query* query) DECLSPEC_HIDDEN;
extern BOOL query_drag_exited(macdrv_query* query) DECLSPEC_HIDDEN;
extern BOOL query_drag_drop(macdrv_query* query) DECLSPEC_HIDDEN;
extern struct opengl_funcs * CDECL macdrv_wine_get_wgl_driver(PHYSDEV dev, UINT version) DECLSPEC_HIDDEN;
extern struct opengl_funcs * CDECL macdrv_wine_get_wgl_driver(UINT version) DECLSPEC_HIDDEN;
extern const struct vulkan_funcs * CDECL macdrv_wine_get_vulkan_driver(UINT version) DECLSPEC_HIDDEN;
extern void sync_gl_view(struct macdrv_win_data* data, const RECT* old_whole_rect, const RECT* old_client_rect) DECLSPEC_HIDDEN;
......
......@@ -4632,7 +4632,7 @@ static struct opengl_funcs opengl_funcs =
/**********************************************************************
* macdrv_wine_get_wgl_driver
*/
struct opengl_funcs * CDECL macdrv_wine_get_wgl_driver(PHYSDEV dev, UINT version)
struct opengl_funcs * CDECL macdrv_wine_get_wgl_driver(UINT version)
{
static INIT_ONCE opengl_init = INIT_ONCE_STATIC_INIT;
......
......@@ -858,7 +858,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -312,16 +312,9 @@ static INT CDECL X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOI
/**********************************************************************
* X11DRV_wine_get_wgl_driver
*/
static struct opengl_funcs * CDECL X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT version )
static struct opengl_funcs * CDECL X11DRV_wine_get_wgl_driver( UINT version )
{
struct opengl_funcs *ret;
if (!(ret = get_glx_driver( version )))
{
dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
ret = dev->funcs->wine_get_wgl_driver( dev, version );
}
return ret;
return get_glx_driver( version );
}
/**********************************************************************
......@@ -377,7 +370,6 @@ static const struct user_driver_funcs x11drv_funcs =
.dc_funcs.pUnrealizePalette = X11DRV_UnrealizePalette,
.dc_funcs.pD3DKMTCheckVidPnExclusiveOwnership = X11DRV_D3DKMTCheckVidPnExclusiveOwnership,
.dc_funcs.pD3DKMTSetVidPnSourceOwner = X11DRV_D3DKMTSetVidPnSourceOwner,
.dc_funcs.wine_get_wgl_driver = X11DRV_wine_get_wgl_driver,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
.pActivateKeyboardLayout = X11DRV_ActivateKeyboardLayout,
......@@ -419,6 +411,7 @@ static const struct user_driver_funcs x11drv_funcs =
.pWindowPosChanged = X11DRV_WindowPosChanged,
.pSystemParametersInfo = X11DRV_SystemParametersInfo,
.pwine_get_vulkan_driver = X11DRV_wine_get_vulkan_driver,
.pwine_get_wgl_driver = X11DRV_wine_get_wgl_driver,
.pThreadDetach = X11DRV_ThreadDetach,
};
......
......@@ -2246,7 +2246,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
GDI_PRIORITY_GRAPHICS_DRV + 10 /* priority */
};
......
......@@ -159,14 +159,13 @@ struct gdi_dc_funcs
BOOL (CDECL *pUnrealizePalette)(HPALETTE);
NTSTATUS (CDECL *pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *);
NTSTATUS (CDECL *pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *);
struct opengl_funcs * (CDECL *wine_get_wgl_driver)(PHYSDEV,UINT);
/* priority order for the driver on the stack */
UINT priority;
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 74
#define WINE_GDI_DRIVER_VERSION 75
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
......@@ -321,6 +320,8 @@ struct user_driver_funcs
BOOL (CDECL *pSystemParametersInfo)(UINT,UINT,void*,UINT);
/* vulkan support */
const struct vulkan_funcs * (CDECL *pwine_get_vulkan_driver)(UINT);
/* opengl support */
struct opengl_funcs * (CDECL *pwine_get_wgl_driver)(UINT);
/* thread management */
void (CDECL *pThreadDetach)(void);
};
......
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