aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-01-30 14:18:34 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:55 +0200
commit661db605db412681d18e6b44801cf4ea5e2aa13e (patch)
tree9e2cc8211d30824f04e703efeff81a6b982fd399
parentf70f873272c800feb8676650c8ce8dcfdf94108c (diff)
downloadffmpeg-661db605db412681d18e6b44801cf4ea5e2aa13e.tar.gz
avfilter/vf_libplacebo: forward queue locking primitives
For thread safety.
-rw-r--r--libavfilter/vf_libplacebo.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index adebcc4541..e28dddef4f 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -544,6 +544,30 @@ fail:
return err;
}
+#if PL_API_VER >= 201
+# if PL_API_VER >= 278
+static void lock_queue(void *priv, uint32_t qf, uint32_t qidx)
+# else
+static void lock_queue(void *priv, int qf, int qidx)
+# endif
+{
+ AVHWDeviceContext *avhwctx = priv;
+ const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
+ hwctx->lock_queue(avhwctx, qf, qidx);
+}
+
+# if PL_API_VER >= 278
+static void unlock_queue(void *priv, uint32_t qf, uint32_t qidx)
+# else
+static void unlock_queue(void *priv, int qf, int qidx)
+# endif
+{
+ AVHWDeviceContext *avhwctx = priv;
+ const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
+ hwctx->unlock_queue(avhwctx, qf, qidx);
+}
+#endif
+
static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwctx)
{
int err = 0;
@@ -561,6 +585,11 @@ static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwct
.extensions = hwctx->enabled_dev_extensions,
.num_extensions = hwctx->nb_enabled_dev_extensions,
.features = &hwctx->device_features,
+#if PL_API_VER >= 201
+ .lock_queue = lock_queue,
+ .unlock_queue = unlock_queue,
+ .queue_ctx = avctx->hw_device_ctx->data,
+#endif
.queue_graphics = {
.index = hwctx->queue_family_index,
.count = hwctx->nb_graphics_queues,