panfrost: Update sampler views when the texture bo changes
authorIcecream95 <ixn@keemail.me>
Sat, 20 Jun 2020 07:09:03 +0000 (19:09 +1200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Jun 2020 12:15:05 +0000 (12:15 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5573>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 0ea5bc0e16a4998f3d6d82ba2eaaf28ffeed4b26..841e89d75a08ccba4a4303bc0c55f05f65653db9 100644 (file)
@@ -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);
         }
index fbbe63859723693b7f4935ff86869d802acae71e..2ec636e1579c47d0474ee48ac5081efc03fb7f8b 100644 (file)
@@ -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] = {
index 9a69b0eb5495bb1660ead39fbf45618e1a2d52be..f54e163148333e131446f3310f5197036c389760 100644 (file)
@@ -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;
 };