From 75bdc9a1563056582866f5bb370abee4c1a27538 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 21 Jul 2022 22:03:41 -0700 Subject: modules/{compose,rtv}: s/prepare_frame/render_fragment/ These modules have been doing their work in prepare_frame(), but aren't actually threaded modules and don't return a frame plan from prepare_frame() nor do they provide a render_fragment() to complement the prepare_frame(). The convention thus far has been that single-threaded modules just provide a render_fragment and by not providing a prepare_frame they will be executed serially. These two modules break the contract in a sense by using prepare_frame() without following up with render_fragment(). I'm not sure why it happened that way, maybe at one time prepare_frame() had access to some things that render_fragment() didn't. In any case, just make these use render_fragment() like any other simple non-threaded module would. This was actually causing a crash when n_cpus=1 because module_render_fragment() was assuming the prepare_frame() branch would include a render_fragment(). It should probably be asserting as such. --- src/modules/compose/compose.c | 6 +++--- src/modules/rtv/rtv.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index ed0ed1c..ff32ac4 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -49,7 +49,7 @@ typedef struct compose_setup_t { static til_module_context_t * compose_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup); static void compose_destroy_context(til_module_context_t *context); -static void compose_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan); +static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment); static int compose_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup); static compose_setup_t compose_default_setup = { @@ -60,7 +60,7 @@ static compose_setup_t compose_default_setup = { til_module_t compose_module = { .create_context = compose_create_context, .destroy_context = compose_destroy_context, - .prepare_frame = compose_prepare_frame, + .render_fragment = compose_render_fragment, .name = "compose", .description = "Layered modules compositor", .setup = compose_setup, @@ -125,7 +125,7 @@ static void compose_destroy_context(til_module_context_t *context) } -static void compose_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan) +static void compose_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment) { compose_context_t *ctxt = (compose_context_t *)context; diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index c90a824..3a8e7fc 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -63,7 +63,7 @@ typedef struct rtv_setup_t { static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks); static til_module_context_t * rtv_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup); static void rtv_destroy_context(til_module_context_t *context); -static void rtv_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan); +static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment); static void rtv_finish_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment); static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup); @@ -81,7 +81,7 @@ static til_module_t rtv_none_module = {}; til_module_t rtv_module = { .create_context = rtv_create_context, .destroy_context = rtv_destroy_context, - .prepare_frame = rtv_prepare_frame, + .render_fragment = rtv_render_fragment, .finish_frame = rtv_finish_frame, .name = "rtv", .description = "Rototiller TV", @@ -268,7 +268,7 @@ static void rtv_destroy_context(til_module_context_t *context) } -static void rtv_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan) +static void rtv_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment) { rtv_context_t *ctxt = (rtv_context_t *)context; time_t now = time(NULL); -- cgit v1.2.3