From 6499738d3dee2c2420f8d2207442f57c432d9510 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Sat, 22 Feb 2020 16:54:56 +0800 Subject: [PATCH] lima: remove its hash table entry when invalidating a resource When a resouce is already invalidated, its hash table entry becomes useless. In addition, the lima_job_free() function won't remove the hash table entry for invalidated resource. So the hash entry should be removed when invalidating the resource, otherwise bogus hash entry might be left in the table, and when the resource is reused in another job, the code will find the freed job when invalidating and thus result in crash. Fixes: c64994433c0d ("lima: track write submits of context (v3)") Signed-off-by: Icenowy Zheng Reviewed-by: Vasily Khoruzhick Reviewed-by: Qiang Yu Tested-by: Marge Bot Part-of: --- src/gallium/drivers/lima/lima_context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c index f5d62c9..9538f9a 100644 --- a/src/gallium/drivers/lima/lima_context.c +++ b/src/gallium/drivers/lima/lima_context.c @@ -118,6 +118,8 @@ lima_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc) if (job->key.cbuf && (job->key.cbuf->texture == prsc)) job->resolve &= ~PIPE_CLEAR_COLOR0; + + _mesa_hash_table_remove_key(ctx->write_jobs, prsc); } static void -- 2.7.4