aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQiang Yu <[email protected]>2020-02-04 10:54:40 +0800
committerMarge Bot <[email protected]>2020-02-17 02:54:15 +0000
commitc3bbe4f7f8bd88ee92179679526664467e83c45a (patch)
treea795819f08f3f95529e16dbf25eda8fe7eb03f21 /src
parent9f924c795b9520c49572b54bfab07731d4f54e6e (diff)
lima: remove lima_ctx_buff_va submit flags (v2)
We don't have any shared lima_ctx_buff for both GP and PP, so no need to have these flags. v2: still add submit in lima_ctx_buff_va because some bo need to exist cross flush, so not every submit will call lima_ctx_buff_alloc. Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/lima/lima_context.c6
-rw-r--r--src/gallium/drivers/lima/lima_context.h7
-rw-r--r--src/gallium/drivers/lima/lima_draw.c39
-rw-r--r--src/gallium/drivers/lima/lima_texture.c7
4 files changed, 26 insertions, 33 deletions
diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c
index e191ab0aa85..5e8ac448001 100644
--- a/src/gallium/drivers/lima/lima_context.c
+++ b/src/gallium/drivers/lima/lima_context.c
@@ -45,14 +45,14 @@
int lima_ctx_num_plb = LIMA_CTX_PLB_DEF_NUM;
uint32_t
-lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff, unsigned submit)
+lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff)
{
struct lima_ctx_buff_state *cbs = ctx->buffer_state + buff;
struct lima_resource *res = lima_resource(cbs->res);
- if (submit & LIMA_CTX_BUFF_SUBMIT_GP)
+ if (buff < lima_ctx_buff_num_gp)
lima_submit_add_bo(ctx->gp_submit, res->bo, LIMA_SUBMIT_BO_READ);
- if (submit & LIMA_CTX_BUFF_SUBMIT_PP)
+ else
lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_READ);
return res->bo->va + cbs->offset;
diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h
index e61605faacf..436a2ab1339 100644
--- a/src/gallium/drivers/lima/lima_context.h
+++ b/src/gallium/drivers/lima/lima_context.h
@@ -133,6 +133,7 @@ enum lima_ctx_buff {
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,
};
struct lima_ctx_buff_state {
@@ -278,11 +279,7 @@ lima_sampler_view(struct pipe_sampler_view *psview)
return (struct lima_sampler_view *)psview;
}
-#define LIMA_CTX_BUFF_SUBMIT_GP (1 << 0)
-#define LIMA_CTX_BUFF_SUBMIT_PP (1 << 1)
-
-uint32_t lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff,
- unsigned submit);
+uint32_t lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff);
void *lima_ctx_buff_map(struct lima_context *ctx, enum lima_ctx_buff buff);
void *lima_ctx_buff_alloc(struct lima_context *ctx, enum lima_ctx_buff buff,
unsigned size);
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index cd2bbd312a7..7f90a08b882 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -794,7 +794,7 @@ lima_pack_vs_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
int uniform_size = ctx->vs->uniform_pending_offset + ctx->vs->constant_size + 32;
VS_CMD_UNIFORMS_ADDRESS(
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_uniform, LIMA_CTX_BUFF_SUBMIT_GP),
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_uniform),
align(uniform_size, 16));
VS_CMD_SHADER_ADDRESS(ctx->vs->bo->va, ctx->vs->shader_size);
@@ -807,11 +807,11 @@ lima_pack_vs_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
VS_CMD_UNKNOWN1();
VS_CMD_ATTRIBUTES_ADDRESS(
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_attribute_info, LIMA_CTX_BUFF_SUBMIT_GP),
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_attribute_info),
MAX2(1, num_attributes));
VS_CMD_VARYINGS_ADDRESS(
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_varying_info, LIMA_CTX_BUFF_SUBMIT_GP),
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_varying_info),
num_outputs);
unsigned num = info->index_size ? (ctx->max_index - ctx->min_index + 1) : info->count;
@@ -870,7 +870,7 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
PLBU_CMD_PRIMITIVE_SETUP(force_point_size, cull, info->index_size);
PLBU_CMD_RSW_VERTEX_ARRAY(
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw, LIMA_CTX_BUFF_SUBMIT_PP),
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw),
ctx->gp_output->va);
/* TODO
@@ -1265,14 +1265,14 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
if (ctx->tex_stateobj.num_samplers) {
render->textures_address =
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc, LIMA_CTX_BUFF_SUBMIT_PP);
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc);
render->aux0 |= ctx->tex_stateobj.num_samplers << 14;
render->aux0 |= 0x20;
}
if (ctx->const_buffer[PIPE_SHADER_FRAGMENT].buffer) {
render->uniforms_address =
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform_array, LIMA_CTX_BUFF_SUBMIT_PP);
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform_array);
uint32_t size = ctx->buffer_state[lima_ctx_buff_pp_uniform].size;
uint32_t bits = 0;
if (size >= 8) {
@@ -1321,10 +1321,10 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
lima_dump_command_stream_print(
render, sizeof(*render), false, "add render state at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw));
- lima_dump_rsw_command_stream_print(render, sizeof(*render),
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw, 0));
+ lima_dump_rsw_command_stream_print(
+ render, sizeof(*render), lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw));
}
@@ -1360,7 +1360,7 @@ lima_update_gp_attribute_info(struct lima_context *ctx, const struct pipe_draw_i
lima_dump_command_stream_print(
attribute, n * 4, false, "update attribute info at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_attribute_info, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_attribute_info));
}
static void
@@ -1391,7 +1391,7 @@ lima_update_gp_uniform(struct lima_context *ctx)
lima_dump_command_stream_print(
vs_const_buff, size, true,
"update gp uniform at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_uniform, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_uniform));
}
static void
@@ -1413,14 +1413,14 @@ lima_update_pp_uniform(struct lima_context *ctx)
for (int i = 0; i < const_buff_size; i++)
fp16_const_buff[i] = util_float_to_half(const_buff[i]);
- *array = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform, LIMA_CTX_BUFF_SUBMIT_PP);
+ *array = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform);
lima_dump_command_stream_print(
fp16_const_buff, const_buff_size * 2, false, "add pp uniform data at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform));
lima_dump_command_stream_print(
array, 4, false, "add pp uniform info at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform_array, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform_array));
}
static void
@@ -1502,7 +1502,7 @@ lima_update_varying(struct lima_context *ctx, const struct pipe_draw_info *info)
lima_dump_command_stream_print(
varying, n * 4, false, "update varying info at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_gp_varying_info, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_gp_varying_info));
}
static void
@@ -1778,8 +1778,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_vs_cmd, vs_cmd_size);
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_CTX_BUFF_SUBMIT_GP);
+ 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);
@@ -1790,8 +1789,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size);
memcpy(plbu_cmd, util_dynarray_begin(&ctx->plbu_cmd_array), plbu_cmd_size);
util_dynarray_clear(&ctx->plbu_cmd_array);
- plbu_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_plbu_cmd,
- LIMA_CTX_BUFF_SUBMIT_GP);
+ 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);
@@ -1837,8 +1835,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame)
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_CTX_BUFF_SUBMIT_PP);
+ pp_stack_va = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_stack);
}
lima_update_pp_stream(ctx);
diff --git a/src/gallium/drivers/lima/lima_texture.c b/src/gallium/drivers/lima/lima_texture.c
index 793b8f31b8f..64e7d1823d5 100644
--- a/src/gallium/drivers/lima/lima_texture.c
+++ b/src/gallium/drivers/lima/lima_texture.c
@@ -287,18 +287,17 @@ lima_update_textures(struct lima_context *ctx)
struct lima_sampler_view *texture = lima_sampler_view(lima_tex->textures[i]);
unsigned desc_size = lima_calc_tex_desc_size(texture);
- descs[i] = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc,
- LIMA_CTX_BUFF_SUBMIT_PP) + offset;
+ descs[i] = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc) + offset;
lima_update_tex_desc(ctx, sampler, texture, (void *)descs + offset, desc_size);
offset += desc_size;
}
lima_dump_command_stream_print(
descs, size, false, "add textures_desc at va %x\n",
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc, 0));
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc));
lima_dump_texture_descriptor(
descs, size,
- lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc, 0) + lima_tex_list_size,
+ lima_ctx_buff_va(ctx, lima_ctx_buff_pp_tex_desc) + lima_tex_list_size,
lima_tex_list_size);
}