summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2022-03-21 21:21:48 -0400
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>2022-05-21 22:01:32 -0400
commit95a18d1c1c525249768b4d2008770a74563daf11 (patch)
tree0f8e70c7f3293b1db714f7b040129d23eb3cca86 /src/gallium/drivers
parent43f6c08a3bf5ec3d0556e558da130da1b1f478d1 (diff)
asahi: Pass depth/stencil clear values to firmware
These need to be format-packed, but as we only support Z32F_S8 right now, that's trivial. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/asahi/agx_pipe.c10
-rw-r--r--src/gallium/drivers/asahi/agx_state.h2
-rw-r--r--src/gallium/drivers/asahi/magic.c8
-rw-r--r--src/gallium/drivers/asahi/magic.h4
4 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c
index 60187048b46..38626fe677f 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -392,6 +392,12 @@ agx_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor
if (buffers & PIPE_CLEAR_COLOR0)
memcpy(ctx->batch->clear_color, color->f, sizeof(color->f));
+
+ if (buffers & PIPE_CLEAR_DEPTH)
+ ctx->batch->clear_depth = depth;
+
+ if (buffers & PIPE_CLEAR_STENCIL)
+ ctx->batch->clear_stencil = stencil;
}
@@ -544,7 +550,9 @@ agx_flush(struct pipe_context *pctx,
pipeline_null.gpu,
pipeline_clear,
pipeline_store,
- clear_pipeline_textures);
+ clear_pipeline_textures,
+ ctx->batch->clear_depth,
+ ctx->batch->clear_stencil);
/* Generate the mapping table from the BO list */
demo_mem_map(dev->memmap.ptr.cpu, dev->memmap.size, handles, handle_count,
diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h
index cc0a187250a..2de160bc329 100644
--- a/src/gallium/drivers/asahi/agx_state.h
+++ b/src/gallium/drivers/asahi/agx_state.h
@@ -103,6 +103,8 @@ struct agx_batch {
uint32_t clear, draw;
float clear_color[4];
+ double clear_depth;
+ unsigned clear_stencil;
/* Resource list requirements, represented as a bit set indexed by BO
* handles (GEM handles on Linux, or IOGPU's equivalent on macOS) */
diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c
index 049d2b3e7e1..c05c9a0ff3d 100644
--- a/src/gallium/drivers/asahi/magic.c
+++ b/src/gallium/drivers/asahi/magic.c
@@ -165,7 +165,9 @@ demo_cmdbuf(uint64_t *buf, size_t size,
uint32_t pipeline_null,
uint32_t pipeline_clear,
uint32_t pipeline_store,
- bool clear_pipeline_textures)
+ bool clear_pipeline_textures,
+ double clear_depth,
+ unsigned clear_stencil)
{
uint32_t *map = (uint32_t *) buf;
memset(map, 0, 518 * 4);
@@ -233,8 +235,8 @@ demo_cmdbuf(uint64_t *buf, size_t size,
}
agx_pack(map + 292, IOGPU_CLEAR_Z_S, cfg) {
- cfg.depth_clear_value = fui(1.0); // TODO
- cfg.stencil_clear_value = 0;
+ cfg.depth_clear_value = fui(clear_depth);
+ cfg.stencil_clear_value = clear_stencil;
}
map[312] = 0xffff8212;
diff --git a/src/gallium/drivers/asahi/magic.h b/src/gallium/drivers/asahi/magic.h
index 506784b8e1b..c405cbe51e5 100644
--- a/src/gallium/drivers/asahi/magic.h
+++ b/src/gallium/drivers/asahi/magic.h
@@ -34,7 +34,9 @@ demo_cmdbuf(uint64_t *buf, size_t size,
uint32_t pipeline_null,
uint32_t pipeline_clear,
uint32_t pipeline_store,
- bool clear_pipeline_textures);
+ bool clear_pipeline_textures,
+ double clear_depth,
+ unsigned clear_stencil);
void
demo_mem_map(void *map, size_t size, unsigned *handles,