summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_private.h
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-10-22 10:18:06 +0200
committerBas Nieuwenhuizen <[email protected]>2019-10-30 11:57:07 +0100
commit88d41367b8aee961e6c47173a1e8848009e2215a (patch)
tree3113b4f24722b59dbed958ee8c77b82af1434995 /src/amd/vulkan/radv_private.h
parent2117c53b72323b18d5a1a8893d0a65a6fe94dff4 (diff)
radv: Add timelines with a VK_KHR_timeline_semaphore impl.
This does not fully do wait-before-submit, to be done in a follow up patch. For kernels without support for timeline syncobjs, this adds an implementation of non-shareable timelines using legacy syncobjs. Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_private.h')
-rw-r--r--src/amd/vulkan/radv_private.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index ef7ba34c85b..6eb4e5fbe3f 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -820,6 +820,10 @@ struct radv_device {
int force_aniso;
struct radv_secure_compile_state *sc_state;
+
+ /* Condition variable for legacy timelines, to notify waiters when a
+ * new point gets submitted. */
+ pthread_cond_t timeline_cond;
};
struct radv_device_memory {
@@ -2168,13 +2172,40 @@ typedef enum {
RADV_SEMAPHORE_NONE,
RADV_SEMAPHORE_WINSYS,
RADV_SEMAPHORE_SYNCOBJ,
+ RADV_SEMAPHORE_TIMELINE,
} radv_semaphore_kind;
+struct radv_timeline_point {
+ struct list_head list;
+
+ uint64_t value;
+ uint32_t syncobj;
+
+ /* Separate from the list to accomodate CPU wait being async, as well
+ * as prevent point deletion during submission. */
+ unsigned wait_count;
+};
+
+struct radv_timeline {
+ /* Using a pthread mutex to be compatible with condition variables. */
+ pthread_mutex_t mutex;
+
+ uint64_t highest_signaled;
+ uint64_t highest_submitted;
+
+ struct list_head points;
+
+ /* Keep free points on hand so we do not have to recreate syncobjs all
+ * the time. */
+ struct list_head free_points;
+};
+
struct radv_semaphore_part {
radv_semaphore_kind kind;
union {
uint32_t syncobj;
struct radeon_winsys_sem *ws_sem;
+ struct radv_timeline timeline;
};
};