This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit e6e9c45892990d065509b31bdf77a512c099ecea
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Mar 9 13:24:18 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Mar 28 18:50:14 2026 +0100

    swscale/ops_dispatch: try again with split subpasses if compile() fails
    
    First, we try compiling the filter pass as-is; in case any backends decide 
to
    handle the filter as a single pass. (e.g. Vulkan, which will want to compile
    such using internal temporary buffers and barriers)
    
    If that fails, retry with a chained list of split passes.
    
    Sponsored-by: Sovereign Tech Fund
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/ops_dispatch.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index 70f6f7d24d..c1893f3db8 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -471,6 +471,7 @@ fail:
 int ff_sws_compile_pass(SwsGraph *graph, SwsOpList **pops, int flags,
                         SwsPass *input, SwsPass **output)
 {
+    const int passes_orig = graph->num_passes;
     SwsContext *ctx = graph->ctx;
     SwsOpList *ops = *pops;
     int ret = 0;
@@ -499,12 +500,45 @@ int ff_sws_compile_pass(SwsGraph *graph, SwsOpList 
**pops, int flags,
     }
 
     ret = compile(graph, ops, input, output);
+    if (ret != AVERROR(ENOTSUP))
+        goto out;
+
+    av_log(ctx, AV_LOG_DEBUG, "Retrying with separated filter passes.\n");
+    SwsPass *prev = input;
+    while (ops) {
+        SwsOpList *rest;
+        ret = ff_sws_op_list_subpass(ops, &rest);
+        if (ret < 0)
+            goto out;
+
+        if (prev == input && !rest) {
+            /* No point in compiling an unsplit pass again */
+            ret = AVERROR(ENOTSUP);
+            goto out;
+        }
+
+        ret = compile(graph, ops, prev, &prev);
+        if (ret < 0) {
+            ff_sws_op_list_free(&rest);
+            goto out;
+        }
+
+        ff_sws_op_list_free(&ops);
+        ops = rest;
+    }
+
+    /* Return last subpass successfully compiled */
+    av_log(ctx, AV_LOG_VERBOSE, "Using %d separate passes.\n",
+           graph->num_passes - passes_orig);
+    *output = prev;
 
 out:
     if (ret == AVERROR(ENOTSUP)) {
         av_log(ctx, AV_LOG_WARNING, "No backend found for operations:\n");
         ff_sws_op_list_print(ctx, AV_LOG_WARNING, AV_LOG_TRACE, ops);
     }
+    if (ret < 0)
+        ff_sws_graph_rollback(graph, passes_orig);
     ff_sws_op_list_free(&ops);
     *pops = NULL;
     return ret;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to