/* plbu commands */
#define PLBU_CMD_BEGIN(max) { \
int i = 0, max_n = max; \
- uint32_t *plbu_cmd = util_dynarray_grow_cap(&ctx->plbu_cmd_array, max_n * 4);
+ uint32_t *plbu_cmd = util_dynarray_ensure_cap(&ctx->plbu_cmd_array, ctx->plbu_cmd_array.size + max_n * 4);
#define PLBU_CMD_END() \
assert(i <= max_n); \
PLBU_CMD(((shift_min) << 28) | ((shift_h) << 16) | (shift_w), 0x1000010C)
#define PLBU_CMD_TILED_DIMENSIONS(tiled_w, tiled_h) \
PLBU_CMD((((tiled_w) - 1) << 24) | (((tiled_h) - 1) << 8), 0x10000109)
-#define PLBU_CMD_BLOCK_STRIDE(block_w) PLBU_CMD(block_w, 0x30000000)
+#define PLBU_CMD_BLOCK_STRIDE(block_w) PLBU_CMD((block_w) & 0xff, 0x30000000)
#define PLBU_CMD_ARRAY_ADDRESS(gp_stream, block_num) \
PLBU_CMD(gp_stream, 0x28000000 | ((block_num) - 1) | 1)
#define PLBU_CMD_VIEWPORT_X(v) PLBU_CMD(v, 0x10000107)
/* vs commands */
#define VS_CMD_BEGIN(max) { \
int i = 0, max_n = max; \
- uint32_t *vs_cmd = util_dynarray_grow_cap(&ctx->vs_cmd_array, max_n * 4);
+ uint32_t *vs_cmd = util_dynarray_ensure_cap(&ctx->vs_cmd_array, ctx->vs_cmd_array.size + max_n * 4);
#define VS_CMD_END() \
assert(i <= max_n); \
0x0C000000; /* need check if this GLESv1 glAlphaFunc */
}
+#if 0
static int
lima_stencil_op(enum pipe_stencil_op pipe)
{
}
return -1;
}
+#endif
static int
lima_calculate_depth_test(struct pipe_depth_state *depth, struct pipe_rasterizer_state *rst)
lima_finish_plbu_cmd(struct lima_context *ctx)
{
int i = 0;
- uint32_t *plbu_cmd = util_dynarray_grow_cap(&ctx->plbu_cmd_array, 2 * 4);
+ uint32_t *plbu_cmd = util_dynarray_ensure_cap(&ctx->plbu_cmd_array, ctx->plbu_cmd_array.size + 2 * 4);
plbu_cmd[i++] = 0x00000000;
plbu_cmd[i++] = 0x50000000; /* END */
{
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;
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;
}
{
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) {
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;
}