diff options
-rw-r--r-- | src/gallium/drivers/lima/lima_draw.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 6751575a1da..c97258c592f 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -1438,6 +1438,7 @@ lima_pack_wb_zsbuf_reg(struct lima_context *ctx, uint32_t *wb_reg, int wb_idx) { struct lima_context_framebuffer *fb = &ctx->framebuffer; struct lima_resource *res = lima_resource(fb->base.zsbuf->texture); + int level = fb->base.zsbuf->u.tex.level; uint32_t format; @@ -1455,14 +1456,14 @@ lima_pack_wb_zsbuf_reg(struct lima_context *ctx, uint32_t *wb_reg, int wb_idx) struct lima_pp_wb_reg *wb = (void *)wb_reg; wb[wb_idx].type = 0x01; /* 1 for depth, stencil */ - wb[wb_idx].address = res->bo->va; + wb[wb_idx].address = res->bo->va + res->levels[level].offset; wb[wb_idx].pixel_format = format; if (res->tiled) { wb[wb_idx].pixel_layout = 0x2; wb[wb_idx].pitch = fb->tiled_w; } else { wb[wb_idx].pixel_layout = 0x0; - wb[wb_idx].pitch = res->levels[0].stride / 8; + wb[wb_idx].pitch = res->levels[level].stride / 8; } wb[wb_idx].mrt_bits = 0; } @@ -1472,6 +1473,7 @@ lima_pack_wb_cbuf_reg(struct lima_context *ctx, uint32_t *wb_reg, int wb_idx) { struct lima_context_framebuffer *fb = &ctx->framebuffer; struct lima_resource *res = lima_resource(fb->base.cbufs[0]->texture); + int level = fb->base.cbufs[0]->u.tex.level; bool swap_channels = false; switch (fb->base.cbufs[0]->format) { @@ -1485,14 +1487,14 @@ lima_pack_wb_cbuf_reg(struct lima_context *ctx, uint32_t *wb_reg, int wb_idx) struct lima_pp_wb_reg *wb = (void *)wb_reg; wb[wb_idx].type = 0x02; /* 2 for color buffer */ - wb[wb_idx].address = res->bo->va; + wb[wb_idx].address = res->bo->va + res->levels[level].offset; wb[wb_idx].pixel_format = LIMA_PIXEL_FORMAT_B8G8R8A8; if (res->tiled) { wb[wb_idx].pixel_layout = 0x2; wb[wb_idx].pitch = fb->tiled_w; } else { wb[wb_idx].pixel_layout = 0x0; - wb[wb_idx].pitch = res->levels[0].stride / 8; + wb[wb_idx].pitch = res->levels[level].stride / 8; } wb[wb_idx].mrt_bits = swap_channels ? 0x4 : 0x0; } |