From 8d042bc2922573b83cac6738d1a2d157daee2059 Mon Sep 17 00:00:00 2001 From: Liam Middlebrook Date: Sat, 12 Oct 2024 15:31:38 -0700 Subject: [PATCH] win32u: Move D3DKMTQueryAdapterInfo into gdi_dc_funcs Signed-off-by: Liam Middlebrook Note: This commit is specifically targeted towards ValveSoftware/wine experimental_9.0 branch. Upstream wine contains commits which already implement this, but are part of a larger series of changes inter-twined with WoW64 and unification of GDI backends. Link: https://github.com/ValveSoftware/wine/pull/259 --- dlls/win32u/dibdrv/dc.c | 2 ++ dlls/win32u/driver.c | 15 ++++++++++++--- dlls/win32u/emfdrv.c | 1 + dlls/win32u/font.c | 1 + dlls/win32u/path.c | 1 + dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 19 +++++++++++++++++++ dlls/winex11.drv/xrender.c | 1 + include/wine/gdi_driver.h | 1 + 10 files changed, 40 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/dibdrv/dc.c b/dlls/win32u/dibdrv/dc.c index 7fe4b765a787..737c28adc8a5 100644 --- a/dlls/win32u/dibdrv/dc.c +++ b/dlls/win32u/dibdrv/dc.c @@ -710,6 +710,7 @@ const struct gdi_dc_funcs dib_driver = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_DIB_DRV /* priority */ @@ -1271,6 +1272,7 @@ static const struct gdi_dc_funcs window_driver = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_DIB_DRV + 10 /* priority */ diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 220fc54096b1..ca7e239fe98c 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -554,6 +554,11 @@ static NTSTATUS nulldrv_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *d return STATUS_PROCEDURE_NOT_FOUND; } +static NTSTATUS nulldrv_D3DKMTQueryAdapterInfo( D3DKMT_QUERYADAPTERINFO *desc ) +{ + return STATUS_PROCEDURE_NOT_FOUND; +} + static NTSTATUS nulldrv_D3DKMTQueryVideoMemoryInfo( D3DKMT_QUERYVIDEOMEMORYINFO *desc ) { return STATUS_PROCEDURE_NOT_FOUND; @@ -658,6 +663,7 @@ const struct gdi_dc_funcs null_driver = nulldrv_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */ nulldrv_D3DKMTCloseAdapter, /* pD3DKMTCloseAdapter */ nulldrv_D3DKMTOpenAdapterFromLuid, /* pD3DKMTOpenAdapterFromLuid */ + nulldrv_D3DKMTQueryAdapterInfo, /* pD3DKMTQueryAdapterInfo */ nulldrv_D3DKMTQueryVideoMemoryInfo, /* pD3DKMTQueryVideoMemoryInfo */ nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */ @@ -1636,11 +1642,14 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) */ NTSTATUS WINAPI NtGdiDdDDIQueryAdapterInfo( D3DKMT_QUERYADAPTERINFO *desc ) { - if (!desc) + TRACE("(%p)\n", desc); + + if (!desc || !desc->hAdapter) return STATUS_INVALID_PARAMETER; - FIXME("desc %p, type %d stub\n", desc, desc->Type); - return STATUS_NOT_IMPLEMENTED; + if (!get_display_driver()->pD3DKMTQueryAdapterInfo) + return STATUS_PROCEDURE_NOT_FOUND; + return get_display_driver()->pD3DKMTQueryAdapterInfo(desc); } /****************************************************************************** diff --git a/dlls/win32u/emfdrv.c b/dlls/win32u/emfdrv.c index 069ad9d1297d..28bc47772d43 100644 --- a/dlls/win32u/emfdrv.c +++ b/dlls/win32u/emfdrv.c @@ -522,6 +522,7 @@ static const struct gdi_dc_funcs emfdrv_driver = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 0bf793e85846..313599282008 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -4814,6 +4814,7 @@ const struct gdi_dc_funcs font_driver = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_FONT_DRV /* priority */ diff --git a/dlls/win32u/path.c b/dlls/win32u/path.c index e0c96f5ef6fa..2783cd518328 100644 --- a/dlls/win32u/path.c +++ b/dlls/win32u/path.c @@ -2121,6 +2121,7 @@ const struct gdi_dc_funcs path_driver = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_PATH_DRV /* priority */ diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 5576fdd50e60..9bce0740fd3a 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -389,6 +389,7 @@ static const struct user_driver_funcs x11drv_funcs = .dc_funcs.pD3DKMTCheckVidPnExclusiveOwnership = X11DRV_D3DKMTCheckVidPnExclusiveOwnership, .dc_funcs.pD3DKMTCloseAdapter = X11DRV_D3DKMTCloseAdapter, .dc_funcs.pD3DKMTOpenAdapterFromLuid = X11DRV_D3DKMTOpenAdapterFromLuid, + .dc_funcs.pD3DKMTQueryAdapterInfo = X11DRV_D3DKMTQueryAdapterInfo, .dc_funcs.pD3DKMTQueryVideoMemoryInfo = X11DRV_D3DKMTQueryVideoMemoryInfo, .dc_funcs.pD3DKMTSetVidPnSourceOwner = X11DRV_D3DKMTSetVidPnSourceOwner, .dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV, diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a38ca0045c90..add0509612f0 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -163,6 +163,7 @@ extern BOOL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, extern NTSTATUS X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ); extern NTSTATUS X11DRV_D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc ); extern NTSTATUS X11DRV_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc ); +extern NTSTATUS X11DRV_D3DKMTQueryAdapterInfo( D3DKMT_QUERYADAPTERINFO *desc ); extern NTSTATUS X11DRV_D3DKMTQueryVideoMemoryInfo( D3DKMT_QUERYVIDEOMEMORYINFO *desc ); extern NTSTATUS X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ); extern BOOL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 2368e59cc160..734424c0b47c 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -1399,6 +1399,25 @@ NTSTATUS X11DRV_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc ) return status; } +NTSTATUS X11DRV_D3DKMTQueryAdapterInfo( D3DKMT_QUERYADAPTERINFO *desc ) +{ + NTSTATUS status = STATUS_INVALID_PARAMETER; + struct x11_d3dkmt_adapter *adapter; + + pthread_mutex_lock(&d3dkmt_mutex); + LIST_FOR_EACH_ENTRY(adapter, &x11_d3dkmt_adapters, struct x11_d3dkmt_adapter, entry) + { + if (adapter->handle != desc->hAdapter) + continue; + + FIXME("desc %p, type %d stub\n", desc, desc->Type); + status = STATUS_NOT_IMPLEMENTED; + break; + } + pthread_mutex_unlock(&d3dkmt_mutex); + return status; +} + NTSTATUS X11DRV_D3DKMTQueryVideoMemoryInfo( D3DKMT_QUERYVIDEOMEMORYINFO *desc ) { const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION); diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 7656c0637df2..c69c260138f9 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2434,6 +2434,7 @@ static const struct gdi_dc_funcs xrender_funcs = NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */ NULL, /* pD3DKMTCloseAdapter */ NULL, /* pD3DKMTOpenAdapterFromLuid */ + NULL, /* pD3DKMTQueryAdapterInfo */ NULL, /* pD3DKMTQueryVideoMemoryInfo */ NULL, /* pD3DKMTSetVidPnSourceOwner */ GDI_PRIORITY_GRAPHICS_DRV + 10 /* priority */ diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 26562bfef2b8..bd1ae446f73f 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -169,6 +169,7 @@ struct gdi_dc_funcs NTSTATUS (*pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *); NTSTATUS (*pD3DKMTCloseAdapter)(const D3DKMT_CLOSEADAPTER *); NTSTATUS (*pD3DKMTOpenAdapterFromLuid)(D3DKMT_OPENADAPTERFROMLUID *); + NTSTATUS (*pD3DKMTQueryAdapterInfo)(D3DKMT_QUERYADAPTERINFO *); NTSTATUS (*pD3DKMTQueryVideoMemoryInfo)(D3DKMT_QUERYVIDEOMEMORYINFO *); NTSTATUS (*pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *);