Mesa (main): panfrost: Split out image access tracking

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 15:24:28 UTC 2022


Module: Mesa
Branch: main
Commit: 0510e2373eab05b19b44da8116da3def771e791f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0510e2373eab05b19b44da8116da3def771e791f

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Apr  7 10:41:45 2022 -0400

panfrost: Split out image access tracking

This logic is not device-specific. It is pulled from our existing Bifrost image
implementation and will be reused for Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15795>

---

 src/gallium/drivers/panfrost/pan_context.h |  5 +++++
 src/gallium/drivers/panfrost/pan_helpers.c | 24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index db3d8bff117..b9e3a7b1476 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -424,4 +424,9 @@ panfrost_set_batch_masks_blend(struct panfrost_batch *batch);
 void
 panfrost_set_batch_masks_zs(struct panfrost_batch *batch);
 
+void
+panfrost_track_image_access(struct panfrost_batch *batch,
+                            enum pipe_shader_type stage,
+                            struct pipe_image_view *image);
+
 #endif
diff --git a/src/gallium/drivers/panfrost/pan_helpers.c b/src/gallium/drivers/panfrost/pan_helpers.c
index 90fc64058eb..b492e0fe76c 100644
--- a/src/gallium/drivers/panfrost/pan_helpers.c
+++ b/src/gallium/drivers/panfrost/pan_helpers.c
@@ -219,3 +219,27 @@ panfrost_set_batch_masks_zs(struct panfrost_batch *batch)
                 batch->read |= PIPE_CLEAR_STENCIL;
         }
 }
+
+void
+panfrost_track_image_access(struct panfrost_batch *batch,
+                            enum pipe_shader_type stage,
+                            struct pipe_image_view *image)
+{
+        struct panfrost_resource *rsrc = pan_resource(image->resource);
+
+        if (image->shader_access & PIPE_IMAGE_ACCESS_WRITE) {
+                panfrost_batch_write_rsrc(batch, rsrc, stage);
+
+                bool is_buffer = rsrc->base.target == PIPE_BUFFER;
+                unsigned level = is_buffer ? 0 : image->u.tex.level;
+                BITSET_SET(rsrc->valid.data, level);
+
+                if (is_buffer) {
+                        util_range_add(&rsrc->base, &rsrc->valid_buffer_range,
+                                        0, rsrc->base.width0);
+                }
+        } else {
+                panfrost_batch_read_rsrc(batch, rsrc, stage);
+        }
+}
+



More information about the mesa-commit mailing list