Module: Mesa Branch: master Commit: 72390f063f2ce30b93edd9d640f75c867a60c567 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=72390f063f2ce30b93edd9d640f75c867a60c567
Author: cheyang <[email protected]> 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 <[email protected]> Reviewed-by: Gert Wollny <[email protected]> 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 _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
