Mesa (staging/20.1): freedreno: handle case of shadowing current render target
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Aug 27 22:05:35 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 8a0446035daed06c2451b34c05886cd2d37e50bf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a0446035daed06c2451b34c05886cd2d37e50bf
Author: Rob Clark <robdclark at chromium.org>
Date: Fri Aug 21 15:58:37 2020 -0700
freedreno: handle case of shadowing current render target
If you have a sequence where there is a single buffer associated with
the current render target, and then you end up shadowing it on the 3d
pipe (u_blitter), because of how we swap the new shadow and rsc before
the back-blit, you could end up confusing things into thinking that
the blitters framebuffer state is the same as the current framebuffer
state.
Re-organizing the sequence to swap after the blit is complicated when
also having to deal with CPU memcpy blit path, and the batch/rsc
accounting. So instead just detect this case and flush if we need to.
Fixes:
dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_clear
dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_draw
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6434>
(cherry picked from commit 1fa43a4a8ec37aacac4d333a4c72987819188e69)
---
.gitlab-ci/deqp-freedreno-a630-fails.txt | 2 --
.pick_status.json | 2 +-
src/gallium/drivers/freedreno/freedreno_resource.c | 18 ++++++++++++++++++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.gitlab-ci/deqp-freedreno-a630-fails.txt b/.gitlab-ci/deqp-freedreno-a630-fails.txt
index 61478eb1fef..f08204014b9 100644
--- a/.gitlab-ci/deqp-freedreno-a630-fails.txt
+++ b/.gitlab-ci/deqp-freedreno-a630-fails.txt
@@ -1,4 +1,2 @@
dEQP-GLES2.functional.clipping.triangle_vertex.clip_three.clip_neg_x_neg_z_and_pos_x_pos_z_and_neg_x_neg_y_pos_z
dEQP-GLES2.functional.clip_control.depth_mode_zero_to_one
-dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_clear
-dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_draw
diff --git a/.pick_status.json b/.pick_status.json
index 2955a793172..860b37a6ace 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1111,7 +1111,7 @@
"description": "freedreno: handle case of shadowing current render target",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index c9e408fe908..e6016189edf 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -216,6 +216,9 @@ do_blit(struct fd_context *ctx, const struct pipe_blit_info *blit, bool fallback
}
}
+static void
+flush_resource(struct fd_context *ctx, struct fd_resource *rsc, unsigned usage);
+
/**
* @rsc: the resource to shadow
* @level: the level to discard (if box != NULL, otherwise ignored)
@@ -233,6 +236,21 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
if (prsc->next)
return false;
+ /* If you have a sequence where there is a single rsc associated
+ * with the current render target, and then you end up shadowing
+ * that same rsc on the 3d pipe (u_blitter), because of how we
+ * swap the new shadow and rsc before the back-blit, you could end
+ * up confusing things into thinking that u_blitter's framebuffer
+ * state is the same as the current framebuffer state, which has
+ * the result of blitting to rsc rather than shadow.
+ *
+ * Normally we wouldn't want to unconditionally trigger a flush,
+ * since that defeats the purpose of shadowing, but this is a
+ * case where we'd have to flush anyways.
+ */
+ if (rsc->write_batch == ctx->batch)
+ flush_resource(ctx, rsc, 0);
+
/* TODO: somehow munge dimensions and format to copy unsupported
* render target format to something that is supported?
*/
More information about the mesa-commit
mailing list