Module: Mesa
Branch: master
Commit: 4f07a24e41aead48885d8ee6083bd0168f5f347d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f07a24e41aead48885d8ee6083bd0168f5f347d

Author: Rob Clark <[email protected]>
Date:   Thu Feb 18 09:18:19 2021 -0800

freedreno: Extend threaded_transfer

Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9323>

---

 src/gallium/drivers/freedreno/freedreno_resource.c | 25 ++++++++++++----------
 src/gallium/drivers/freedreno/freedreno_resource.h |  2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c 
b/src/gallium/drivers/freedreno/freedreno_resource.c
index b324a1d7493..09587943ebf 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -494,13 +494,13 @@ static void
 fd_blit_from_staging(struct fd_context *ctx, struct fd_transfer *trans)
        assert_dt
 {
-       struct pipe_resource *dst = trans->base.resource;
+       struct pipe_resource *dst = trans->b.b.resource;
        struct pipe_blit_info blit = {};
 
        blit.dst.resource = dst;
        blit.dst.format   = dst->format;
-       blit.dst.level    = trans->base.level;
-       blit.dst.box      = trans->base.box;
+       blit.dst.level    = trans->b.b.level;
+       blit.dst.box      = trans->b.b.box;
        blit.src.resource = trans->staging_prsc;
        blit.src.format   = trans->staging_prsc->format;
        blit.src.level    = 0;
@@ -515,13 +515,13 @@ static void
 fd_blit_to_staging(struct fd_context *ctx, struct fd_transfer *trans)
        assert_dt
 {
-       struct pipe_resource *src = trans->base.resource;
+       struct pipe_resource *src = trans->b.b.resource;
        struct pipe_blit_info blit = {};
 
        blit.src.resource = src;
        blit.src.format   = src->format;
-       blit.src.level    = trans->base.level;
-       blit.src.box      = trans->base.box;
+       blit.src.level    = trans->b.b.level;
+       blit.src.box      = trans->b.b.box;
        blit.dst.resource = trans->staging_prsc;
        blit.dst.format   = trans->staging_prsc->format;
        blit.dst.level    = 0;
@@ -616,6 +616,9 @@ fd_resource_transfer_unmap(struct pipe_context *pctx,
                                   ptrans->box.x + ptrans->box.width);
 
        pipe_resource_reference(&ptrans->resource, NULL);
+
+       assert(trans->b.staging == NULL); /* for threaded context only */
+
        slab_free(&ctx->transfer_pool, ptrans);
 }
 
@@ -662,7 +665,7 @@ resource_transfer_map_unsync(struct pipe_context *pctx,
 
        buf = fd_bo_map(rsc->bo);
        offset =
-               box->y / util_format_get_blockheight(format) * 
trans->base.stride +
+               box->y / util_format_get_blockheight(format) * 
trans->b.b.stride +
                box->x / util_format_get_blockwidth(format) * rsc->layout.cpp +
                fd_resource_offset(rsc, level, box->z);
 
@@ -704,8 +707,8 @@ resource_transfer_map(struct pipe_context *pctx,
                staging_rsc = fd_alloc_staging(ctx, rsc, level, box);
                if (staging_rsc) {
                        trans->staging_prsc = &staging_rsc->b.b;
-                       trans->base.stride = fd_resource_pitch(staging_rsc, 0);
-                       trans->base.layer_stride = 
fd_resource_layer_stride(staging_rsc, 0);
+                       trans->b.b.stride = fd_resource_pitch(staging_rsc, 0);
+                       trans->b.b.layer_stride = 
fd_resource_layer_stride(staging_rsc, 0);
                        trans->staging_box = *box;
                        trans->staging_box.x = 0;
                        trans->staging_box.y = 0;
@@ -792,8 +795,8 @@ resource_transfer_map(struct pipe_context *pctx,
                                staging_rsc = fd_alloc_staging(ctx, rsc, level, 
box);
                                if (staging_rsc) {
                                        trans->staging_prsc = &staging_rsc->b.b;
-                                       trans->base.stride = 
fd_resource_pitch(staging_rsc, 0);
-                                       trans->base.layer_stride =
+                                       trans->b.b.stride = 
fd_resource_pitch(staging_rsc, 0);
+                                       trans->b.b.layer_stride =
                                                
fd_resource_layer_stride(staging_rsc, 0);
                                        trans->staging_box = *box;
                                        trans->staging_box.x = 0;
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h 
b/src/gallium/drivers/freedreno/freedreno_resource.h
index d8ebde5e76d..1e242044afd 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.h
+++ b/src/gallium/drivers/freedreno/freedreno_resource.h
@@ -248,7 +248,7 @@ has_depth(enum pipe_format format)
 }
 
 struct fd_transfer {
-       struct pipe_transfer base;
+       struct threaded_transfer b;
        struct pipe_resource *staging_prsc;
        struct pipe_box staging_box;
 };

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to