summaryrefslogtreecommitdiff
path: root/src/modules/montage/montage.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-10 15:09:29 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-10 23:50:57 -0800
commit19966a5cb3a8d9cf8edbae225953da042dadfa96 (patch)
treefd041758fb8f7301d2d699faa420ea80d5fc08e0 /src/modules/montage/montage.c
parentcffc3da34523b996393f730bed5a65934b499167 (diff)
*: introduce paths for module contexts
There needs to be a way to address module context instances by name externally, in a manner complementary to settings and taps. This commit adds a string-based path to til_module_context_t, and modifies til_module_create_context() to accept a parent path which is then concatenated with the name of the module to produce the module instance's new path. The name separator used in the paths is '/' just like filesystem paths, but these paths have no relationship to filesystems or files. The root module context creation in rototiller's main simply passes "" as the parent path, resulting in a "/" root as one would expect. There are some obvious complications introduced here however: - checkers in particular creates a context per cpu, simply using the same seed and setup to try make the contexts identical at the same ticks value. With this commit I'm simply passing the incoming path as the parent for creating those contexts, but it's unclear to me if that will work OK. With an eye towards taps deriving their parent path from the context path, I guess these taps would all get the same parent and hash to the same value despite being duplicated. Maybe it Just Works, but one thing is clear - there won't be any way to address the per-cpu taps as-is. Maybe that's desirable though, there's probably not much use in trying to control the taps at the CPU granularity. - when the recursive settings stuff lands, it should bring along the ability to explicitly name settings blocks. Those names should override the module name in constructing the path. I've noted as such in the code. - these paths probably need to be hashed @ initialization time so there needs to be a hash function added to til, and a hash value accompanying the name in the module context. It'd be dumb to keep recomputing the hash when these paths get used for hash table lookups multiple times per frame... there's probably more I'm forgetting right now, but this seems like a good first step. fixup root path
Diffstat (limited to 'src/modules/montage/montage.c')
-rw-r--r--src/modules/montage/montage.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 1191a60..6697bc5 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -16,7 +16,7 @@ typedef struct montage_context_t {
size_t n_modules;
} montage_context_t;
-static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup);
+static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup);
static void montage_destroy_context(til_module_context_t *context);
static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan);
static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr);
@@ -32,13 +32,13 @@ til_module_t montage_module = {
};
-static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
+static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup)
{
const til_module_t **modules, *rtv_module, *compose_module;
size_t n_modules;
montage_context_t *ctxt;
- ctxt = til_module_context_new(sizeof(montage_context_t), seed, ticks, n_cpus);
+ ctxt = til_module_context_new(sizeof(montage_context_t), seed, ticks, n_cpus, path);
if (!ctxt)
return NULL;
@@ -92,7 +92,7 @@ static til_module_context_t * montage_create_context(unsigned seed, unsigned tic
(void) til_module_randomize_setup(module, rand_r(&seed), &setup, NULL);
/* FIXME errors */
- (void) til_module_create_context(module, rand_r(&seed), ticks, 1, setup, &ctxt->contexts[i]);
+ (void) til_module_create_context(module, rand_r(&seed), ticks, 1, path, setup, &ctxt->contexts[i]);
til_setup_free(setup);
}
© All Rights Reserved