struct fd_ringbuffer *ring,
uint32_t base,
struct pipe_surface *psurf,
- struct fd_resource *rsc)
+ bool stencil)
{
struct fd_resource_slice *slice;
+ struct fd_resource *rsc = fd_resource(psurf->texture);
+ enum pipe_format pfmt = psurf->format;
uint32_t offset;
+ /* separate stencil case: */
+ if (stencil) {
+ rsc = rsc->stencil;
+ pfmt = rsc->base.format;
+ }
+
slice = fd_resource_slice(rsc, psurf->u.tex.level);
offset = fd_resource_offset(rsc, psurf->u.tex.level,
psurf->u.tex.first_layer);
debug_assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
- enum pipe_format pfmt = psurf->format;
enum a6xx_color_fmt format = fd6_pipe2color(pfmt);
uint32_t stride = slice->pitch * rsc->cpp;
uint32_t size = slice->size0;
// TODO: tile mode
// bool tiled;
// tiled = rsc->tile_mode &&
- // !fd_resource_level_linear(psurf->texture, psurf->u.tex.level);
+ // !fd_resource_level_linear(&rsc->base, psurf->u.tex.level);
OUT_PKT4(ring, REG_A6XX_RB_BLIT_DST_INFO, 5);
OUT_RING(ring,
struct fd_ringbuffer *ring,
uint32_t base,
struct pipe_surface *psurf,
- struct fd_resource *rsc,
unsigned buffer)
{
uint32_t info = 0;
+ bool stencil = false;
switch (buffer) {
case FD_BUFFER_COLOR:
break;
case FD_BUFFER_STENCIL:
info |= A6XX_RB_BLIT_INFO_UNK0;
+ stencil = true;
break;
case FD_BUFFER_DEPTH:
info |= A6XX_RB_BLIT_INFO_DEPTH | A6XX_RB_BLIT_INFO_UNK0;
OUT_PKT4(ring, REG_A6XX_RB_BLIT_INFO, 1);
OUT_RING(ring, info | A6XX_RB_BLIT_INFO_GMEM);
- emit_blit(batch, ring, base, psurf, rsc);
+ emit_blit(batch, ring, base, psurf, stencil);
}
static void
if (!(batch->restore & (PIPE_CLEAR_COLOR0 << i)))
continue;
emit_restore_blit(batch, ring, gmem->cbuf_base[i], pfb->cbufs[i],
- fd_resource(pfb->cbufs[i]->texture),
FD_BUFFER_COLOR);
}
}
struct fd_resource *rsc = fd_resource(pfb->zsbuf->texture);
if (!rsc->stencil || (batch->restore & FD_BUFFER_DEPTH)) {
- emit_restore_blit(batch, ring, gmem->zsbuf_base[0], pfb->zsbuf, rsc,
+ emit_restore_blit(batch, ring, gmem->zsbuf_base[0], pfb->zsbuf,
FD_BUFFER_DEPTH);
}
if (rsc->stencil && (batch->restore & FD_BUFFER_STENCIL)) {
- emit_restore_blit(batch, ring, gmem->zsbuf_base[1], pfb->zsbuf, rsc->stencil,
+ emit_restore_blit(batch, ring, gmem->zsbuf_base[1], pfb->zsbuf,
FD_BUFFER_STENCIL);
}
}
struct fd_ringbuffer *ring,
uint32_t base,
struct pipe_surface *psurf,
- struct fd_resource *rsc,
unsigned buffer)
{
uint32_t info = 0;
+ bool stencil = false;
- if (!rsc->valid)
+ if (!fd_resource(psurf->texture)->valid)
return;
switch (buffer) {
break;
case FD_BUFFER_STENCIL:
info |= A6XX_RB_BLIT_INFO_UNK0;
+ stencil = true;
break;
case FD_BUFFER_DEPTH:
info |= A6XX_RB_BLIT_INFO_DEPTH;
OUT_PKT4(ring, REG_A6XX_RB_BLIT_INFO, 1);
OUT_RING(ring, info);
- emit_blit(batch, ring, base, psurf, rsc);
+ emit_blit(batch, ring, base, psurf, stencil);
}
/*
if (!rsc->stencil || (batch->resolve & FD_BUFFER_DEPTH)) {
emit_resolve_blit(batch, ring,
- gmem->zsbuf_base[0], pfb->zsbuf, rsc,
+ gmem->zsbuf_base[0], pfb->zsbuf,
FD_BUFFER_DEPTH);
}
if (rsc->stencil && (batch->resolve & FD_BUFFER_STENCIL)) {
emit_resolve_blit(batch, ring,
- gmem->zsbuf_base[1], pfb->zsbuf, rsc->stencil,
+ gmem->zsbuf_base[1], pfb->zsbuf,
FD_BUFFER_STENCIL);
}
}
if (!(batch->resolve & (PIPE_CLEAR_COLOR0 << i)))
continue;
emit_resolve_blit(batch, ring, gmem->cbuf_base[i], pfb->cbufs[i],
- fd_resource(pfb->cbufs[i]->texture),
FD_BUFFER_COLOR);
}
}