Mesa (master): lima: remove its hash table entry when invalidating a resource

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 24 21:29:27 UTC 2020


Module: Mesa
Branch: master
Commit: 6499738d3dee2c2420f8d2207442f57c432d9510
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6499738d3dee2c2420f8d2207442f57c432d9510

Author: Icenowy Zheng <icenowy at aosc.io>
Date:   Sat Feb 22 16:54:56 2020 +0800

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 <icenowy at aosc.io>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Reviewed-by: Qiang Yu <yuq825 at gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3917>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3917>

---

 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 f5d62c9d6d0..9538f9a24e7 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



More information about the mesa-commit mailing list