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: cecb889481 ("panfrost: Do tracking of resources, not BOs")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Chris Healy <cphealy@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13502>
This commit is contained in:
Alyssa Rosenzweig 2021-10-23 10:13:51 -04:00 committed by Marge Bot
parent 5536852d60
commit 988d5aae74
2 changed files with 6 additions and 4 deletions

View File

@ -950,6 +950,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);

View File

@ -78,7 +78,6 @@ spec@arb_depth_texture@texwrap formats bordercolor-swizzled@GL_DEPTH_COMPONENT24
spec@arb_depth_texture@texwrap formats bordercolor-swizzled@GL_DEPTH_COMPONENT32- swizzled- border color only,Fail
spec@arb_direct_state_access@gettextureimage-formats,Fail
spec@arb_direct_state_access@gettextureimage-formats init-by-rendering,Fail
spec@arb_direct_state_access@texture-buffer,Fail
spec@arb_draw_buffers@fbo-mrt-new-bind,Crash
spec@arb_es2_compatibility@fbo-blending-formats,Fail
spec@arb_es2_compatibility@fbo-blending-formats@GL_RGB565,Fail
@ -124,7 +123,6 @@ spec@arb_sample_shading@samplemask 4 all@sample mask_in_one,Fail
spec@arb_sample_shading@samplemask 4,Fail
spec@arb_sample_shading@samplemask 4@noms mask_in_one,Fail
spec@arb_sample_shading@samplemask 4@sample mask_in_one,Fail
spec@arb_shader_atomic_counters@respecify-buffer,Fail
spec@arb_shader_draw_parameters@drawid-indirect-baseinstance,Fail
spec@arb_shader_draw_parameters@drawid-indirect-basevertex,Fail
spec@arb_shader_draw_parameters@drawid-indirect,Fail
@ -136,11 +134,9 @@ spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drect
spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drect_projvec4,Crash
spec@arb_shader_texture_lod@execution@tex-miplevel-selection *projgradarb 2drectshadow,Crash
spec@arb_shading_language_420pack@active sampler conflict,Crash
spec@arb_texture_buffer_object@data-sync,Fail
spec@arb_texture_buffer_object@formats (fs- arb),Crash
spec@arb_texture_buffer_object@formats (vs- arb),Crash
spec@arb_texture_buffer_object@render-no-bo,Crash
spec@arb_texture_buffer_object@subdata-sync,Fail
spec@arb_texture_compression@texwrap formats bordercolor,Fail
spec@arb_texture_compression@texwrap formats bordercolor@GL_COMPRESSED_ALPHA- border color only,Fail
spec@arb_texture_compression@texwrap formats bordercolor@GL_COMPRESSED_LUMINANCE_ALPHA- border color only,Fail