From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 5EEBF4CADD for ; Thu, 7 Aug 2025 19:22:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7823468D245; Thu, 7 Aug 2025 22:22:30 +0300 (EEST) Received: from 0f9ae49ae7c8 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 8ADEC68D203 for ; Thu, 7 Aug 2025 22:22:28 +0300 (EEST) MIME-Version: 1.0 From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avfilter/vf=5Flibplacebo=3A?= =?utf-8?q?_whitelist_properties_on_linear_blend_tex_=28PR_=2320164=29?= 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250807192230.7823468D245@ffbox0-bg.ffmpeg.org> Date: Thu, 7 Aug 2025 22:22:30 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20164 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20164 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20164.patch Instead of copying over the entire target and changing a few fields, set the entire struct to a whitelist of safe properties that we want to persist on the intermediate texture. In particular, this avoids leaking irrelevant state related to the acquire/release callbacks, e.g., which can otherwise cause deadlocks when the same vulkan frame is attempted to be acquired twice. >From 16ec009d13e8dc53343c833cf1677d1e710b900c Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 7 Aug 2025 21:18:45 +0200 Subject: [PATCH 1/2] avfilter/vf_libplacebo: whitelist properties on linear blend tex Instead of copying over the entire target and changing a few fields, set the entire struct to a whitelist of safe properties that we want to persist on the intermediate texture. In particular, this avoids leaking irrelevant state related to the acquire/release callbacks, e.g., which can otherwise cause deadlocks when the same vulkan frame is attempted to be acquired twice. --- libavfilter/vf_libplacebo.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index aecf28c40c..40f9ec2bba 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -990,15 +990,19 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) struct pl_frame orig_target = target; bool use_linear_compositor = false; if (s->linear_tex && target.color.transfer != PL_COLOR_TRC_LINEAR && !s->disable_linear) { - use_linear_compositor = true; - target.color.transfer = PL_COLOR_TRC_LINEAR; - target.repr = pl_color_repr_rgb; - target.num_planes = 1; - target.planes[0] = (struct pl_plane) { - .components = 4, - .component_mapping = {0, 1, 2, 3}, - .texture = s->linear_tex, + target = (struct pl_frame) { + .num_planes = 1, + .planes[0] = { + .components = 4, + .component_mapping = {0, 1, 2, 3}, + .texture = s->linear_tex, + }, + .repr = pl_color_repr_rgb, + .color = orig_target.color, + .rotation = orig_target.rotation, }; + target.color.transfer = PL_COLOR_TRC_LINEAR; + use_linear_compositor = true; } /* Draw first frame opaque, others with blending */ -- 2.49.1 >From 2e64f0fc258eed90f4cc5da4e9b11549d9a59fe7 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 7 Aug 2025 21:21:28 +0200 Subject: [PATCH 2/2] avfilter/vf_libplacebo: simplify unnecessary indirection in->idx is equal to the array index by definition, so just use the loop index directly. --- libavfilter/vf_libplacebo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 40f9ec2bba..7e30524455 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -1014,7 +1014,7 @@ static int output_frame(AVFilterContext *ctx, int64_t pts) #endif for (int i = 0; i < s->nb_inputs; i++) { LibplaceboInput *in = &s->inputs[i]; - FilterLink *il = ff_filter_link(ctx->inputs[in->idx]); + FilterLink *il = ff_filter_link(ctx->inputs[i]); FilterLink *ol = ff_filter_link(outlink); int high_fps = av_cmp_q(il->frame_rate, ol->frame_rate) >= 0; if (in->qstatus != PL_QUEUE_OK) @@ -1175,7 +1175,7 @@ static int libplacebo_activate(AVFilterContext *ctx) if (av_fifo_peek(in->out_pts, &pts, 1, 0) >= 0) { out_pts = FFMIN(out_pts, pts); } else if (!in->status) { - ff_inlink_request_frame(ctx->inputs[in->idx]); + ff_inlink_request_frame(ctx->inputs[i]); retry = true; } } @@ -1201,7 +1201,7 @@ static int libplacebo_activate(AVFilterContext *ctx) switch (in->qstatus) { case PL_QUEUE_MORE: - ff_inlink_request_frame(ctx->inputs[in->idx]); + ff_inlink_request_frame(ctx->inputs[i]); retry = true; break; case PL_QUEUE_OK: -- 2.49.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".