From 92afe94d28b8e6cb016fdbb59e415ec7257f5512 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Mar 2020 14:55:50 -0700 Subject: [PATCH] freedreno: Work around UBWC flakiness. In trying to track down the new failure in #2670, I found that I could get the flaky test set down to 4 tests, and dropping any remaining test wouldn't trigger the failure (a bad 8x4 block in the middle of dEQP-GLES3.functional.fbo.msaa.4_samples.r16f's render target). Disabling gmem or bypass didn't help, and adding lots of CCU flushing didn't help. What did help was disabling blitting, or this memset to initialize the UBWC area after we (presumably) pull a BO out of the BO cache. My guess is that the 2D blitter can't handle some rare set of state in the flags buffer and emits some garbage. I've run 8 gles3 and 7 gles31 runs with this branch now so hopefully I've got the4 right set of flakes marked for removal. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2670 Tested-by: Marge Bot Part-of: --- .gitlab-ci/deqp-freedreno-a630-skips.txt | 29 ------------------- .../drivers/freedreno/freedreno_resource.c | 13 +++++++++ 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci/deqp-freedreno-a630-skips.txt b/.gitlab-ci/deqp-freedreno-a630-skips.txt index 121ded9b927..9f031407e5e 100644 --- a/.gitlab-ci/deqp-freedreno-a630-skips.txt +++ b/.gitlab-ci/deqp-freedreno-a630-skips.txt @@ -22,32 +22,6 @@ dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.48 # Flakes reported more than once during Jan-Feb 2020 dEQP-GLES31.functional.layout_binding.ssbo.fragment_binding_array -dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_2d -dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_2d -dEQP-GLES31.functional.stencil_texturing.misc.compare_mode_effect -dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_npot -dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_pot -dEQP-GLES31.functional.texture.border_clamp.sampler.uint_stencil -dEQP-GLES31.functional.texture.specification.texstorage3d.format.r16f_cube_array -dEQP-GLES31.functional.texture.specification.texsubimage3d_pbo.r16ui_cube_array -dEQP-GLES3.functional.buffer.write.recreate_store.random_1 -dEQP-GLES3.functional.draw.draw_elements.line_loop.instanced_attributes -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_r11f_g11f_b10f -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_r16f -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_r32f -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_r8 -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_rgb5_a1 -dEQP-GLES3.functional.fbo.blit.conversion.r16f_to_srgb8_alpha8 -dEQP-GLES3.functional.fbo.blit.conversion.r16i_to_rg16i -dEQP-GLES3.functional.fbo.blit.conversion.r16ui_to_r8ui -dEQP-GLES3.functional.fbo.blit.conversion.r32f_to_r16f -dEQP-GLES3.functional.fbo.blit.conversion.r8_to_r16f -dEQP-GLES3.functional.fbo.blit.conversion.rgb5_a1_to_r16f -dEQP-GLES3.functional.fbo.blit.conversion.rgba32f_to_r16f -dEQP-GLES3.functional.fbo.blit.conversion.rgba32i_to_r16i -dEQP-GLES3.functional.fbo.blit.conversion.rgba32ui_to_r16ui -dEQP-GLES3.functional.fbo.msaa.2_samples.stencil_index8 -dEQP-GLES3.functional.fbo.msaa.4_samples.r16f dEQP-GLES3.functional.fragment_out.random.0 dEQP-GLES3.functional.fragment_out.random.1 dEQP-GLES3.functional.fragment_out.random.12 @@ -84,9 +58,6 @@ dEQP-GLES3.functional.fragment_out.random.91 dEQP-GLES3.functional.fragment_out.random.93 dEQP-GLES3.functional.fragment_out.random.95 dEQP-GLES3.functional.fragment_out.random.96 -dEQP-GLES3.functional.texture.format.sized.2d_array.r16ui_npot -dEQP-GLES3.functional.texture.specification.basic_teximage3d.r16f_2d_array -dEQP-GLES3.functional.texture.specification.texsubimage3d_pbo.r16i_2d_array dEQP-GLES3.functional.transform_feedback.array_element.interleaved.triangles.highp_mat2x3 dEQP-GLES3.functional.transform_feedback.array_element.interleaved.triangles.lowp_mat2x4 dEQP-GLES3.functional.transform_feedback.array_element.separate.triangles.lowp_mat2x4 diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 56f5c478b27..e7bf3d9ee9b 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -133,6 +133,19 @@ realloc_bo(struct fd_resource *rsc, uint32_t size) rsc->bo = fd_bo_new(screen->dev, size, flags, "%ux%ux%u@%u:%x", prsc->width0, prsc->height0, prsc->depth0, rsc->layout.cpp, prsc->bind); + + /* Zero out the UBWC area on allocation. This fixes intermittent failures + * with UBWC, which I suspect are due to the HW having a hard time + * interpreting arbitrary values populating the flags buffer when the BO + * was recycled through the bo cache (instead of fresh allocations from + * the kernel, which are zeroed). sleep(1) in this spot didn't work + * around the issue, but any memset value seems to. + */ + if (rsc->layout.ubwc) { + void *buf = fd_bo_map(rsc->bo); + memset(buf, 0, rsc->layout.slices[0].offset); + } + rsc->seqno = p_atomic_inc_return(&screen->rsc_seqno); util_range_set_empty(&rsc->valid_buffer_range); fd_bc_invalidate_resource(rsc, true); -- 2.30.2