[Spice-devel] [PATCH v3 4/5] Get D3DKMTOpenAdapterFromDeviceName and D3DKMTOpenAdapterFromDeviceName independently

Frediano Ziglio fziglio at redhat.com
Thu Sep 1 14:54:08 UTC 2016


There's no reason why we can't use one if the other is not present

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 vdagent/display_configuration.cpp | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index 6e7624b..c708df1 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -521,6 +521,7 @@ bool WDDMInterface::init_d3d_api()
         return false;
     }
 
+    bool result = false;
     do {
         _pfnClose_adapter = (PFND3DKMT_CLOSEADAPTER)
             GetProcAddress(hModule, "D3DKMTCloseAdapter");
@@ -539,26 +540,18 @@ bool WDDMInterface::init_d3d_api()
             break;
         }
 
+        // we found all needed function, following are optionals
+        result = true;
+
         _pfnOpen_adapter_device_name = (PFND3DKMT_OPENADAPTERFROMDEVICENAME)
             GetProcAddress(hModule, "D3DKMTOpenAdapterFromDeviceName");
-        if (!_pfnOpen_adapter_device_name) {
-            break;
-        }
 
         _pfnOpen_adapter_gdi_name = (PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME)
             GetProcAddress(hModule, "D3DKMTOpenAdapterFromGdiDisplayName");
-        if (!_pfnOpen_adapter_gdi_name) {
-            break;
-        }
-
     }
     while(0);
 
-    //Did we get them ?
-    if (!_pfnClose_adapter || !_pfnOpen_adapter_hdc || !_pfnEscape)  {
-        return false;
-    }
-    return true;
+    return result;
 }
 
 D3D_HANDLE WDDMInterface::adapter_handle(LPCTSTR device_name)
-- 
2.7.4



More information about the Spice-devel mailing list