freedreno/a6xx: Use box to pass 2d clear params
Simplifies the interface slightly and makes it possible to re-use the path for pctx->clear_texture() in the next commit. The z dimensions still come from the surface. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19400>
This commit is contained in:
@@ -784,7 +784,7 @@ convert_color(enum pipe_format format, union pipe_color_union *pcolor)
|
||||
|
||||
void
|
||||
fd6_clear_surface(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
||||
struct pipe_surface *psurf, uint32_t width, uint32_t height,
|
||||
struct pipe_surface *psurf, const struct pipe_box *box2d,
|
||||
union pipe_color_union *color, uint32_t unknown_8c01)
|
||||
{
|
||||
if (DEBUG_BLIT) {
|
||||
@@ -795,9 +795,10 @@ fd6_clear_surface(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
||||
|
||||
uint32_t nr_samples = fd_resource_nr_samples(psurf->texture);
|
||||
OUT_PKT4(ring, REG_A6XX_GRAS_2D_DST_TL, 2);
|
||||
OUT_RING(ring, A6XX_GRAS_2D_DST_TL_X(0) | A6XX_GRAS_2D_DST_TL_Y(0));
|
||||
OUT_RING(ring, A6XX_GRAS_2D_DST_BR_X(width * nr_samples - 1) |
|
||||
A6XX_GRAS_2D_DST_BR_Y(height - 1));
|
||||
OUT_RING(ring, A6XX_GRAS_2D_DST_TL_X(box2d->x * nr_samples) |
|
||||
A6XX_GRAS_2D_DST_TL_Y(box2d->y));
|
||||
OUT_RING(ring, A6XX_GRAS_2D_DST_BR_X((box2d->x + box2d->width) * nr_samples - 1) |
|
||||
A6XX_GRAS_2D_DST_BR_Y(box2d->y + box2d->height - 1));
|
||||
|
||||
union pipe_color_union clear_color = convert_color(psurf->format, color);
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@ unsigned fd6_tile_mode(const struct pipe_resource *tmpl);
|
||||
*/
|
||||
|
||||
void fd6_clear_surface(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
||||
struct pipe_surface *psurf, uint32_t width,
|
||||
uint32_t height,
|
||||
struct pipe_surface *psurf, const struct pipe_box *box2d,
|
||||
union pipe_color_union *color, uint32_t unknown_8c01) assert_dt;
|
||||
void fd6_resolve_tile(struct fd_batch *batch, struct fd_ringbuffer *ring,
|
||||
uint32_t base, struct pipe_surface *psurf, uint32_t unknown_8c01) assert_dt;
|
||||
|
||||
@@ -1505,6 +1505,9 @@ emit_sysmem_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) assert_dt
|
||||
if (!buffers)
|
||||
return;
|
||||
|
||||
struct pipe_box box2d;
|
||||
u_box_2d(0, 0, pfb->width, pfb->height, &box2d);
|
||||
|
||||
trace_start_clear_restore(&batch->trace, ring, buffers);
|
||||
|
||||
if (buffers & PIPE_CLEAR_COLOR) {
|
||||
@@ -1517,8 +1520,7 @@ emit_sysmem_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) assert_dt
|
||||
if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
|
||||
continue;
|
||||
|
||||
fd6_clear_surface(ctx, ring, pfb->cbufs[i], pfb->width, pfb->height,
|
||||
&color, 0);
|
||||
fd6_clear_surface(ctx, ring, pfb->cbufs[i], &box2d, &color, 0);
|
||||
}
|
||||
}
|
||||
if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
|
||||
@@ -1533,7 +1535,7 @@ emit_sysmem_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) assert_dt
|
||||
if ((buffers & PIPE_CLEAR_DEPTH) || (!separate_stencil && (buffers & PIPE_CLEAR_STENCIL))) {
|
||||
value.f[0] = batch->clear_depth;
|
||||
value.ui[1] = batch->clear_stencil;
|
||||
fd6_clear_surface(ctx, ring, pfb->zsbuf, pfb->width, pfb->height,
|
||||
fd6_clear_surface(ctx, ring, pfb->zsbuf, &box2d,
|
||||
&value, fd6_unknown_8c01(pfb->zsbuf->format, buffers));
|
||||
}
|
||||
|
||||
@@ -1544,8 +1546,7 @@ emit_sysmem_clears(struct fd_batch *batch, struct fd_ringbuffer *ring) assert_dt
|
||||
stencil_surf.format = PIPE_FORMAT_S8_UINT;
|
||||
stencil_surf.texture = separate_stencil;
|
||||
|
||||
fd6_clear_surface(ctx, ring, &stencil_surf, pfb->width, pfb->height,
|
||||
&value, 0);
|
||||
fd6_clear_surface(ctx, ring, &stencil_surf, &box2d, &value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user