Skip to content

Commit

Permalink
win32u: Move D3DKMTQueryAdapterInfo into gdi_dc_funcs
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Middlebrook <[email protected]>

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.
  • Loading branch information
liam-middlebrook committed Oct 15, 2024
1 parent f25c0d0 commit 23d772f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dlls/win32u/dibdrv/dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
15 changes: 12 additions & 3 deletions dlls/win32u/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -1637,11 +1643,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);
}

/******************************************************************************
Expand Down
1 change: 1 addition & 0 deletions dlls/win32u/emfdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions dlls/win32u/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions dlls/win32u/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions dlls/winex11.drv/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions dlls/winex11.drv/x11drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
19 changes: 19 additions & 0 deletions dlls/winex11.drv/x11drv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions dlls/winex11.drv/xrender.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions include/wine/gdi_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);

Expand Down

0 comments on commit 23d772f

Please sign in to comment.