vulkan/queue: Add a submit mode enum

This encapsulates all three possible submit modes: immediate, deferred,
and threaded.  It's more clear than the has_thread boolean combined with
device-level checks.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15566>
This commit is contained in:
Jason Ekstrand
2022-03-24 17:05:08 -05:00
committed by Marge Bot
parent 97f17d4b38
commit 9ddab162b7
4 changed files with 111 additions and 35 deletions
+17 -2
View File
@@ -24,7 +24,7 @@
#ifndef VK_QUEUE_H
#define VK_QUEUE_H
#include "vk_object.h"
#include "vk_device.h"
#include "c11/threads.h"
@@ -72,6 +72,22 @@ struct vk_queue {
struct vk_queue_submit *submit);
struct {
/** Current submit mode
*
* This represents the exact current submit mode for this specific queue
* which may be different from `vk_device::submit_mode`. In particular,
* this will never be `VK_QUEUE_SUBMIT_MODE_THREADED_ON_DEMAND`.
* Instead, when the device submit mode is
* `VK_QUEUE_SUBMIT_MODE_THREADED_ON_DEMAND`, the queue submit mode
* will be one of `VK_QUEUE_SUBMIT_MODE_THREADED` or
* `VK_QUEUE_SUBMIT_MODE_IMMEDIATE` depending on whether or not a submit
* thread is currently running for this queue. If the device submit
* mode is `VK_QUEUE_SUBMIT_MODE_DEFERRED`, every queue in the device
* will use `VK_QUEUE_SUBMIT_MODE_DEFERRED` because the deferred submit
* model depends on regular flushing instead of independent threads.
*/
enum vk_queue_submit_mode mode;
mtx_t mutex;
cnd_t push;
cnd_t pop;
@@ -79,7 +95,6 @@ struct vk_queue {
struct list_head submits;
bool thread_run;
bool has_thread;
thrd_t thread;
} submit;