summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-06-11 10:33:30 -0700
committerRob Clark <[email protected]>2019-06-15 07:33:04 -0700
commit5fe7b627eb8949323106e96c2bbed3d9521be379 (patch)
treeb2db00709bf75b32b09e09fe7f17b1695caf9056 /src/gallium/drivers/freedreno
parent4c75d62ce863bf397d9db3c94ce7eb12f7aa9250 (diff)
freedreno/a6xx: consolidate z/s blit handling
This will get even simpler with the next patch Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_blitter.c113
1 files changed, 46 insertions, 67 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 0fb552c1233..f707ad56cad 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -507,6 +507,7 @@ emit_blit_texture(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
}
+
/*
* Blit command:
*/
@@ -555,53 +556,59 @@ emit_blit_texture(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
}
}
-static void
-rewrite_zs_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
+static bool fd6_blit(struct fd_context *ctx, const struct pipe_blit_info *info);
+
+/**
+ * Handle depth/stencil blits either via u_blitter and/or re-writing the
+ * blit into an equivilant format that we can handle
+ */
+static bool
+handle_zs_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct pipe_blit_info separate = *info;
if (DEBUG_BLIT_FALLBACK) {
- fprintf(stderr, "---- rewrite_separate_zs_blit: ");
+ fprintf(stderr, "---- handle_zs_blit: ");
util_dump_blit_info(stderr, info);
fprintf(stderr, "\ndst resource: ");
util_dump_resource(stderr, info->dst.resource);
fprintf(stderr, "\nsrc resource: ");
util_dump_resource(stderr, info->src.resource);
- fprintf(stderr, "\n\n");
+ fprintf(stderr, "\n");
}
- switch (info->src.format) {
+ switch (info->dst.format) {
case PIPE_FORMAT_S8_UINT:
debug_assert(info->mask == PIPE_MASK_S);
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R8_UINT;
separate.dst.format = PIPE_FORMAT_R8_UINT;
- emit_blit_texture(ring, &separate);
- break;
+ return fd6_blit(ctx, &separate);
case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
if (info->mask & PIPE_MASK_Z) {
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R32_FLOAT;
separate.dst.format = PIPE_FORMAT_R32_FLOAT;
- emit_blit_texture(ring, &separate);
+ fd6_blit(ctx, &separate);
}
+
if (info->mask & PIPE_MASK_S) {
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R8_UINT;
separate.dst.format = PIPE_FORMAT_R8_UINT;
separate.src.resource = &fd_resource(info->src.resource)->stencil->base;
separate.dst.resource = &fd_resource(info->dst.resource)->stencil->base;
- emit_blit_texture(ring, &separate);
+ fd6_blit(ctx, &separate);
}
- break;
+
+ return true;
case PIPE_FORMAT_Z16_UNORM:
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R16_UNORM;
separate.dst.format = PIPE_FORMAT_R16_UNORM;
- emit_blit_texture(ring, &separate);
- break;
+ return fd6_blit(ctx, &separate);
case PIPE_FORMAT_Z32_UNORM:
case PIPE_FORMAT_Z32_FLOAT:
@@ -609,58 +616,38 @@ rewrite_zs_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R32_UINT;
separate.dst.format = PIPE_FORMAT_R32_UINT;
- emit_blit_texture(ring, &separate);
- break;
+ return fd6_blit(ctx, &separate);
- case PIPE_FORMAT_Z24_UNORM_S8_UINT:
- debug_assert(info->mask == PIPE_MASK_ZS);
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_X8Z24_UNORM:
separate.mask = PIPE_MASK_R;
separate.src.format = PIPE_FORMAT_R32_UINT;
separate.dst.format = PIPE_FORMAT_R32_UINT;
- emit_blit_texture(ring, &separate);
- break;
-
- default:
- unreachable("");
- }
-}
-
-static void
-rewrite_combined_zs_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
-{
- struct pipe_blit_info separate = *info;
+ return fd6_blit(ctx, &separate);
- if (DEBUG_BLIT_FALLBACK) {
- fprintf(stderr, "---- rewrite_combined_zs_blit: ");
- util_dump_blit_info(stderr, info);
- fprintf(stderr, "\ndst resource: ");
- util_dump_resource(stderr, info->dst.resource);
- fprintf(stderr, "\nsrc resource: ");
- util_dump_resource(stderr, info->src.resource);
- fprintf(stderr, "\n");
- }
-
- switch (info->mask) {
- case PIPE_MASK_Z:
- separate.mask = PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B;
- separate.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
- separate.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-
- fd_blitter_blit(ctx, &separate);
- break;
-
- case PIPE_MASK_S:
- separate.mask = PIPE_MASK_A;
- separate.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
- separate.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-
- fd_blitter_blit(ctx, &separate);
- break;
+ case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+ switch (info->mask) {
+ case PIPE_MASK_ZS:
+ separate.mask = PIPE_MASK_R;
+ separate.src.format = PIPE_FORMAT_R32_UINT;
+ separate.dst.format = PIPE_FORMAT_R32_UINT;
+ return fd6_blit(ctx, &separate);
+ case PIPE_MASK_Z:
+ separate.mask = PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B;
+ separate.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ separate.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ return fd_blitter_blit(ctx, &separate);
+ case PIPE_MASK_S:
+ separate.mask = PIPE_MASK_A;
+ separate.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ separate.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ return fd_blitter_blit(ctx, &separate);
+ default:
+ unreachable("");
+ }
+ return true;
default:
- unreachable("");
+ return false;
}
}
@@ -669,11 +656,8 @@ fd6_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct fd_batch *batch;
- if (info->dst.format == PIPE_FORMAT_Z24_UNORM_S8_UINT &&
- info->mask != PIPE_MASK_ZS) {
- rewrite_combined_zs_blit(ctx, info);
- return true;
- }
+ if (info->mask & PIPE_MASK_ZS)
+ return handle_zs_blit(ctx, info);
if (!can_do_blit(info))
return false;
@@ -703,12 +687,7 @@ fd6_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
/* I don't *think* we need to handle blits between buffer <-> !buffer */
debug_assert(info->src.resource->target != PIPE_BUFFER);
debug_assert(info->dst.resource->target != PIPE_BUFFER);
-
- if (info->mask & (PIPE_MASK_ZS)) {
- rewrite_zs_blit(batch->draw, info);
- } else {
- emit_blit_texture(batch->draw, info);
- }
+ emit_blit_texture(batch->draw, info);
}
fd6_event_write(batch, batch->draw, 0x1d, true);