Mesa (master): virgl: next_handle variable modify to atomic inc in virgl_object_assign_handle
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Dec 28 10:34:20 UTC 2020
Module: Mesa
Branch: master
Commit: 72390f063f2ce30b93edd9d640f75c867a60c567
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72390f063f2ce30b93edd9d640f75c867a60c567
Author: cheyang <cheyang at bytedance.com>
Date: Sun Dec 13 11:52:02 2020 +0800
virgl: next_handle variable modify to atomic inc in virgl_object_assign_handle
virgl_object_assign_handle will be called by multiple threads,
if you do not use atomic operations, there may be duplicate handle.
Signed-off-by: cheyang <cheyang at bytedance.com>
Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8078>
---
src/gallium/drivers/virgl/virgl_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 067a89a1f2c..83e2f99c00c 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -58,7 +58,7 @@ struct virgl_vertex_elements_state {
static uint32_t next_handle;
uint32_t virgl_object_assign_handle(void)
{
- return ++next_handle;
+ return p_atomic_inc_return(&next_handle);
}
bool
More information about the mesa-commit
mailing list