From 988d5aae74d61d1416b369172ef286b4aac933d0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 23 Oct 2021 10:13:51 -0400 Subject: [PATCH] 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 Reported-by: Chris Healy Part-of: --- src/gallium/drivers/panfrost/pan_resource.c | 6 ++++++ src/panfrost/ci/panfrost-g52-fails.txt | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 477bf1d..8ea749e 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -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); diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt index f2d37a2..4ab6e28 100644 --- a/src/panfrost/ci/panfrost-g52-fails.txt +++ b/src/panfrost/ci/panfrost-g52-fails.txt @@ -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 -- 2.7.4