radeonsi: fix crash in flush_resource when used with buffers

glWaitSemaphoreEXT triggers si_flush_resource callback
on pipe buffer resources, which may cause segmentation fault.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15098>
This commit is contained in:
jiadozhu 2019-07-30 05:21:02 -04:00 committed by Marge Bot
parent f968cb921d
commit c9097d8939
1 changed files with 2 additions and 1 deletions

View File

@ -1337,7 +1337,8 @@ static void si_flush_resource(struct pipe_context *ctx, struct pipe_resource *re
struct si_context *sctx = (struct si_context *)ctx;
struct si_texture *tex = (struct si_texture *)res;
assert(res->target != PIPE_BUFFER);
if (res->target == PIPE_BUFFER)
return;
if (!tex->is_depth && (tex->cmask_buffer || vi_dcc_enabled(tex, 0))) {
si_blit_decompress_color(sctx, tex, 0, res->last_level, 0, util_max_layer(res, 0),