[Mesa-stable] [PATCH v3 01/19] st/nine: clean device9ex.

David Heidelberg david at ixit.cz
Mon Nov 24 15:38:01 PST 2014


From: Axel Davy <axel.davy at ens.fr>

Pass ex specific parameters as arguments to device9 ctor instead
of passing them by filling the structure.

Cc: "10.4" <mesa-stable at lists.freedesktop.org>
Reviewed-by: David Heidelberg <david at ixit.cz>
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/adapter9.c  |  2 +-
 src/gallium/state_trackers/nine/device9.c   | 19 +++++++++++--------
 src/gallium/state_trackers/nine/device9.h   |  7 +++++--
 src/gallium/state_trackers/nine/device9ex.c |  6 ++----
 4 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
index 8d574de..e409d5f 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -990,7 +990,7 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This,
     params.BehaviorFlags = BehaviorFlags;
 
     hr = NineDevice9_new(screen, &params, &caps, pPresentationParameters,
-                         pD3D9, pPresentationGroup, This->ctx,
+                         pD3D9, pPresentationGroup, This->ctx, FALSE, NULL,
                          (struct NineDevice9 **)ppReturnedDeviceInterface);
     if (FAILED(hr)) {
         DBG("Failed to create device.\n");
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 7d2142d..5f95b42 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -139,7 +139,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
                   D3DPRESENT_PARAMETERS *pPresentationParameters,
                   IDirect3D9 *pD3D9,
                   ID3DPresentGroup *pPresentationGroup,
-                  struct d3dadapter9_context *pCTX )
+                  struct d3dadapter9_context *pCTX,
+                  boolean ex,
+                  D3DDISPLAYMODEEX *pFullscreenDisplayMode )
 {
     unsigned i;
     HRESULT hr = NineUnknown_ctor(&This->base, pParams);
@@ -151,6 +153,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
     This->caps = *pCaps;
     This->d3d9 = pD3D9;
     This->params = *pCreationParameters;
+    This->ex = ex;
     This->present = pPresentationGroup;
     IDirect3D9_AddRef(This->d3d9);
     ID3DPresentGroup_AddRef(This->present);
@@ -177,12 +180,12 @@ NineDevice9_ctor( struct NineDevice9 *This,
         if (FAILED(hr))
             return hr;
 
-        if (This->ex) {
+        if (ex) {
             D3DDISPLAYMODEEX *mode = NULL;
             struct NineSwapChain9Ex **ret =
                 (struct NineSwapChain9Ex **)&This->swapchains[i];
 
-            if (This->pFullscreenDisplayMode) mode = &(This->pFullscreenDisplayMode[i]);
+            if (pFullscreenDisplayMode) mode = &(pFullscreenDisplayMode[i]);
             /* when this is a Device9Ex, it should create SwapChain9Exs */
             hr = NineSwapChain9Ex_new(This, TRUE, present,
                                       &pPresentationParameters[i], pCTX,
@@ -310,9 +313,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
     This->update = &This->state;
     nine_update_state(This, ~0);
 
-    /* Is just used to pass the parameter from NineDevice9Ex_ctor */
-    This->pFullscreenDisplayMode = NULL;
-
     ID3DPresentGroup_Release(This->present);
 
     return D3D_OK;
@@ -974,7 +974,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
     } else {
         resource = NULL;
     }
-    hr = NineSurface9_new(This, NULL, resource, 0, 0, 0, &desc, &surface);
+    hr = NineSurface9_new(This, NULL, resource, NULL, 0, 0, 0, &desc, &surface);
     pipe_resource_reference(&resource, NULL);
 
     if (SUCCEEDED(hr))
@@ -3447,6 +3447,8 @@ NineDevice9_new( struct pipe_screen *pScreen,
                  IDirect3D9 *pD3D9,
                  ID3DPresentGroup *pPresentationGroup,
                  struct d3dadapter9_context *pCTX,
+                 boolean ex,
+                 D3DDISPLAYMODEEX *pFullscreenDisplayMode,
                  struct NineDevice9 **ppOut )
 {
     BOOL lock;
@@ -3454,5 +3456,6 @@ NineDevice9_new( struct pipe_screen *pScreen,
 
     NINE_NEW(Device9, ppOut, lock, /* args */
              pScreen, pCreationParameters, pCaps,
-             pPresentationParameters, pD3D9, pPresentationGroup, pCTX);
+             pPresentationParameters, pD3D9, pPresentationGroup, pCTX,
+             ex, pFullscreenDisplayMode);
 }
diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h
index 9dc248e..3649e1b 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -48,7 +48,6 @@ struct NineDevice9
 {
     struct NineUnknown base;
     boolean ex;
-    D3DDISPLAYMODEEX *pFullscreenDisplayMode;
 
     /* G3D context */
     struct pipe_screen *screen;
@@ -134,6 +133,8 @@ NineDevice9_new( struct pipe_screen *pScreen,
                  IDirect3D9 *pD3D9,
                  ID3DPresentGroup *pPresentationGroup,
                  struct d3dadapter9_context *pCTX,
+                 boolean ex,
+                 D3DDISPLAYMODEEX *pFullscreenDisplayMode,
                  struct NineDevice9 **ppOut );
 
 HRESULT
@@ -145,7 +146,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
                   D3DPRESENT_PARAMETERS *pPresentationParameters,
                   IDirect3D9 *pD3D9,
                   ID3DPresentGroup *pPresentationGroup,
-                  struct d3dadapter9_context *pCTX );
+                  struct d3dadapter9_context *pCTX,
+                  boolean ex,
+                  D3DDISPLAYMODEEX *pFullscreenDisplayMode );
 
 void
 NineDevice9_dtor( struct NineDevice9 *This );
diff --git a/src/gallium/state_trackers/nine/device9ex.c b/src/gallium/state_trackers/nine/device9ex.c
index 00d460b..d36189d 100644
--- a/src/gallium/state_trackers/nine/device9ex.c
+++ b/src/gallium/state_trackers/nine/device9ex.c
@@ -39,13 +39,11 @@ NineDevice9Ex_ctor( struct NineDevice9Ex *This,
                     ID3DPresentGroup *pPresentationGroup,
                     struct d3dadapter9_context *pCTX )
 {
-    This->base.ex = TRUE;
-    This->base.pFullscreenDisplayMode = pFullscreenDisplayMode;
-
     return NineDevice9_ctor(&This->base, pParams,
                             pScreen, pCreationParameters, pCaps,
                             pPresentationParameters,
-                            (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX);
+                            (IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX,
+                            TRUE, pFullscreenDisplayMode);
 }
 
 static void
-- 
2.1.3



More information about the mesa-stable mailing list