v3dv: implement occlusion queries

Graphics / Mesa 3D Graphics Library / Mesa - Iago Toral Quiroga [igalia.com] - 13 October 2020 21:21 UTC

The design for queries in Vulkan requires that some commands execute in the GPU as part of a command buffer. Unfortunately, V3D doesn't really have supprt for this, which means that we need to execute them in the CPU but we still need to make it look as if they happened inside the comamnd buffer from the point of view of the user, which adds certain hassle.

The above means that in some cases we need to do CPU waits for certain parts of the command buffer to execute so we can then run the CPU code. For exmaple, we need to wait before executing a query resets just in case the GPU is using them, and we have to do a CPU wait wait for previous GPU jobs to complete before copying query results if the user has asked us to do that. In the future, we may want to have submission thread instead so we don't block the main thread in these scenarios.

Because we now need to execute some tasks in the CPU as part of a command buffer, this introduces the concept of job types, there is one type for all GPU jobs, and then we have one type for each kind of job that needs to execute in the CPU. CPU jobs are executed by the queue in order just like GPU jobs, only that they are exclusively CPU tasks.

Part-of:

53657b0cb12 v3dv: implement occlusion queries
src/broadcom/vulkan/meson.build | 1 +
src/broadcom/vulkan/v3dv_cmd_buffer.c | 291 +++++++++++++++++++++++++++++-----
src/broadcom/vulkan/v3dv_device.c | 2 +-
src/broadcom/vulkan/v3dv_private.h | 100 ++++++++++++
src/broadcom/vulkan/v3dv_query.c | 261 ++++++++++++++++++++++++++++++
src/broadcom/vulkan/v3dv_queue.c | 104 +++++++++++-
6 files changed, 714 insertions(+), 45 deletions(-)

Upstream: cgit.freedesktop.org


  • Share