freedreno: driver-thread annotations

Graphics / Mesa 3D Graphics Library / Mesa - Rob Clark [chromium.org] - 18 February 2021 00:27 UTC

Use clangs thread-safety annotations to implement a virtual lock protecting context fields that should only be accessed from driver-thread. This should let the compiler help us detect problems where ctx is used unsafely from things that could be called by the fe/st thread.

This does end up sprinkled far and wide, it would be nice if the compiler could be a bit smarter about understanding call-graphs (at least with static fxns), but at least it makes it clear where things are called from which thread.

3f776046238 freedreno: driver-thread annotations
src/gallium/drivers/freedreno/a2xx/fd2_context.c | 1 +
src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 13 +-
src/gallium/drivers/freedreno/a2xx/fd2_emit.h | 4 +-
src/gallium/drivers/freedreno/a2xx/fd2_gmem.c | 5 +
src/gallium/drivers/freedreno/a2xx/fd2_program.c | 6 +-
src/gallium/drivers/freedreno/a2xx/fd2_program.h | 2 +-
src/gallium/drivers/freedreno/a2xx/fd2_query.c | 3 +
src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 3 +
src/gallium/drivers/freedreno/a3xx/fd3_context.c | 1 +
src/gallium/drivers/freedreno/a3xx/fd3_draw.c | 4 +
src/gallium/drivers/freedreno/a3xx/fd3_emit.h | 7 +-
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c | 9 ++
src/gallium/drivers/freedreno/a3xx/fd3_query.c | 1 +
src/gallium/drivers/freedreno/a4xx/fd4_context.c | 1 +
src/gallium/drivers/freedreno/a4xx/fd4_draw.c | 4 +
src/gallium/drivers/freedreno/a4xx/fd4_emit.h | 6 +-
src/gallium/drivers/freedreno/a4xx/fd4_gmem.c | 8 ++
src/gallium/drivers/freedreno/a4xx/fd4_query.c | 3 +
src/gallium/drivers/freedreno/a5xx/fd5_blitter.c | 1 +
src/gallium/drivers/freedreno/a5xx/fd5_compute.c | 2 +
src/gallium/drivers/freedreno/a5xx/fd5_context.c | 2 +
src/gallium/drivers/freedreno/a5xx/fd5_draw.c | 5 +
src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 2 +
src/gallium/drivers/freedreno/a5xx/fd5_emit.h | 12 +-
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c | 7 +
src/gallium/drivers/freedreno/a5xx/fd5_query.c | 5 +
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c | 7 +
src/gallium/drivers/freedreno/a6xx/fd6_blitter.h | 4 +-
src/gallium/drivers/freedreno/a6xx/fd6_compute.c | 4 +-
src/gallium/drivers/freedreno/a6xx/fd6_const.c | 3 +
src/gallium/drivers/freedreno/a6xx/fd6_const.h | 10 +-
src/gallium/drivers/freedreno/a6xx/fd6_context.c | 2 +
src/gallium/drivers/freedreno/a6xx/fd6_draw.c | 5 +
src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 13 +-
src/gallium/drivers/freedreno/a6xx/fd6_emit.h | 6 +-
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c | 7 +
src/gallium/drivers/freedreno/a6xx/fd6_image.h | 6 +-
src/gallium/drivers/freedreno/a6xx/fd6_program.c | 4 +-
src/gallium/drivers/freedreno/a6xx/fd6_program.h | 4 +-
src/gallium/drivers/freedreno/a6xx/fd6_query.c | 9 ++
.../drivers/freedreno/a6xx/fd6_rasterizer.h | 1 +
src/gallium/drivers/freedreno/a6xx/fd6_resource.c | 1 +
src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 2 +
src/gallium/drivers/freedreno/a6xx/fd6_texture.h | 3 +-
src/gallium/drivers/freedreno/a6xx/fd6_zsa.h | 1 +
src/gallium/drivers/freedreno/freedreno_batch.c | 5 +
src/gallium/drivers/freedreno/freedreno_batch.h | 18 +--
.../drivers/freedreno/freedreno_batch_cache.c | 3 +
.../drivers/freedreno/freedreno_batch_cache.h | 10 +-
src/gallium/drivers/freedreno/freedreno_blitter.c | 3 +
src/gallium/drivers/freedreno/freedreno_blitter.h | 8 +-
src/gallium/drivers/freedreno/freedreno_context.c | 11 ++
src/gallium/drivers/freedreno/freedreno_context.h | 158 +++++++++++----------
src/gallium/drivers/freedreno/freedreno_draw.c | 8 ++
src/gallium/drivers/freedreno/freedreno_fence.c | 2 +
src/gallium/drivers/freedreno/freedreno_gmem.c | 2 +
src/gallium/drivers/freedreno/freedreno_gmem.h | 2 +-
src/gallium/drivers/freedreno/freedreno_program.c | 5 +
src/gallium/drivers/freedreno/freedreno_query.c | 5 +
src/gallium/drivers/freedreno/freedreno_query.h | 8 +-
.../drivers/freedreno/freedreno_query_acc.c | 15 +-
.../drivers/freedreno/freedreno_query_acc.h | 6 +-
src/gallium/drivers/freedreno/freedreno_query_hw.c | 15 +-
src/gallium/drivers/freedreno/freedreno_query_hw.h | 12 +-
src/gallium/drivers/freedreno/freedreno_query_sw.c | 3 +
src/gallium/drivers/freedreno/freedreno_resource.c | 12 ++
src/gallium/drivers/freedreno/freedreno_resource.h | 6 +-
src/gallium/drivers/freedreno/freedreno_state.c | 25 ++++
src/gallium/drivers/freedreno/freedreno_state.h | 4 +
src/gallium/drivers/freedreno/freedreno_texture.c | 2 +
src/gallium/drivers/freedreno/freedreno_util.h | 60 ++++++++
src/gallium/drivers/freedreno/ir3/ir3_const.h | 5 +
72 files changed, 472 insertions(+), 150 deletions(-)

Upstream: cgit.freedesktop.org


  • Share