Mesa (master): panfrost: Update sampler views when the texture bo changes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 22 12:28:54 UTC 2020


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

Author: Icecream95 <ixn at keemail.me>
Date:   Sat Jun 20 19:09:03 2020 +1200

panfrost: Update sampler views when the texture bo changes

The BO reallocation path in panfrost_transfer_map caused textures and
sampler views to get out of sync.

v2: Use the GPU address of the BO in case two BOs get allocated at the
    same address.

Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5573>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 3 ++-
 src/gallium/drivers/panfrost/pan_context.c   | 1 +
 src/gallium/drivers/panfrost/pan_context.h   | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 0ea5bc0e16a..841e89d75a0 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1400,7 +1400,8 @@ panfrost_update_sampler_view(struct panfrost_sampler_view *view,
                              struct pipe_context *pctx)
 {
         struct panfrost_resource *rsrc = pan_resource(view->base.texture);
-        if (view->layout != rsrc->layout) {
+        if (view->texture_bo != rsrc->bo->gpu ||
+            view->layout != rsrc->layout) {
                 panfrost_bo_unreference(view->bo);
                 panfrost_create_sampler_view_bo(view, pctx, &rsrc->base);
         }
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index fbbe6385972..2ec636e1579 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -918,6 +918,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
         struct panfrost_resource *prsrc = (struct panfrost_resource *)texture;
         assert(prsrc->bo);
 
+        so->texture_bo = prsrc->bo->gpu;
         so->layout = prsrc->layout;
 
         unsigned char user_swizzle[4] = {
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 9a69b0eb549..f54e1631483 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -265,6 +265,7 @@ struct panfrost_sampler_view {
         struct pipe_sampler_view base;
         struct panfrost_bo *bo;
         struct bifrost_texture_descriptor *bifrost_descriptor;
+        mali_ptr texture_bo;
         enum mali_texture_layout layout;
 };
 



More information about the mesa-commit mailing list