summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2019-04-06 22:48:16 -0700
committerQiang Yu <[email protected]>2019-04-14 01:16:00 +0000
commita817f0fec6e3d3bbbfb8df0349c0085710b5aad4 (patch)
treef7ec7efc5b8574f5cdea0d86593b61436c0856b7
parentb6bed115a5efb281b450c749418646b4ea2e7db7 (diff)
lima: use individual tile heap for each GP job.
Looks like it's somehow used by subsequent PP job, so we have to preserve its contents until PP job is done. Signed-off-by: Vasily Khoruzhick <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Tested-by: Icenowy Zheng <[email protected]>
-rw-r--r--src/gallium/drivers/lima/lima_context.c5
-rw-r--r--src/gallium/drivers/lima/lima_context.h3
-rw-r--r--src/gallium/drivers/lima/lima_draw.c7
-rw-r--r--src/gallium/drivers/lima/lima_screen.c15
-rw-r--r--src/gallium/drivers/lima/lima_screen.h4
5 files changed, 15 insertions, 19 deletions
diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c
index 7440c1a9578..35350ee71b8 100644
--- a/src/gallium/drivers/lima/lima_context.c
+++ b/src/gallium/drivers/lima/lima_context.c
@@ -139,6 +139,8 @@ lima_context_destroy(struct pipe_context *pctx)
for (int i = 0; i < LIMA_CTX_PLB_MAX_NUM; i++) {
if (ctx->plb[i])
lima_bo_free(ctx->plb[i]);
+ if (ctx->gp_tile_heap[i])
+ lima_bo_free(ctx->gp_tile_heap[i]);
}
if (ctx->plb_gp_stream)
@@ -223,6 +225,9 @@ lima_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->plb[i] = lima_bo_create(screen, ctx->plb_size, 0);
if (!ctx->plb[i])
goto err_out;
+ ctx->gp_tile_heap[i] = lima_bo_create(screen, gp_tile_heap_size, 0);
+ if (!ctx->gp_tile_heap[i])
+ goto err_out;
}
unsigned plb_gp_stream_size =
diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h
index 4ce3e6f400d..469378a4a36 100644
--- a/src/gallium/drivers/lima/lima_context.h
+++ b/src/gallium/drivers/lima/lima_context.h
@@ -227,7 +227,10 @@ struct lima_context {
unsigned plb_gp_size;
struct lima_bo *plb[LIMA_CTX_PLB_MAX_NUM];
+ struct lima_bo *gp_tile_heap[LIMA_CTX_PLB_MAX_NUM];
+ #define gp_tile_heap_size 0x100000
struct lima_bo *plb_gp_stream;
+
struct hash_table *plb_pp_stream;
uint32_t plb_index;
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index a06210f98a0..2cbcadae1b1 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -656,7 +656,7 @@ lima_update_submit_bo(struct lima_context *ctx)
struct lima_screen *screen = lima_screen(ctx->base.screen);
lima_submit_add_bo(ctx->gp_submit, ctx->plb_gp_stream, LIMA_SUBMIT_BO_READ);
lima_submit_add_bo(ctx->gp_submit, ctx->plb[ctx->plb_index], LIMA_SUBMIT_BO_WRITE);
- lima_submit_add_bo(ctx->gp_submit, screen->gp_buffer, LIMA_SUBMIT_BO_READ);
+ lima_submit_add_bo(ctx->gp_submit, ctx->gp_tile_heap[ctx->plb_index], LIMA_SUBMIT_BO_WRITE);
lima_dump_command_stream_print(
ctx->plb_gp_stream->map + ctx->plb_index * ctx->plb_gp_size,
@@ -673,6 +673,7 @@ lima_update_submit_bo(struct lima_context *ctx)
struct lima_resource *res = lima_resource(ctx->framebuffer.base.cbufs[0]->texture);
lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_WRITE);
lima_submit_add_bo(ctx->pp_submit, ctx->plb[ctx->plb_index], LIMA_SUBMIT_BO_READ);
+ lima_submit_add_bo(ctx->pp_submit, ctx->gp_tile_heap[ctx->plb_index], LIMA_SUBMIT_BO_READ);
lima_submit_add_bo(ctx->pp_submit, screen->pp_buffer, LIMA_SUBMIT_BO_READ);
}
@@ -1521,8 +1522,8 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
gp_frame_reg->vs_cmd_end = vs_cmd_va + vs_cmd_size;
gp_frame_reg->plbu_cmd_start = plbu_cmd_va;
gp_frame_reg->plbu_cmd_end = plbu_cmd_va + plbu_cmd_size;
- gp_frame_reg->tile_heap_start = screen->gp_buffer->va + gp_tile_heap_offset;
- gp_frame_reg->tile_heap_end = screen->gp_buffer->va + gp_buffer_size;
+ gp_frame_reg->tile_heap_start = ctx->gp_tile_heap[ctx->plb_index]->va;
+ gp_frame_reg->tile_heap_end = ctx->gp_tile_heap[ctx->plb_index]->va + gp_tile_heap_size;
lima_dump_command_stream_print(
&gp_frame, sizeof(gp_frame), false, "add gp frame\n");
diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c
index 8615003cb81..ae58f7fd82a 100644
--- a/src/gallium/drivers/lima/lima_screen.c
+++ b/src/gallium/drivers/lima/lima_screen.c
@@ -57,9 +57,6 @@ lima_screen_destroy(struct pipe_screen *pscreen)
if (screen->ro)
free(screen->ro);
- if (screen->gp_buffer)
- lima_bo_free(screen->gp_buffer);
-
if (screen->pp_buffer)
lima_bo_free(screen->pp_buffer);
@@ -454,13 +451,9 @@ lima_screen_create(int fd, struct renderonly *ro)
if (!screen->pp_ra)
goto err_out1;
- screen->gp_buffer = lima_bo_create(screen, gp_buffer_size, 0);
- if (!screen->gp_buffer)
- goto err_out1;
-
screen->pp_buffer = lima_bo_create(screen, pp_buffer_size, 0);
if (!screen->pp_buffer)
- goto err_out2;
+ goto err_out1;
/* fs program for clear buffer?
* const0 1 0 0 -1.67773, mov.v0 $0 ^const0.xxxx, stop
@@ -507,7 +500,7 @@ lima_screen_create(int fd, struct renderonly *ro)
screen->ro = renderonly_dup(ro);
if (!screen->ro) {
fprintf(stderr, "Failed to dup renderonly object\n");
- goto err_out3;
+ goto err_out2;
}
}
@@ -534,10 +527,8 @@ lima_screen_create(int fd, struct renderonly *ro)
return &screen->base;
-err_out3:
- lima_bo_free(screen->pp_buffer);
err_out2:
- lima_bo_free(screen->gp_buffer);
+ lima_bo_free(screen->pp_buffer);
err_out1:
lima_bo_table_fini(screen);
err_out0:
diff --git a/src/gallium/drivers/lima/lima_screen.h b/src/gallium/drivers/lima/lima_screen.h
index 31797729c1f..af435f71190 100644
--- a/src/gallium/drivers/lima/lima_screen.h
+++ b/src/gallium/drivers/lima/lima_screen.h
@@ -64,10 +64,6 @@ struct lima_screen {
struct ra_regs *pp_ra;
- struct lima_bo *gp_buffer;
- #define gp_tile_heap_offset 0x000000
- #define gp_buffer_size 0x100000
-
struct lima_bo *pp_buffer;
#define pp_frame_rsw_offset 0x0000
#define pp_clear_program_offset 0x0040