[Mesa-dev] [PATCH 50/84] st/nine: Use nine_context for resource_copy_region

Axel Davy axel.davy at ens.fr
Wed Dec 7 22:55:23 UTC 2016


From: Patrick Rudolph <siro at das-labor.org>

Use nine_context wrapper for resource_copy_region.
Enables to offload it with CSMT.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
 src/gallium/state_trackers/nine/device9.c    |  6 ++----
 src/gallium/state_trackers/nine/nine_state.c | 17 +++++++++++++++++
 src/gallium/state_trackers/nine/nine_state.h |  9 +++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 20ab5df..06d6608 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1549,7 +1549,6 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
                          D3DTEXTUREFILTERTYPE Filter )
 {
     struct pipe_screen *screen = This->screen;
-    struct pipe_context *pipe;
     struct NineSurface9 *dst = NineSurface9(pDestSurface);
     struct NineSurface9 *src = NineSurface9(pSourceSurface);
     struct pipe_resource *dst_res = NineSurface9_GetResource(dst);
@@ -1732,10 +1731,9 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
                blit.src.box.y + blit.src.box.height <= src->desc.Height);
         /* Or drivers might crash ... */
         DBG("Using resource_copy_region.\n");
-        pipe = NineDevice9_GetPipe(This);
-        pipe->resource_copy_region(pipe,
+        nine_context_resource_copy_region(This,
             blit.dst.resource, blit.dst.level,
-            blit.dst.box.x, blit.dst.box.y, blit.dst.box.z,
+            &blit.dst.box,
             blit.src.resource, blit.src.level,
             &blit.src.box);
     }
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 017ad67..ca47033 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -2587,6 +2587,23 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf,
     pipe_resource_reference(&ibuf->buffer, NULL);
 }
 
+CSMT_ITEM_NO_WAIT(nine_context_resource_copy_region,
+                  ARG_BIND_RES(struct pipe_resource, dst_res),
+                  ARG_VAL(unsigned, dst_level),
+                  ARG_COPY_REF(struct pipe_box, dst_box),
+                  ARG_BIND_RES(struct pipe_resource, src_res),
+                  ARG_VAL(unsigned, src_level),
+                  ARG_COPY_REF(struct pipe_box, src_box))
+{
+    struct nine_context *context = &device->context;
+
+    context->pipe->resource_copy_region(context->pipe,
+            dst_res, dst_level,
+            dst_box->x, dst_box->y, dst_box->z,
+            src_res, src_level,
+            src_box);
+}
+
 CSMT_ITEM_NO_WAIT(nine_context_blit,
                   ARG_BIND_BLIT(struct pipe_blit_info, blit))
 {
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 62b2c13..82ebcc9 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -518,6 +518,15 @@ nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(struct NineDevice9 *devic
                                                        struct pipe_index_buffer *ibuf);
 
 void
+nine_context_resource_copy_region(struct NineDevice9 *device,
+                                  struct pipe_resource* dst_res,
+                                  unsigned dst_level,
+                                  const struct pipe_box *dst_box,
+                                  struct pipe_resource* src_res,
+                                  unsigned src_level,
+                                  const struct pipe_box *src_box);
+
+void
 nine_context_blit(struct NineDevice9 *device,
                   struct pipe_blit_info *blit);
 
-- 
2.10.2



More information about the mesa-dev mailing list