D3DKMTSetVidPnSourceOwner needs to be implemented in user drivers because we need to maintain the VidPN source ownership information list in user driver. For example, user drivers need to release the exclusive owner when a new window is moved to a monitor which already have an exclusive owner.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- .../api-ms-win-dx-d3dkmt-l1-1-0.spec | 2 +- dlls/d3d11/d3d11.spec | 2 +- dlls/gdi32/dibdrv/dc.c | 2 ++ dlls/gdi32/driver.c | 29 +++++++++++++++++++ dlls/gdi32/enhmfdrv/dc.c | 1 + dlls/gdi32/enhmfdrv/init.c | 1 + dlls/gdi32/freetype.c | 1 + dlls/gdi32/gdi32.spec | 1 + dlls/gdi32/mfdrv/init.c | 1 + dlls/gdi32/path.c | 1 + dlls/wineandroid.drv/init.c | 1 + dlls/winemac.drv/gdi.c | 1 + dlls/wineps.drv/init.c | 1 + dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/xrender.c | 1 + include/ddk/d3dkmthk.h | 1 + include/wine/gdi_driver.h | 5 +++- 17 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/dlls/api-ms-win-dx-d3dkmt-l1-1-0/api-ms-win-dx-d3dkmt-l1-1-0.spec b/dlls/api-ms-win-dx-d3dkmt-l1-1-0/api-ms-win-dx-d3dkmt-l1-1-0.spec index 43452cda74..c14ebc68e9 100644 --- a/dlls/api-ms-win-dx-d3dkmt-l1-1-0/api-ms-win-dx-d3dkmt-l1-1-0.spec +++ b/dlls/api-ms-win-dx-d3dkmt-l1-1-0/api-ms-win-dx-d3dkmt-l1-1-0.spec @@ -82,7 +82,7 @@ @ stub D3DKMTSetProcessSchedulingPriorityClass @ stub D3DKMTSetQueuedLimit @ stub D3DKMTSetStereoEnabled -@ stub D3DKMTSetVidPnSourceOwner +@ stdcall D3DKMTSetVidPnSourceOwner(ptr) gdi32.D3DKMTSetVidPnSourceOwner @ stub D3DKMTShareObjects @ stub D3DKMTSharedPrimaryLockNotification @ stub D3DKMTSharedPrimaryUnLockNotification diff --git a/dlls/d3d11/d3d11.spec b/dlls/d3d11/d3d11.spec index 01bc8bfebc..606ddae3e3 100644 --- a/dlls/d3d11/d3d11.spec +++ b/dlls/d3d11/d3d11.spec @@ -35,7 +35,7 @@ @ stub D3DKMTSetDisplayMode @ stub D3DKMTSetDisplayPrivateDriverFormat @ stub D3DKMTSetGammaRamp -@ stub D3DKMTSetVidPnSourceOwner +@ stdcall D3DKMTSetVidPnSourceOwner(ptr) gdi32.D3DKMTSetVidPnSourceOwner @ stub D3DKMTSignalSynchronizationObject @ stub D3DKMTUnlock @ stub D3DKMTWaitForSynchronizationObject diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index a3f84bd688..10c3fc6f69 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -520,6 +520,7 @@ const struct gdi_dc_funcs dib_driver = dibdrv_StrokePath, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ dibdrv_wine_get_wgl_driver, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_DIB_DRV /* priority */ @@ -1143,6 +1144,7 @@ static const struct gdi_dc_funcs window_driver = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ windrv_wine_get_wgl_driver, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_DIB_DRV + 10 /* priority */ diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 49ed081df1..71a52ed9fc 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -753,6 +753,11 @@ static BOOL nulldrv_UnrealizePalette( HPALETTE palette ) return FALSE; }
+static NTSTATUS WINAPI nulldrv_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) +{ + return STATUS_PROCEDURE_NOT_FOUND; +} + static struct opengl_funcs *nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version ) { return (void *)-1; @@ -892,6 +897,7 @@ const struct gdi_dc_funcs null_driver = nulldrv_StrokePath, /* pStrokePath */ nulldrv_UnrealizePalette, /* pUnrealizePalette */ nulldrv_WidenPath, /* pWidenPath */ + nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */ nulldrv_wine_get_wgl_driver, /* wine_get_wgl_driver */ nulldrv_wine_get_vulkan_driver, /* wine_get_vulkan_driver */
@@ -1422,6 +1428,7 @@ NTSTATUS WINAPI D3DKMTCreateDevice( D3DKMT_CREATEDEVICE *desc ) NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) { NTSTATUS status = STATUS_INVALID_PARAMETER; + D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc; struct d3dkmt_device *device;
TRACE("(%p)\n", desc); @@ -1434,6 +1441,9 @@ NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) { if (device->handle == desc->hDevice) { + memset( &set_owner_desc, 0, sizeof(set_owner_desc) ); + set_owner_desc.hDevice = desc->hDevice; + D3DKMTSetVidPnSourceOwner( &set_owner_desc ); list_remove( &device->entry ); heap_free( device ); status = STATUS_SUCCESS; @@ -1444,3 +1454,22 @@ NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
return status; } + +/****************************************************************************** + * D3DKMTSetVidPnSourceOwner [GDI32.@] + */ +NTSTATUS WINAPI D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) +{ + TRACE("(%p)\n", desc); + + if (!get_display_driver()->pD3DKMTSetVidPnSourceOwner) + return STATUS_PROCEDURE_NOT_FOUND; + + if (!desc || !desc->hDevice) + return STATUS_INVALID_PARAMETER; + + /* Store VidPN source ownership info in user driver because user driver needs to changes ownership sometimes. + * For example, when a new window is moved to a VidPN source with an exclusive owner, such exclusive owner will be + * released before showing the new window */ + return get_display_driver()->pD3DKMTSetVidPnSourceOwner( desc ); +} diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 960d1b295c..80e54685c7 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -950,6 +950,7 @@ static const struct gdi_dc_funcs emfpath_driver = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_PATH_DRV + 1 /* priority */ diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 1cd838ab8e..6938e45cbd 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -163,6 +163,7 @@ static const struct gdi_dc_funcs emfdrv_driver = EMFDRV_StrokePath, /* pStrokePath */ NULL, /* pUnrealizePalette */ EMFDRV_WidenPath, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 703dc3a997..b571611c13 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -9236,6 +9236,7 @@ static const struct gdi_dc_funcs freetype_funcs = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_FONT_DRV /* priority */ diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 9abd82173c..597002c9a8 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -88,6 +88,7 @@ @ stdcall D3DKMTEscape(ptr) @ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr) @ stdcall D3DKMTOpenAdapterFromHdc(ptr) +@ stdcall D3DKMTSetVidPnSourceOwner(ptr) @ stdcall DPtoLP(long ptr long) @ stdcall DeleteColorSpace(long) @ stdcall DeleteDC(long) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index 4ef509a89f..fb568f1838 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -226,6 +226,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = MFDRV_StrokePath, /* pStrokePath */ NULL, /* pUnrealizePalette */ MFDRV_WidenPath, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 8cf86ccb2e..23c0162f64 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -2248,6 +2248,7 @@ const struct gdi_dc_funcs path_driver = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_PATH_DRV /* priority */ diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 7a2945c80f..ec6c689b49 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -411,6 +411,7 @@ static const struct gdi_dc_funcs android_drv_funcs = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ ANDROID_wine_get_wgl_driver, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index 7156a3c3a8..32aeba04b4 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -390,6 +390,7 @@ static const struct gdi_dc_funcs macdrv_funcs = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ macdrv_wine_get_wgl_driver, /* wine_get_wgl_driver */ macdrv_wine_get_vulkan_driver, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c index 0dff6cc868..2183029058 100644 --- a/dlls/wineps.drv/init.c +++ b/dlls/wineps.drv/init.c @@ -908,6 +908,7 @@ static const struct gdi_dc_funcs psdrv_funcs = PSDRV_StrokePath, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 20710cc0c9..baed875ba5 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -471,6 +471,7 @@ static const struct gdi_dc_funcs x11drv_funcs = X11DRV_StrokePath, /* pStrokePath */ X11DRV_UnrealizePalette, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ X11DRV_wine_get_wgl_driver, /* wine_get_wgl_driver */ X11DRV_wine_get_vulkan_driver, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 61729ecf29..e8dbf27c0d 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2284,6 +2284,7 @@ static const struct gdi_dc_funcs xrender_funcs = NULL, /* pStrokePath */ NULL, /* pUnrealizePalette */ NULL, /* pWidenPath */ + NULL, /* pD3DKMTSetVidPnSourceOwner */ NULL, /* wine_get_wgl_driver */ NULL, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV + 10 /* priority */ diff --git a/include/ddk/d3dkmthk.h b/include/ddk/d3dkmthk.h index 081758bf5d..05e2e65aea 100644 --- a/include/ddk/d3dkmthk.h +++ b/include/ddk/d3dkmthk.h @@ -171,6 +171,7 @@ NTSTATUS WINAPI D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc); NTSTATUS WINAPI D3DKMTDestroyDCFromMemory(const D3DKMT_DESTROYDCFROMMEMORY *desc); NTSTATUS WINAPI D3DKMTDestroyDevice(const D3DKMT_DESTROYDEVICE *desc); NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc); +NTSTATUS WINAPI D3DKMTSetVidPnSourceOwner(const D3DKMT_SETVIDPNSOURCEOWNER *desc);
#ifdef __cplusplus } diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index d3e5bcefb4..fac25349d1 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -21,6 +21,8 @@ #ifndef __WINE_WINE_GDI_DRIVER_H #define __WINE_WINE_GDI_DRIVER_H
+#include "winternl.h" +#include "ddk/d3dkmthk.h" #include "wine/list.h"
struct gdi_dc_funcs; @@ -192,6 +194,7 @@ struct gdi_dc_funcs BOOL (*pStrokePath)(PHYSDEV); BOOL (*pUnrealizePalette)(HPALETTE); BOOL (*pWidenPath)(PHYSDEV); + NTSTATUS (*pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *); struct opengl_funcs * (*wine_get_wgl_driver)(PHYSDEV,UINT); const struct vulkan_funcs * (*wine_get_vulkan_driver)(PHYSDEV,UINT);
@@ -200,7 +203,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 49 +#define WINE_GDI_DRIVER_VERSION 50
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */