From 8e1330d60cb94629cbc09f65f558d47cdbfe633b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 22 Apr 2022 00:45:42 -0700 Subject: modules/montage: stop assuming modules don't fragment There's been a longstanding todo item in montage where it was ignoring the fragmenter returned by a module's prepare_frame(). This commit continues with the single-threaded rendering of the modules within their respective tiles, still ad-hoc open coded. But now actually applies the fragmenter returned as if the rendering were being threaded, since when a module returns a fragmenter from its prepare_frame() it may strongly depend on that fragmenting for its output. --- src/modules/montage/montage.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index a45a32c..521ccfd 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -198,27 +198,21 @@ static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, return; } - /* since we're *already* in a threaded render of tiles, no further * threading within the montage tiles is desirable, so the per-module * render is done explicitly serially here in an open-coded ad-hoc * fashion for now. FIXME TODO: move this into rototiller.c */ if (module->prepare_frame) { - til_fragmenter_t unused; - - /* XXX FIXME: ignoring the fragmenter here is a violation of the module API, - * rototiller.c should have a module render interface with explicit non-threading - * that still does all the necessary fragmenting as needed. - * - * Today, I can get away with this, because montage is the only module that's - * sensitive to this aspect of the API and it skips itself. - */ + til_fragmenter_t fragmenter; + unsigned fragnum = 0; + til_fb_fragment_t frag; - module->prepare_frame(ctxt->contexts[fragment->number], ticks, 1, fragment, &unused); - } + module->prepare_frame(ctxt->contexts[fragment->number], ticks, 1, fragment, &fragmenter); - if (module->render_fragment) - module->render_fragment(ctxt->contexts[fragment->number], ticks, 0, fragment); + while (fragmenter(ctxt->contexts[fragment->number], fragment, fragnum++, &frag)) + module->render_fragment(ctxt->contexts[fragment->number], ticks, fragnum, &frag); + } else if (module->render_fragment) + module->render_fragment(ctxt->contexts[fragment->number], ticks, 0, fragment); } -- cgit v1.2.3