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>
This commit is contained in:
Alyssa Rosenzweig 2022-03-21 21:21:48 -04:00
parent 43f6c08a3b
commit 95a18d1c1c
4 changed files with 19 additions and 5 deletions

View File

@ -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,

View File

@ -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) */

View File

@ -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;

View File

@ -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,