From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9517B44E2C for ; Mon, 29 May 2023 11:00:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A6E0B68C19E; Mon, 29 May 2023 14:00:01 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6F0F268C112 for ; Mon, 29 May 2023 13:59:55 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 5CF0B42B7B; Mon, 29 May 2023 12:59:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1685357994; bh=2k/W7mhE95uDbVr4APJuMAGKLyGE7mViKu08t7cdbbA=; h=From:To:Cc:Subject:Date:From; b=KpA96gsiye8/yiXeskRdCNL9xln/8u0i8cK5PCq252nMycrYpaPrHnVWRs7jG1cxH 2h1CukUmtW8Zifnc29ayIka+UlvFAYi5SvQVpuYpAJxzTAU/dnnVrwhoREQyY/DHNa 1dLE9GZ47Jm7p51rsy0WBBP2FBU1/10Pi4wdm60w= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 May 2023 12:59:52 +0200 Message-Id: <20230529105952.24077-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: require v5.278 for importing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas Importing Vulkan device on older versions no longer works due to the lavu vulkan API changes (specifically, the switch to planar textures by default). Additionally, importing on versions that don't suppirt lock/unlock_queue is unsafe with the advent of the threaded vulkan hwaccel. As a plus, saves us some annoying #ifdef boilerplate. I will raise the minimum vf_libplacebo version globally on the next stable release of libplacebo, and remove all of these checks. --- libavfilter/vf_libplacebo.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 2b8dac09b06..0a849f86762 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -544,23 +544,15 @@ fail: return err; } -#if PL_API_VER >= 201 -# if PL_API_VER >= 278 +#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; @@ -576,6 +568,7 @@ static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwct size_t buf_len; if (hwctx) { +#if PL_API_VER >= 278 /* Import libavfilter vulkan context into libplacebo */ s->vulkan = pl_vulkan_import(s->log, pl_vulkan_import_params( .instance = hwctx->inst, @@ -585,11 +578,9 @@ 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, @@ -605,6 +596,13 @@ static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwct /* This is the highest version created by hwcontext_vulkan.c */ .max_api_version = VK_API_VERSION_1_3, )); +#else + av_log(s, AV_LOG_ERROR, "libplacebo version %s too old to import " + "Vulkan device, remove it or upgrade libplacebo to >= 5.278\n", + PL_VERSION); + err = AVERROR_EXTERNAL; + goto fail; +#endif } else { s->vulkan = pl_vulkan_create(s->log, pl_vulkan_params( .queue_count = 0, /* enable all queues for parallelization */ -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".