freedreno: Lock access to msm_pipe for RB object suballocation.

Hopefully this fixes the flakes that have happened since the suballoc
changes.

Fixes: 737d4caa83 ("freedreno: Suballocate our long-lived ring objects.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12002>
This commit is contained in:
Emma Anholt
2021-07-21 11:50:24 -07:00
committed by Marge Bot
parent af0fa5016d
commit b1dbbc3dc1
+9
View File
@@ -828,6 +828,13 @@ msm_ringbuffer_sp_new_object(struct fd_pipe *pipe, uint32_t size)
struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
struct msm_ringbuffer_sp *msm_ring = malloc(sizeof(*msm_ring));
/* Lock access to the msm_pipe->suballoc_* since ringbuffer object allocation
* can happen both on the frontend (most CSOs) and the driver thread (a6xx
* cached tex state, for example)
*/
static simple_mtx_t suballoc_lock = _SIMPLE_MTX_INITIALIZER_NP;
simple_mtx_lock(&suballoc_lock);
/* Maximum known alignment requirement is a6xx's TEX_CONST at 16 dwords */
msm_ring->offset = align(msm_pipe->suballoc_offset, 64);
if (!msm_pipe->suballoc_bo ||
@@ -845,5 +852,7 @@ msm_ringbuffer_sp_new_object(struct fd_pipe *pipe, uint32_t size)
msm_pipe->suballoc_offset = msm_ring->offset + size;
simple_mtx_unlock(&suballoc_lock);
return msm_ringbuffer_sp_init(msm_ring, size, _FD_RINGBUFFER_OBJECT);
}