Zhiyi Zhang : winex11.drv: Implement X11DRV_D3DKMTCheckVidPnExclusiveOwnership.

Alexandre Julliard julliard at winehq.org
Tue Oct 22 16:57:01 CDT 2019


Module: wine
Branch: master
Commit: 644d00d540f059e526c34fbeab867fd6078eebec
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=644d00d540f059e526c34fbeab867fd6078eebec

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Oct 22 16:39:16 2019 +0800

winex11.drv: Implement X11DRV_D3DKMTCheckVidPnExclusiveOwnership.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/tests/dxgi.c         | 10 +++++++---
 dlls/gdi32/tests/driver.c      |  2 +-
 dlls/winex11.drv/init.c        |  2 +-
 dlls/winex11.drv/x11drv.h      |  1 +
 dlls/winex11.drv/x11drv_main.c | 25 +++++++++++++++++++++++++
 5 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 7a1baa828f..a7517c8b0a 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -737,7 +737,6 @@ static IDXGIAdapter *get_adapter_(unsigned int line, IUnknown *device, BOOL is_d
         hr = IDXGIFactory_QueryInterface(factory, &IID_IDXGIFactory4, (void **)&factory4);
         ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         hr = IDXGIFactory4_EnumAdapterByLuid(factory4, luid, &IID_IDXGIAdapter, (void **)&adapter);
-        ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         IDXGIFactory4_Release(factory4);
         IDXGIFactory_Release(factory);
     }
@@ -5512,13 +5511,18 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12)
     if (!pD3DKMTCheckVidPnExclusiveOwnership
             || pD3DKMTCheckVidPnExclusiveOwnership(NULL) == STATUS_PROCEDURE_NOT_FOUND)
     {
-        skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n");
+        win_skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n");
         return;
     }
 
     get_factory(device, is_d3d12, &factory);
     adapter = get_adapter(device, is_d3d12);
-    ok(!!adapter, "Failed to get adapter.\n");
+    if (!adapter)
+    {
+        skip("Failed to get adapter on Direct3D %d.\n", is_d3d12 ? 12 : 10);
+        IDXGIFactory_Release(factory);
+        return;
+    }
 
     hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
     IDXGIAdapter_Release(adapter);
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c
index 2ea43e3025..ed83a72813 100644
--- a/dlls/gdi32/tests/driver.c
+++ b/dlls/gdi32/tests/driver.c
@@ -376,7 +376,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
 
     if (!pD3DKMTCheckVidPnExclusiveOwnership || pD3DKMTCheckVidPnExclusiveOwnership(NULL) == STATUS_PROCEDURE_NOT_FOUND)
     {
-        skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n");
+        win_skip("D3DKMTCheckVidPnExclusiveOwnership() is unavailable.\n");
         return;
     }
 
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index a833b3c208..d070c0f117 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -471,7 +471,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     X11DRV_StrokePath,                  /* pStrokePath */
     X11DRV_UnrealizePalette,            /* pUnrealizePalette */
     NULL,                               /* pWidenPath */
-    NULL,                               /* pD3DKMTCheckVidPnExclusiveOwnership */
+    X11DRV_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */
     X11DRV_D3DKMTSetVidPnSourceOwner,   /* pD3DKMTSetVidPnSourceOwner */
     X11DRV_wine_get_wgl_driver,         /* wine_get_wgl_driver */
     X11DRV_wine_get_vulkan_driver,      /* wine_get_vulkan_driver */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 8930690f45..e5e9dfc9f7 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -149,6 +149,7 @@ extern BOOL CDECL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
                               INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
 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_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 INT CDECL X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index ac5ba66324..4f611f5faa 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -877,3 +877,28 @@ done:
     LeaveCriticalSection( &x11drv_section );
     return status;
 }
+
+/**********************************************************************
+ *           X11DRV_D3DKMTCheckVidPnExclusiveOwnership
+ */
+NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc )
+{
+    struct d3dkmt_vidpn_source *source;
+
+    TRACE("(%p)\n", desc);
+
+    if (!desc || !desc->hAdapter)
+        return STATUS_INVALID_PARAMETER;
+
+    EnterCriticalSection( &x11drv_section );
+    LIST_FOR_EACH_ENTRY( source, &d3dkmt_vidpn_sources, struct d3dkmt_vidpn_source, entry )
+    {
+        if (source->id == desc->VidPnSourceId && source->type == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE)
+        {
+            LeaveCriticalSection( &x11drv_section );
+            return STATUS_GRAPHICS_PRESENT_OCCLUDED;
+        }
+    }
+    LeaveCriticalSection( &x11drv_section );
+    return STATUS_SUCCESS;
+}




More information about the wine-cvs mailing list