lima: use lima_submit_create_stream_bo for plbu/vs_cmd and pp_stack
authorQiang Yu <yuq825@gmail.com>
Sun, 9 Feb 2020 02:19:49 +0000 (10:19 +0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Feb 2020 02:54:15 +0000 (02:54 +0000)
lima_ctx_buff is used cross function calls in draws. But plbu/vs_cmd
and pp_stack are used immediately after create. And we need to get
rid of "ctx->submit" in the flush code path which exists in
lima_ctx_buff.

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>

src/gallium/drivers/lima/lima_context.h
src/gallium/drivers/lima/lima_submit.c

index d73eeea94bff70fa2ad1515175f6a1b2039cc32f..47e779b7357718776238e46e3b4c4ab072c2b341 100644 (file)
@@ -125,13 +125,10 @@ enum lima_ctx_buff {
    lima_ctx_buff_gp_varying_info,
    lima_ctx_buff_gp_attribute_info,
    lima_ctx_buff_gp_uniform,
-   lima_ctx_buff_gp_vs_cmd,
-   lima_ctx_buff_gp_plbu_cmd,
    lima_ctx_buff_pp_plb_rsw,
    lima_ctx_buff_pp_uniform_array,
    lima_ctx_buff_pp_uniform,
    lima_ctx_buff_pp_tex_desc,
-   lima_ctx_buff_pp_stack,
    lima_ctx_buff_num,
    lima_ctx_buff_num_gp = lima_ctx_buff_pp_plb_rsw,
 };
index b23591d389b16d56f761eabd6fd8b44dddfefe85..be792e86413664721899bb795121ee851f42fd29 100644 (file)
@@ -748,20 +748,20 @@ lima_do_submit(struct lima_submit *submit)
    uint32_t vs_cmd_va = 0;
 
    if (vs_cmd_size) {
-      void *vs_cmd =
-         lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_vs_cmd, vs_cmd_size);
+      void *vs_cmd = lima_submit_create_stream_bo(
+         submit, LIMA_PIPE_GP, vs_cmd_size, &vs_cmd_va);
       memcpy(vs_cmd, util_dynarray_begin(&ctx->vs_cmd_array), vs_cmd_size);
       util_dynarray_clear(&ctx->vs_cmd_array);
-      vs_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_vs_cmd);
 
       lima_dump_command_stream_print(
          vs_cmd, vs_cmd_size, false, "flush vs cmd at va %x\n", vs_cmd_va);
       lima_dump_vs_command_stream_print(vs_cmd, vs_cmd_size, vs_cmd_va);
    }
 
+   uint32_t plbu_cmd_va;
    int plbu_cmd_size = ctx->plbu_cmd_array.size + ctx->plbu_cmd_head.size;
-   void *plbu_cmd =
-      lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size);
+   void *plbu_cmd = lima_submit_create_stream_bo(
+      submit, LIMA_PIPE_GP, plbu_cmd_size, &plbu_cmd_va);
    memcpy(plbu_cmd,
           util_dynarray_begin(&ctx->plbu_cmd_head),
           ctx->plbu_cmd_head.size);
@@ -770,7 +770,6 @@ lima_do_submit(struct lima_submit *submit)
           ctx->plbu_cmd_array.size);
    util_dynarray_clear(&ctx->plbu_cmd_array);
    util_dynarray_clear(&ctx->plbu_cmd_head);
-   uint32_t plbu_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_plbu_cmd);
 
    lima_dump_command_stream_print(
       plbu_cmd, plbu_cmd_size, false, "flush plbu cmd at va %x\n", plbu_cmd_va);
@@ -814,9 +813,10 @@ lima_do_submit(struct lima_submit *submit)
 
    uint32_t pp_stack_va = 0;
    if (ctx->pp_max_stack_size) {
-      lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_stack, screen->num_pp *
-                          ctx->pp_max_stack_size * pp_stack_pp_size);
-      pp_stack_va = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_stack);
+      lima_submit_create_stream_bo(
+         submit, LIMA_PIPE_PP,
+         screen->num_pp * ctx->pp_max_stack_size * pp_stack_pp_size,
+         &pp_stack_va);
    }
 
    lima_update_pp_stream(submit);