Mesa (staging/22.0): panfrost: Flush resources when shadowing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 21:11:15 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: b3f333348d51f3d0f1c0399f81b007f1935081ca
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3f333348d51f3d0f1c0399f81b007f1935081ca

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sat Oct 23 10:13:51 2021 -0400

panfrost: Flush resources when shadowing

When we shadow a resource, the backing BO is changed; as such,
existing references to the resource become invalid. So batches accessing the
resource need to be flushed (or otherwise have their references invalidated).

The wrong behaviour change (not flushing) was introduced when we started
tracking resources instead of BOs. The issue manifested as a severe performance
regression in glmark2's -bbuffer test, particular the subdata subtest. The issue
is magnified on slow CPUs; without the fix, the test becomes completely CPU
bound

Relevant glmark2 -bbuffer test from 43fps to 84fps.

Apparently, this causes functional issues too -- this performance-minded change
also fixes a few piglits.

Fixes: cecb889481d ("panfrost: Do tracking of resources, not BOs")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reported-by: Chris Healy <cphealy at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13502>
(cherry picked from commit 988d5aae74d61d1416b369172ef286b4aac933d0)

---

 .pick_status.json                           | 2 +-
 src/gallium/drivers/panfrost/pan_resource.c | 6 ++++++
 src/panfrost/ci/panfrost-g52-fails.txt      | 4 ----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 793fd846309..1335e314177 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -220,7 +220,7 @@
         "description": "panfrost: Flush resources when shadowing",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "cecb889481db23dc2b945dc3904f58f41a45fdfc"
     },
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 094332862ff..cd03a870222 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -955,6 +955,12 @@ panfrost_ptr_map(struct pipe_context *pctx,
                                 panfrost_bo_unreference(bo);
                                 rsrc->image.data.bo = newbo;
 
+                                /* Swapping out the BO will invalidate batches
+                                 * accessing this resource, flush them but do
+                                 * not wait for them.
+                                 */
+                                panfrost_flush_batches_accessing_rsrc(ctx, rsrc, "Resource shadowing");
+
 	                        if (!copy_resource &&
                                     drm_is_afbc(rsrc->image.layout.modifier))
                                         panfrost_resource_init_afbc_headers(rsrc);
diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt
index b228b93a5f5..4c2bf39f4f7 100644
--- a/src/panfrost/ci/panfrost-g52-fails.txt
+++ b/src/panfrost/ci/panfrost-g52-fails.txt
@@ -77,7 +77,6 @@ spec at arb_depth_texture@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT24
 spec at arb_depth_texture@texwrap formats bordercolor-swizzled at GL_DEPTH_COMPONENT32- swizzled- border color only,Fail
 spec at arb_direct_state_access@gettextureimage-formats,Fail
 spec at arb_direct_state_access@gettextureimage-formats init-by-rendering,Fail
-spec at arb_direct_state_access@texture-buffer,Fail
 spec at arb_draw_buffers@fbo-mrt-new-bind,Crash
 spec at arb_es2_compatibility@fbo-blending-formats,Fail
 spec at arb_es2_compatibility@fbo-blending-formats at GL_RGB565,Fail
@@ -123,7 +122,6 @@ spec at arb_sample_shading@samplemask 4 all at sample mask_in_one,Fail
 spec at arb_sample_shading@samplemask 4,Fail
 spec at arb_sample_shading@samplemask 4 at noms mask_in_one,Fail
 spec at arb_sample_shading@samplemask 4 at sample mask_in_one,Fail
-spec at arb_shader_atomic_counters@respecify-buffer,Fail
 spec at arb_shader_draw_parameters@drawid-indirect-baseinstance,Fail
 spec at arb_shader_draw_parameters@drawid-indirect-basevertex,Fail
 spec at arb_shader_draw_parameters@drawid-indirect,Fail
@@ -135,11 +133,9 @@ spec at arb_shader_texture_lod@execution at tex-miplevel-selection *projgradarb 2drect
 spec at arb_shader_texture_lod@execution at tex-miplevel-selection *projgradarb 2drect_projvec4,Crash
 spec at arb_shader_texture_lod@execution at tex-miplevel-selection *projgradarb 2drectshadow,Crash
 spec at arb_shading_language_420pack@active sampler conflict,Crash
-spec at arb_texture_buffer_object@data-sync,Fail
 spec at arb_texture_buffer_object@formats (fs- arb),Crash
 spec at arb_texture_buffer_object@formats (vs- arb),Crash
 spec at arb_texture_buffer_object@render-no-bo,Crash
-spec at arb_texture_buffer_object@subdata-sync,Fail
 spec at arb_texture_compression@texwrap formats bordercolor,Fail
 spec at arb_texture_compression@texwrap formats bordercolor at GL_COMPRESSED_ALPHA- border color only,Fail
 spec at arb_texture_compression@texwrap formats bordercolor at GL_COMPRESSED_LUMINANCE_ALPHA- border color only,Fail



More information about the mesa-commit mailing list