From c102e89448a06d9920920923a4008fee3db4ea37 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 14 Mar 2026 17:32:55 +0100 Subject: [PATCH] hwcontext_vulkan: deprecate AVVulkanDeviceContext.lock/unlock_queue Without replacement, as VK_KHR_internally_synchronized_queues will be required. --- doc/APIchanges | 4 ++++ fftools/ffplay_renderer.c | 21 +++++++++++++++++++++ libavfilter/vf_libplacebo.c | 8 ++++++++ libavutil/hwcontext_vulkan.c | 4 ++++ libavutil/hwcontext_vulkan.h | 8 ++++++++ libavutil/version.h | 3 ++- libavutil/vulkan.c | 8 ++++++++ 7 files changed, 55 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index f540a99831..05771beb11 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2026-03-14 - xxxxxxxxxx - lavu 60.29.100 - hwcontext_vulkan.h + Deprecate AVVulkanDeviceContext.lock_queue and + AVVulkanDeviceContext.unlock_queue without replacement. + 2026-03-12 - xxxxxxxxxx - lsws 9.7.100 - swscale.h Add enum SwsScaler, and SwsContext.scaler/scaler_sub. diff --git a/fftools/ffplay_renderer.c b/fftools/ffplay_renderer.c index 335c286c65..e7fa7197cb 100644 --- a/fftools/ffplay_renderer.c +++ b/fftools/ffplay_renderer.c @@ -43,6 +43,7 @@ #include "libavutil/bprint.h" #include "libavutil/mem.h" +#include "libavutil/internal.h" #endif @@ -115,14 +116,22 @@ static void hwctx_lock_queue(void *priv, uint32_t qf, uint32_t qidx) { AVHWDeviceContext *avhwctx = priv; const AVVulkanDeviceContext *hwctx = avhwctx->hwctx; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS hwctx->lock_queue(avhwctx, qf, qidx); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static void hwctx_unlock_queue(void *priv, uint32_t qf, uint32_t qidx) { AVHWDeviceContext *avhwctx = priv; const AVVulkanDeviceContext *hwctx = avhwctx->hwctx; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS hwctx->unlock_queue(avhwctx, qf, qidx); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static int add_instance_extension(const char **ext, unsigned num_ext, @@ -283,7 +292,11 @@ static void placebo_lock_queue(struct AVHWDeviceContext *dev_ctx, { RendererContext *ctx = dev_ctx->user_opaque; pl_vulkan vk = ctx->placebo_vulkan; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS vk->lock_queue(vk, queue_family, index); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx, @@ -292,7 +305,11 @@ static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx, { RendererContext *ctx = dev_ctx->user_opaque; pl_vulkan vk = ctx->placebo_vulkan; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS vk->unlock_queue(vk, queue_family, index); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static int get_decode_queue(VkRenderer *renderer, int *index, int *count) @@ -386,8 +403,12 @@ static int create_vk_by_placebo(VkRenderer *renderer, device_ctx->user_opaque = ctx; vk_dev_ctx = device_ctx->hwctx; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS vk_dev_ctx->lock_queue = placebo_lock_queue; vk_dev_ctx->unlock_queue = placebo_unlock_queue; +FF_ENABLE_DEPRECATION_WARNINGS +#endif vk_dev_ctx->get_proc_addr = ctx->placebo_instance->get_proc_addr; diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 48bf37fb2e..316eca37ec 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -667,14 +667,22 @@ static void lock_queue(void *priv, uint32_t qf, uint32_t qidx) { AVHWDeviceContext *avhwctx = priv; const AVVulkanDeviceContext *hwctx = avhwctx->hwctx; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS hwctx->lock_queue(avhwctx, qf, qidx); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static void unlock_queue(void *priv, uint32_t qf, uint32_t qidx) { AVHWDeviceContext *avhwctx = priv; const AVVulkanDeviceContext *hwctx = avhwctx->hwctx; +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS hwctx->unlock_queue(avhwctx, qf, qidx); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } #endif diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 6c104b7204..65e2256e2d 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2119,10 +2119,14 @@ FF_ENABLE_DEPRECATION_WARNINGS p->img_qfs[p->nb_img_qfs++] = hwctx->qf[i].idx; } +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS if (!hwctx->lock_queue) hwctx->lock_queue = lock_queue; if (!hwctx->unlock_queue) hwctx->unlock_queue = unlock_queue; +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* Re-query device capabilities, in case the device was created externally */ vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops); diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h index 77d53289b4..b9a841a197 100644 --- a/libavutil/hwcontext_vulkan.h +++ b/libavutil/hwcontext_vulkan.h @@ -168,18 +168,26 @@ typedef struct AVVulkanDeviceContext { int nb_decode_queues; #endif +#if FF_API_VULKAN_SYNC_QUEUES /** * Locks a queue, preventing other threads from submitting any command * buffers to this queue. * If set to NULL, will be set to lavu-internal functions that utilize a * mutex. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. */ + attribute_deprecated void (*lock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index); /** * Similar to lock_queue(), unlocks a queue. Must only be called after locking. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. */ + attribute_deprecated void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index); +#endif /** * Queue families used. Must be preferentially ordered. List may contain diff --git a/libavutil/version.h b/libavutil/version.h index b840a8aca2..6e2abf2ebf 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 60 -#define LIBAVUTIL_VERSION_MINOR 28 +#define LIBAVUTIL_VERSION_MINOR 29 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -113,6 +113,7 @@ #define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61) #define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61) #define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_SYNC_QUEUES (LIBAVUTIL_VERSION_MAJOR < 62) /** * @} diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index b6cbdf73a7..ff24b956cd 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -928,9 +928,17 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e) return AVERROR_EXTERNAL; } +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS s->hwctx->lock_queue(s->device, e->qf, e->qi); +FF_ENABLE_DEPRECATION_WARNINGS +#endif ret = vk->QueueSubmit2(e->queue, 1, &submit_info, e->fence); +#if FF_API_VULKAN_SYNC_QUEUES +FF_DISABLE_DEPRECATION_WARNINGS s->hwctx->unlock_queue(s->device, e->qf, e->qi); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (ret != VK_SUCCESS) { av_log(s, AV_LOG_ERROR, "Unable to submit command buffer: %s\n",