diff options
author | Qiang Yu <[email protected]> | 2019-05-15 17:35:19 +0800 |
---|---|---|
committer | Qiang Yu <[email protected]> | 2019-05-25 12:41:31 +0800 |
commit | 54490b0b368a6c58e1af72d4c151fdba415be210 (patch) | |
tree | 55f0c3afd6459c2d01fea6cb5b51c0326977f81f | |
parent | 98381850568741dc513a7ebdcbb7818941b52a23 (diff) |
lima: fix render to non-zero level texture
Current implementation won't respect level of surface to render.
Reviewed-by: Vasily Khoruzhick <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
-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; } |