lima: always add texture bo to submit

No matter texture desc change, we need to add texture to submit.
Otherwise texture may be freed before submit finish.

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>
This commit is contained in:
Qiang Yu 2020-02-11 10:32:38 +08:00 committed by Marge Bot
parent 3c4ff27250
commit 9f924c795b
2 changed files with 12 additions and 4 deletions

View File

@ -1535,8 +1535,7 @@ lima_draw_vbo_update(struct pipe_context *pctx,
ctx->const_buffer[PIPE_SHADER_FRAGMENT].dirty = false;
}
if (ctx->dirty & LIMA_CONTEXT_DIRTY_TEXTURES)
lima_update_textures(ctx);
lima_update_textures(ctx);
lima_pack_render_state(ctx, info);
lima_pack_plbu_cmd(ctx, info);

View File

@ -95,8 +95,6 @@ lima_texture_desc_set_res(struct lima_context *ctx, lima_tex_desc *desc,
layout = 0;
}
lima_submit_add_bo(ctx->pp_submit, lima_res->bo, LIMA_SUBMIT_BO_READ);
uint32_t base_va = lima_res->bo->va;
/* attach first level */
@ -263,6 +261,17 @@ lima_update_textures(struct lima_context *ctx)
if (!lima_tex->num_samplers || !lima_tex->num_textures)
return;
/* we always need to add texture bo to submit */
for (int i = 0; i < lima_tex->num_samplers; i++) {
struct lima_sampler_view *texture = lima_sampler_view(lima_tex->textures[i]);
struct lima_resource *rsc = lima_resource(texture->base.texture);
lima_submit_add_bo(ctx->pp_submit, rsc->bo, LIMA_SUBMIT_BO_READ);
}
/* do not regenerate texture desc if no change */
if (!(ctx->dirty & LIMA_CONTEXT_DIRTY_TEXTURES))
return;
unsigned size = lima_tex_list_size;
for (int i = 0; i < lima_tex->num_samplers; i++) {
struct lima_sampler_view *texture = lima_sampler_view(lima_tex->textures[i]);