virgl: use atomic operations when increase sub_ctx_id
Use atomic operations to avoid competition. In addition, since sub_ctx_id 0 has been used by default, sub_ctx_id should start from 1. Signed-off-by: Xin He <hexin.op@bytedance.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9406>
This commit is contained in:
parent
367a93830b
commit
97b196b921
|
@ -1623,7 +1623,7 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
|
|||
vctx->supports_staging = true;
|
||||
}
|
||||
|
||||
vctx->hw_sub_ctx_id = rs->sub_ctx_id++;
|
||||
vctx->hw_sub_ctx_id = p_atomic_inc_return(&rs->sub_ctx_id);
|
||||
virgl_encoder_create_sub_ctx(vctx, vctx->hw_sub_ctx_id);
|
||||
|
||||
virgl_encoder_set_sub_ctx(vctx, vctx->hw_sub_ctx_id);
|
||||
|
|
Loading…
Reference in New Issue