From e6776148c103fa965752a0a866b688a8d9a84bef Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 18 Aug 2021 13:30:57 -0700 Subject: [PATCH] freedreno/a6xx: Sync TFB BO access against prior TFB writes. CTS draw_indirect usage of TFB output was flaking due to the TFB writes possibly not having completed. Since GL TFB doesn't require any other barrier between TFB and use of the BO (as seen by the CTS not emitting any memory barrier), we have to do it ourselves. Part-of: --- src/freedreno/ci/deqp-freedreno-a630-fails.txt | 4 ---- src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 17 +++++++++++++++++ .../ci/piglit-freedreno-a630-fails.txt | 1 - 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/freedreno/ci/deqp-freedreno-a630-fails.txt b/src/freedreno/ci/deqp-freedreno-a630-fails.txt index 767bb04783b..18325d68824 100644 --- a/src/freedreno/ci/deqp-freedreno-a630-fails.txt +++ b/src/freedreno/ci/deqp-freedreno-a630-fails.txt @@ -28,10 +28,6 @@ KHR-GLES31.core.gpu_shader5.fma_precision_vec4,Fail # "Got red: 1, expected 0.00392157, at (1, 0)" KHR-GLES31.core.compute_shader.resource-image,Fail -# "(x,y)= (0,0). Color RGBA(0,0,0,1) is different than expected RGBA(0.1,0.2,0.3,1)" -KHR-GLES31.core.draw_indirect.advanced-twoPass-transformFeedback-arrays,Fail -KHR-GLES31.core.draw_indirect.advanced-twoPass-transformFeedback-elements,Fail - # Lots of errors like "[279] Check failed. Received: [3,0,0,2] instead of: [5,0,0,2]" KHR-GLES31.core.geometry_shader.layered_framebuffer.depth_support,Fail diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 3c4716ff68f..bd9b39a71eb 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -927,6 +927,23 @@ fd6_emit_streamout(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt } } + /* Make sure that any use of our TFB outputs (indirect draw source or shader + * UBO reads) comes after the TFB output is written. From the GL 4.6 core + * spec: + * + * "Buffers should not be bound or in use for both transform feedback and + * other purposes in the GL. Specifically, if a buffer object is + * simultaneously bound to a transform feedback buffer binding point + * and elsewhere in the GL, any writes to or reads from the buffer + * generate undefined values." + * + * So we idle whenever SO buffers change. Note that this function is called + * on every draw with TFB enabled, so check the dirty flag for the buffers + * themselves. + */ + if (ctx->dirty & FD_DIRTY_STREAMOUT) + fd_wfi(ctx->batch, ring); + ctx->last.streamout_mask = emit->streamout_mask; } diff --git a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt index 4e85532d401..61c1a5b0cda 100644 --- a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt +++ b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt @@ -311,7 +311,6 @@ spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SR spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SRGB_S3TC_DXT1_EXT- swizzled- border color only,Fail spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SRGB- swizzled- border color only,Fail spec@ext_transform_feedback@geometry-shaders-basic,Fail -spec@ext_transform_feedback@immediate-reuse-index-buffer,Fail spec@ext_transform_feedback@intervening-read prims_generated,Fail spec@ext_transform_feedback@intervening-read prims_generated use_gs,Fail spec@ext_transform_feedback@overflow-edge-cases,Fail