[Mesa-dev] [PATCH 1/2] st/nine: introduce SetVersion() for present interface v1.4

Andre Heider a.heider at gmail.com
Thu Apr 4 10:34:29 UTC 2019


A follow up patch requires a behaviour change, so we need to negotiate
the present version to be used to keep backward compatiblity.

We already get the supported version from the WINE side via GetVersion().
Introduce the member SetVersion() to pass back the maximum common
version.

Signed-off-by: Andre Heider <a.heider at gmail.com>
---

Corresponding d3d9-nine.dll patch:
https://github.com/iXit/wine-nine-standalone/commit/c7d3b86ee3dc40f897508cd13a3862c277cbe08c

 include/d3dadapter/present.h               |  3 +++
 src/gallium/state_trackers/nine/adapter9.c | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/d3dadapter/present.h b/include/d3dadapter/present.h
index 0325ebc511f..2f784837cfb 100644
--- a/include/d3dadapter/present.h
+++ b/include/d3dadapter/present.h
@@ -151,6 +151,8 @@ typedef struct ID3DPresentGroupVtbl
     /* used to create additional presentation interfaces along the way */
     HRESULT (WINAPI *CreateAdditionalPresent)(ID3DPresentGroup *This, D3DPRESENT_PARAMETERS *pPresentationParameters, ID3DPresent **ppPresent);
     void (WINAPI *GetVersion) (ID3DPresentGroup *This, int *major, int *minor);
+    /* Available since version 1.4 */
+    void (WINAPI *SetVersion) (ID3DPresentGroup *This, int major, int minor);
 } ID3DPresentGroupVtbl;
 
 struct ID3DPresentGroup
@@ -167,6 +169,7 @@ struct ID3DPresentGroup
 #define ID3DPresentGroup_GetPresent(p,a,b) (p)->lpVtbl->GetPresent(p,a,b)
 #define ID3DPresentGroup_CreateAdditionalPresent(p,a,b) (p)->lpVtbl->CreateAdditionalPresent(p,a,b)
 #define ID3DPresentGroup_GetVersion(p,a,b) (p)->lpVtbl->GetVersion(p,a,b)
+#define ID3DPresentGroup_SetVersion(p,a,b) (p)->lpVtbl->SetVersion(p,a,b)
 
 #endif /* __cplusplus */
 
diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
index 3aa95b93b2f..4f648e894b8 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -34,6 +34,9 @@
 
 #define DBG_CHANNEL DBG_ADAPTER
 
+/* The maximum supported present version */
+#define MAX_PRESENT_VERSION_MINOR 4
+
 HRESULT
 NineAdapter9_ctor( struct NineAdapter9 *This,
                    struct NineUnknownParams *pParams,
@@ -999,6 +1002,14 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This,
         return D3DERR_NOTAVAILABLE;
     }
 
+    if (minor >= 4) {
+        /* d3d9-nine.dll might support a higher present version than we do.
+         * Limit it to our supported version to keep expected behaviour.
+         */
+        minor = MIN2(minor, MAX_PRESENT_VERSION_MINOR);
+        ID3DPresentGroup_SetVersion(pPresentationGroup, major, minor);
+    }
+
     hr = NineAdapter9_GetScreen(This, DeviceType, &screen);
     if (FAILED(hr)) {
         DBG("Failed to get pipe_screen.\n");
-- 
2.20.1



More information about the mesa-dev mailing list