Commit 4a98b07c authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

winex11.drv: Open a Vulkan device for D3DKMTOpenAdapterFromLuid().

The Vulkan device is used for querying video memory information for implementing D3DKMTQueryVideoMemoryInfo(). Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 37b74e64
......@@ -709,6 +709,8 @@ const struct gdi_dc_funcs dib_driver =
dibdrv_StrokePath, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_DIB_DRV /* priority */
};
......@@ -1263,6 +1265,8 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_DIB_DRV + 10 /* priority */
};
......@@ -550,6 +550,16 @@ static NTSTATUS CDECL nulldrv_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_C
return STATUS_PROCEDURE_NOT_FOUND;
}
static NTSTATUS CDECL nulldrv_D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
{
return STATUS_PROCEDURE_NOT_FOUND;
}
static NTSTATUS CDECL nulldrv_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc )
{
return STATUS_PROCEDURE_NOT_FOUND;
}
static NTSTATUS CDECL nulldrv_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc )
{
return STATUS_PROCEDURE_NOT_FOUND;
......@@ -647,6 +657,8 @@ const struct gdi_dc_funcs null_driver =
nulldrv_StrokePath, /* pStrokePath */
nulldrv_UnrealizePalette, /* pUnrealizePalette */
nulldrv_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */
nulldrv_D3DKMTCloseAdapter, /* pD3DKMTCloseAdapter */
nulldrv_D3DKMTOpenAdapterFromLuid, /* pD3DKMTOpenAdapterFromLuid */
nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_NULL_DRV /* priority */
......@@ -1316,6 +1328,9 @@ NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
if (!desc || !desc->hAdapter)
return STATUS_INVALID_PARAMETER;
if (get_display_driver()->pD3DKMTCloseAdapter)
get_display_driver()->pD3DKMTCloseAdapter( desc );
pthread_mutex_lock( &driver_lock );
LIST_FOR_EACH_ENTRY( adapter, &d3dkmt_adapters, struct d3dkmt_adapter, entry )
{
......@@ -1366,6 +1381,10 @@ NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc
desc->hAdapter = adapter->handle = ++handle_start;
list_add_tail( &d3dkmt_adapters, &adapter->entry );
pthread_mutex_unlock( &driver_lock );
if (get_display_driver()->pD3DKMTOpenAdapterFromLuid)
get_display_driver()->pD3DKMTOpenAdapterFromLuid( desc );
return STATUS_SUCCESS;
}
......
......@@ -523,6 +523,8 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_StrokePath, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -4268,6 +4268,8 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_FONT_DRV /* priority */
};
......
......@@ -1046,10 +1046,13 @@ static struct unix_funcs unix_funcs =
NtGdiCreateDIBitmapInternal,
NtGdiCreateMetafileDC,
NtGdiDdDDICheckVidPnExclusiveOwnership,
NtGdiDdDDICloseAdapter,
NtGdiDdDDICreateDCFromMemory,
NtGdiDdDDIDestroyDCFromMemory,
NtGdiDdDDIDestroyDevice,
NtGdiDdDDIEscape,
NtGdiDdDDIOpenAdapterFromDeviceName,
NtGdiDdDDIOpenAdapterFromLuid,
NtGdiDdDDISetVidPnSourceOwner,
NtGdiDeleteObjectApp,
NtGdiDoPalette,
......
......@@ -2120,6 +2120,8 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_PATH_DRV /* priority */
};
......@@ -51,11 +51,8 @@ static void * const syscalls[] =
NtGdiCreateRectRgn,
NtGdiCreateRoundRectRgn,
NtGdiCreateSolidBrush,
NtGdiDdDDICloseAdapter,
NtGdiDdDDICreateDevice,
NtGdiDdDDIOpenAdapterFromDeviceName,
NtGdiDdDDIOpenAdapterFromHdc,
NtGdiDdDDIOpenAdapterFromLuid,
NtGdiDdDDIQueryStatistics,
NtGdiDdDDISetQueuedLimit,
NtGdiDeleteClientObj,
......
......@@ -187,7 +187,7 @@
@ stub NtGdiDdDDICheckOcclusion
@ stub NtGdiDdDDICheckSharedResourceAccess
@ stdcall NtGdiDdDDICheckVidPnExclusiveOwnership(ptr)
@ stdcall -syscall NtGdiDdDDICloseAdapter(ptr)
@ stdcall NtGdiDdDDICloseAdapter(ptr)
@ stub NtGdiDdDDIConfigureSharedResource
@ stub NtGdiDdDDICreateAllocation
@ stub NtGdiDdDDICreateBundleObject
......@@ -268,9 +268,9 @@
@ stub NtGdiDdDDINetDispStartMiracastDisplayDevice
@ stub NtGdiDdDDINetDispStopMiracastDisplayDevice
@ stub NtGdiDdDDIOfferAllocations
@ stdcall -syscall NtGdiDdDDIOpenAdapterFromDeviceName(ptr)
@ stdcall NtGdiDdDDIOpenAdapterFromDeviceName(ptr)
@ stdcall -syscall NtGdiDdDDIOpenAdapterFromHdc(ptr)
@ stdcall -syscall NtGdiDdDDIOpenAdapterFromLuid(ptr)
@ stdcall NtGdiDdDDIOpenAdapterFromLuid(ptr)
@ stub NtGdiDdDDIOpenBundleObjectNtHandleFromName
@ stub NtGdiDdDDIOpenKeyedMutex
@ stub NtGdiDdDDIOpenKeyedMutex2
......
......@@ -58,10 +58,13 @@ struct unix_funcs
ULONG flags, HANDLE xform );
HDC (WINAPI *pNtGdiCreateMetafileDC)( HDC hdc );
NTSTATUS (WINAPI *pNtGdiDdDDICheckVidPnExclusiveOwnership)( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc );
NTSTATUS (WINAPI *pNtGdiDdDDICloseAdapter)( const D3DKMT_CLOSEADAPTER *desc );
NTSTATUS (WINAPI *pNtGdiDdDDICreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *desc );
NTSTATUS (WINAPI *pNtGdiDdDDIDestroyDCFromMemory)( const D3DKMT_DESTROYDCFROMMEMORY *desc );
NTSTATUS (WINAPI *pNtGdiDdDDIDestroyDevice)( const D3DKMT_DESTROYDEVICE *desc );
NTSTATUS (WINAPI *pNtGdiDdDDIEscape)( const D3DKMT_ESCAPE *desc );
NTSTATUS (WINAPI *pNtGdiDdDDIOpenAdapterFromDeviceName)( D3DKMT_OPENADAPTERFROMDEVICENAME *desc );
NTSTATUS (WINAPI *pNtGdiDdDDIOpenAdapterFromLuid)( D3DKMT_OPENADAPTERFROMLUID *desc );
NTSTATUS (WINAPI *pNtGdiDdDDISetVidPnSourceOwner)( const D3DKMT_SETVIDPNSOURCEOWNER *desc );
BOOL (WINAPI *pNtGdiDeleteObjectApp)( HGDIOBJ obj );
LONG (WINAPI *pNtGdiDoPalette)( HGDIOBJ handle, WORD start, WORD count, void *entries,
......
......@@ -671,6 +671,12 @@ NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNE
return unix_funcs->pNtGdiDdDDICheckVidPnExclusiveOwnership( desc );
}
NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
{
if (!unix_funcs) return STATUS_NOT_SUPPORTED;
return unix_funcs->pNtGdiDdDDICloseAdapter( desc );
}
NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
{
if (!unix_funcs) return STATUS_NOT_SUPPORTED;
......@@ -695,6 +701,18 @@ NTSTATUS WINAPI NtGdiDdDDIEscape( const D3DKMT_ESCAPE *desc )
return unix_funcs->pNtGdiDdDDIEscape( desc );
}
NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromDeviceName( D3DKMT_OPENADAPTERFROMDEVICENAME *desc )
{
if (!unix_funcs) return STATUS_NOT_SUPPORTED;
return unix_funcs->pNtGdiDdDDIOpenAdapterFromDeviceName( desc );
}
NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc )
{
if (!unix_funcs) return STATUS_NOT_SUPPORTED;
return unix_funcs->pNtGdiDdDDIOpenAdapterFromLuid( desc );
}
NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc )
{
if (!unix_funcs) return STATUS_NOT_SUPPORTED;
......
......@@ -857,6 +857,8 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_StrokePath, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -386,6 +386,8 @@ static const struct user_driver_funcs x11drv_funcs =
.dc_funcs.pStrokePath = X11DRV_StrokePath,
.dc_funcs.pUnrealizePalette = X11DRV_UnrealizePalette,
.dc_funcs.pD3DKMTCheckVidPnExclusiveOwnership = X11DRV_D3DKMTCheckVidPnExclusiveOwnership,
.dc_funcs.pD3DKMTCloseAdapter = X11DRV_D3DKMTCloseAdapter,
.dc_funcs.pD3DKMTOpenAdapterFromLuid = X11DRV_D3DKMTOpenAdapterFromLuid,
.dc_funcs.pD3DKMTSetVidPnSourceOwner = X11DRV_D3DKMTSetVidPnSourceOwner,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
......
......@@ -155,6 +155,8 @@ extern BOOL CDECL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
extern BOOL CDECL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL X11DRV_D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL X11DRV_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN;
......
......@@ -2236,6 +2236,8 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pStrokePath */
NULL, /* pUnrealizePalette */
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTCloseAdapter */
NULL, /* pD3DKMTOpenAdapterFromLuid */
NULL, /* pD3DKMTSetVidPnSourceOwner */
GDI_PRIORITY_GRAPHICS_DRV + 10 /* priority */
};
......
......@@ -602,13 +602,6 @@ NTSTATUS WINAPI wow64_NtGdiFlush( UINT *args )
return NtGdiFlush();
}
NTSTATUS WINAPI wow64_NtGdiDdDDICloseAdapter( UINT *args )
{
const D3DKMT_CLOSEADAPTER *desc = get_ptr( &args );
return NtGdiDdDDICloseAdapter( desc );
}
NTSTATUS WINAPI wow64_NtGdiDdDDICreateDevice( UINT *args )
{
struct
......@@ -644,26 +637,6 @@ NTSTATUS WINAPI wow64_NtGdiDdDDICreateDevice( UINT *args )
return status;
}
NTSTATUS WINAPI wow64_NtGdiDdDDIOpenAdapterFromDeviceName( UINT *args )
{
struct
{
ULONG pDeviceName;
D3DKMT_HANDLE hAdapter;
LUID AdapterLuid;
} *desc32 = get_ptr( &args );
D3DKMT_OPENADAPTERFROMDEVICENAME desc = { UlongToPtr( desc32->pDeviceName ) };
NTSTATUS status;
if (!(status = NtGdiDdDDIOpenAdapterFromDeviceName( &desc )))
{
desc32->hAdapter = desc.hAdapter;
desc32->AdapterLuid = desc.AdapterLuid;
}
return status;
}
NTSTATUS WINAPI wow64_NtGdiDdDDIOpenAdapterFromHdc( UINT *args )
{
struct
......@@ -686,13 +659,6 @@ NTSTATUS WINAPI wow64_NtGdiDdDDIOpenAdapterFromHdc( UINT *args )
return status;
}
NTSTATUS WINAPI wow64_NtGdiDdDDIOpenAdapterFromLuid( UINT *args )
{
D3DKMT_OPENADAPTERFROMLUID *desc = get_ptr( &args );
return NtGdiDdDDIOpenAdapterFromLuid( desc );
}
NTSTATUS WINAPI wow64_NtGdiDdDDIQueryStatistics( UINT *args )
{
D3DKMT_QUERYSTATISTICS *stats = get_ptr( &args );
......
......@@ -38,11 +38,8 @@
SYSCALL_ENTRY( NtGdiCreateRectRgn ) \
SYSCALL_ENTRY( NtGdiCreateRoundRectRgn ) \
SYSCALL_ENTRY( NtGdiCreateSolidBrush ) \
SYSCALL_ENTRY( NtGdiDdDDICloseAdapter ) \
SYSCALL_ENTRY( NtGdiDdDDICreateDevice ) \
SYSCALL_ENTRY( NtGdiDdDDIOpenAdapterFromDeviceName ) \
SYSCALL_ENTRY( NtGdiDdDDIOpenAdapterFromHdc ) \
SYSCALL_ENTRY( NtGdiDdDDIOpenAdapterFromLuid ) \
SYSCALL_ENTRY( NtGdiDdDDIQueryStatistics ) \
SYSCALL_ENTRY( NtGdiDdDDISetQueuedLimit ) \
SYSCALL_ENTRY( NtGdiDeleteClientObj ) \
......
......@@ -681,6 +681,7 @@ NTSTATUS WINAPI D3DKMTDestroyDevice(const D3DKMT_DESTROYDEVICE *desc);
NTSTATUS WINAPI D3DKMTEscape( const D3DKMT_ESCAPE *desc );
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc);
NTSTATUS WINAPI D3DKMTOpenAdapterFromHdc( D3DKMT_OPENADAPTERFROMHDC *desc );
NTSTATUS WINAPI D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID * desc );
NTSTATUS WINAPI D3DKMTQueryStatistics(D3DKMT_QUERYSTATISTICS *stats);
NTSTATUS WINAPI D3DKMTQueryVideoMemoryInfo(D3DKMT_QUERYVIDEOMEMORYINFO *desc);
NTSTATUS WINAPI D3DKMTSetQueuedLimit(D3DKMT_SETQUEUEDLIMIT *desc);
......
......@@ -158,6 +158,8 @@ struct gdi_dc_funcs
BOOL (CDECL *pStrokePath)(PHYSDEV);
BOOL (CDECL *pUnrealizePalette)(HPALETTE);
NTSTATUS (CDECL *pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *);
NTSTATUS (CDECL *pD3DKMTCloseAdapter)(const D3DKMT_CLOSEADAPTER *);
NTSTATUS (CDECL *pD3DKMTOpenAdapterFromLuid)(D3DKMT_OPENADAPTERFROMLUID *);
NTSTATUS (CDECL *pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *);
/* priority order for the driver on the stack */
......
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