From: Niklas Haas <code@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: whitelist properties on linear blend tex (PR #20164) Date: Thu, 7 Aug 2025 22:22:30 +0300 (EEST) Message-ID: <20250807192230.7823468D245@ffbox0-bg.ffmpeg.org> (raw) 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 <git@haasn.dev> 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 <git@haasn.dev> 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".
reply other threads:[~2025-08-07 19:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250807192230.7823468D245@ffbox0-bg.ffmpeg.org \ --to=code@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git