diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/til.c | 7 | ||||
-rw-r--r-- | src/til.h | 1 | ||||
-rw-r--r-- | src/til_fb.c | 50 | ||||
-rw-r--r-- | src/til_fb.h | 1 |
4 files changed, 59 insertions, 0 deletions
@@ -629,6 +629,13 @@ int til_module_settings_finalize(const til_module_t *module, const til_settings_ } +/* generic noop fragmenter that does no subfragmenting at all, producing a whole fragment per-cpu */ +int til_fragmenter_noop_per_cpu(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +{ + return til_fb_fragment_noop_single(fragment, context->n_cpus, number, res_fragment); +} + + /* generic fragmenter using a horizontal slice per cpu according to context->n_cpus */ int til_fragmenter_slice_per_cpu(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { @@ -54,6 +54,7 @@ int til_module_setup_full(const til_settings_t *settings, til_setting_t **res_se int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup); int til_module_settings_randomize(const til_module_t *module, til_settings_t *settings, unsigned seed, til_setup_t **res_setup, char **res_arg); int til_module_settings_finalize(const til_module_t *module, const til_settings_t *module_settings, til_setup_t **res_setup); +int til_fragmenter_noop_per_cpu(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment); int til_fragmenter_slice_per_cpu(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment); int til_fragmenter_slice_per_cpu_x16(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment); int til_fragmenter_tile64(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment); diff --git a/src/til_fb.c b/src/til_fb.c index b6e98dd..78bae4d 100644 --- a/src/til_fb.c +++ b/src/til_fb.c @@ -646,6 +646,56 @@ void * til_fb_context(til_fb_t *fb) /* helpers for fragmenting incrementally */ +int til_fb_fragment_noop_single(const til_fb_fragment_t *fragment, unsigned n_fragments, unsigned number, til_fb_fragment_t *res_fragment) +{ + assert(fragment); + assert(res_fragment); + + if (number >= n_fragments) + return 0; + + if (fragment->texture) { + assert(res_fragment->texture); + assert(fragment->frame_width == fragment->texture->frame_width); + assert(fragment->frame_height == fragment->texture->frame_height); + assert(fragment->width == fragment->texture->width); + assert(fragment->height == fragment->texture->height); + assert(fragment->x == fragment->texture->x); + assert(fragment->y == fragment->texture->y); + + *(res_fragment->texture) = (til_fb_fragment_t){ + .buf = fragment->texture->buf, + .x = fragment->x, + .y = fragment->y, + .width = fragment->width, + .height = fragment->height, + .frame_width = fragment->frame_width, + .frame_height = fragment->frame_height, + .stride = fragment->texture->stride, + .pitch = fragment->texture->pitch, + .cleared = fragment->texture->cleared, + }; + } + + *res_fragment = (til_fb_fragment_t){ + .texture = fragment->texture ? res_fragment->texture : NULL, + .buf = fragment->buf, + .x = fragment->x, + .y = fragment->y, + .width = fragment->width, + .height = fragment->height, + .frame_width = fragment->frame_width, + .frame_height = fragment->frame_height, + .stride = fragment->stride, + .pitch = fragment->pitch, + .number = number, + .cleared = fragment->cleared, + }; + + return 1; +} + + int til_fb_fragment_slice_single(const til_fb_fragment_t *fragment, unsigned n_fragments, unsigned number, til_fb_fragment_t *res_fragment) { unsigned slice = MAX(fragment->height / n_fragments, 1); diff --git a/src/til_fb.h b/src/til_fb.h index 7c6464e..d346bd7 100644 --- a/src/til_fb.h +++ b/src/til_fb.h @@ -59,6 +59,7 @@ void til_fb_halt(til_fb_t *fb); void * til_fb_context(til_fb_t *fb); int til_fb_flip(til_fb_t *fb); void til_fb_fragment_divide(til_fb_fragment_t *fragment, unsigned n_fragments, til_fb_fragment_t fragments[]); +int til_fb_fragment_noop_single(const til_fb_fragment_t *fragment, unsigned n_fragments, unsigned num, til_fb_fragment_t *res_fragment); int til_fb_fragment_slice_single(const til_fb_fragment_t *fragment, unsigned n_fragments, unsigned num, til_fb_fragment_t *res_fragment); int til_fb_fragment_tile_single(const til_fb_fragment_t *fragment, unsigned tile_size, unsigned num, til_fb_fragment_t *res_fragment); |