freedreno/drm: Userspace fences
authorRob Clark <robdclark@chromium.org>
Wed, 21 Apr 2021 16:37:05 +0000 (09:37 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 28 Apr 2021 15:36:42 +0000 (15:36 +0000)
commit7dabd62464982e545a094f22d9ca23a77730c536
tree602b9490b841b2725869a004bf4ea7174b520e07
parentdf78934cdf98c399b217d58f73c1d8d876f1585b
freedreno/drm: Userspace fences

Add a per-fd_pipe fence "timeline" so we can detect cases where we don't
need to call into the kernel to determine if a fd_bo is still busy.

This reuses table_lock, rather than introducing a per-bo lock to protect
fence state updates because (a) the common / hotpath pattern is to
update fences on a lot of objects, but checking the fence state of a
single object is less common, and (b) because we already hold the table
lock in common spots where we need to check the bo's fence state (ie.
allocations from the bo-cache).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10444>
src/freedreno/drm/freedreno_bo.c
src/freedreno/drm/freedreno_bo_cache.c
src/freedreno/drm/freedreno_drmif.h
src/freedreno/drm/freedreno_pipe.c
src/freedreno/drm/freedreno_priv.h
src/freedreno/drm/freedreno_ringbuffer.c
src/freedreno/drm/msm_ringbuffer.c
src/freedreno/drm/msm_ringbuffer_sp.c