diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-19 15:36:06 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-04-19 15:36:06 -0700 |
commit | 53d4d504b9103f524c50385ed3545fd08d0e272e (patch) | |
tree | 3f540f6bd1a0c6eb6301f15ebf3376e9c6fdaf68 | |
parent | ca14c4bf346a200ab8a66be293d8e71d49e09e32 (diff) |
*: s/til_fb_fragment_zero/til_fb_fragment_clear/
Mechanical renaming of "zero" to "clear" throughout for this
context.
-rw-r--r-- | HACKING.txt | 12 | ||||
-rw-r--r-- | src/modules/compose/compose.c | 2 | ||||
-rw-r--r-- | src/modules/montage/montage.c | 4 | ||||
-rw-r--r-- | src/modules/pixbounce/pixbounce.c | 2 | ||||
-rw-r--r-- | src/modules/plato/plato.c | 2 | ||||
-rw-r--r-- | src/modules/rtv/rtv.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/sparkler.c | 4 | ||||
-rw-r--r-- | src/modules/spiro/spiro.c | 2 | ||||
-rw-r--r-- | src/modules/stars/stars.c | 2 | ||||
-rw-r--r-- | src/modules/swarm/swarm.c | 2 | ||||
-rw-r--r-- | src/til_fb.c | 6 | ||||
-rw-r--r-- | src/til_fb.h | 10 | ||||
-rw-r--r-- | src/til_threads.c | 14 |
13 files changed, 32 insertions, 32 deletions
diff --git a/HACKING.txt b/HACKING.txt index fc4662a..35921ad 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -123,7 +123,7 @@ Hacking on rototiller / libtil: unsigned stride; /* number of bytes from the end of one row to the start of the next */ unsigned pitch; /* number of bytes separating y from y + 1, including any padding */ unsigned number; /* this fragment's number as produced by fragmenting */ - unsigned zeroed:1; /* if this fragment has been zeroed since last flip */ + unsigned cleared:1; /* if this fragment has been cleared since last flip */ } til_fb_fragment_t; For most modules these members are simply used as provided, and @@ -202,19 +202,19 @@ Hacking on rototiller / libtil: In the latter case it's common to require bulk-clearing the fragment before the algorithm draws its sparse overlay-like contents onto the canvas. To facilitate potential compositing of such modules, the - "til_fb_fragment_t" structure contains a "zeroed" member used to indicate + "til_fb_fragment_t" structure contains a "cleared" member used to indicate if a given fragment's buf contents have been fully initialized yet for - the current frame. When "zeroed" is already set, the bulk clearing + the current frame. When "cleared" is already set, the bulk clearing operation should be skipped, allowing the existing contents to serve as the logically blank canvas. A convenience helper for such modules is provided named - til_fb_fragment_zero(). Simply call this at the start of the - render_fragment() function, and the conditional zeroed vs. non-zeroed + til_fb_fragment_clear(). Simply call this at the start of the + render_fragment() function, and the conditional cleared vs. non-cleared details will be handled automatically. Otherwise see the implementation in "src/til_fb.h" to see what's appropriate. To clarify, modules implementing algorithms that naturally always write every pixel in the - fragment may completely ignore this aspect, and need not set the zeroed + fragment may completely ignore this aspect, and need not set the cleared member; that's handled automatically. diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index da9215b..5b46080 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -106,7 +106,7 @@ static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus { compose_context_t *ctxt = context; - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); for (int i = 0; i < ctxt->n_layers; i++) til_module_render(ctxt->layers[i].module, ctxt->layers[i].module_ctxt, ticks, fragment); diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 5a9b688..a45a32c 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -149,7 +149,7 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4); res_fragment->pitch = fragment->pitch; res_fragment->number = number; - res_fragment->zeroed = fragment->zeroed; + res_fragment->cleared = fragment->cleared; return 1; } @@ -193,7 +193,7 @@ static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, const til_module_t *module = ctxt->modules[fragment->number]; if (fragment->number >= ctxt->n_modules) { - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); return; } diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c index 6585053..ff2d990 100644 --- a/src/modules/pixbounce/pixbounce.c +++ b/src/modules/pixbounce/pixbounce.c @@ -141,7 +141,7 @@ static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cp int width = fragment->width, height = fragment->height; /* blank the frame */ - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); /* check for very small fragment */ if(pix_width*2>width||pix_height*2>height) diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c index c8aba18..5942d93 100644 --- a/src/modules/plato/plato.c +++ b/src/modules/plato/plato.c @@ -636,7 +636,7 @@ static void plato_render_fragment(void *context, unsigned ticks, unsigned cpu, t plato_context_t *ctxt = context; ctxt->r += .015f; - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); for (int i = 0; i < sizeof(polyhedra) / sizeof(*polyhedra); i++) { m4f_t transform; diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 217368c..a236f96 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -311,7 +311,7 @@ static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, ti */ if (!ctxt->channel->module->render_fragment && !ctxt->channel->module->prepare_frame) - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); else til_module_render(ctxt->channel->module, ctxt->channel->module_ctxt, ticks, fragment); } diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c index f13954e..ec706b9 100644 --- a/src/modules/sparkler/sparkler.c +++ b/src/modules/sparkler/sparkler.c @@ -87,7 +87,7 @@ static void sparkler_prepare_frame(void *context, unsigned ticks, unsigned ncpus ctxt->n_cpus = ncpus; if (ctxt->setup.show_bsp_matches) - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); particles_sim(ctxt->particles, fragment); particles_add_particles(ctxt->particles, NULL, &simple_ops, INIT_PARTS / 4); @@ -101,7 +101,7 @@ static void sparkler_render_fragment(void *context, unsigned ticks, unsigned cpu sparkler_context_t *ctxt = context; if (!ctxt->setup.show_bsp_matches) - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); particles_draw(ctxt->particles, fragment); } diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c index ddbc33d..546dc60 100644 --- a/src/modules/spiro/spiro.c +++ b/src/modules/spiro/spiro.c @@ -81,7 +81,7 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, t } /* blank the fragment */ - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); /* plot one spirograph run */ float l=ctxt->p/ctxt->r; diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c index 288057f..d7093fe 100644 --- a/src/modules/stars/stars.c +++ b/src/modules/stars/stars.c @@ -124,7 +124,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, t max_radius=1.f+((width+height)*.001f); - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); iterator=ctxt->points; for(;;) diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c index a41e388..e708082 100644 --- a/src/modules/swarm/swarm.c +++ b/src/modules/swarm/swarm.c @@ -410,7 +410,7 @@ static void swarm_render_fragment(void *context, unsigned ticks, unsigned cpu, t swarm_update(ctxt, ticks); - til_fb_fragment_zero(fragment); + til_fb_fragment_clear(fragment); switch (ctxt->setup.draw_style) { case SWARM_DRAW_STYLE_POINTS: diff --git a/src/til_fb.c b/src/til_fb.c index 1f10075..5a6a956 100644 --- a/src/til_fb.c +++ b/src/til_fb.c @@ -233,7 +233,7 @@ static inline _til_fb_page_t * _til_fb_page_get(til_fb_t *fb) pthread_mutex_unlock(&fb->inactive_mutex); page->next = page->previous = NULL; - page->public_page.fragment.zeroed = 0; + page->public_page.fragment.cleared = 0; return page; } @@ -410,7 +410,7 @@ int til_fb_fragment_slice_single(const til_fb_fragment_t *fragment, unsigned n_f res_fragment->stride = fragment->stride; res_fragment->pitch = fragment->pitch; res_fragment->number = number; - res_fragment->zeroed = fragment->zeroed; + res_fragment->cleared = fragment->cleared; return 1; } @@ -446,7 +446,7 @@ int til_fb_fragment_tile_single(const til_fb_fragment_t *fragment, unsigned tile res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4); res_fragment->pitch = fragment->pitch; res_fragment->number = number; - res_fragment->zeroed = fragment->zeroed; + res_fragment->cleared = fragment->cleared; return 1; } diff --git a/src/til_fb.h b/src/til_fb.h index f441d36..cbca0a7 100644 --- a/src/til_fb.h +++ b/src/til_fb.h @@ -19,7 +19,7 @@ typedef struct til_fb_fragment_t { unsigned stride; /* number of bytes from the end of one row to the start of the next */ unsigned pitch; /* number of bytes separating y from y + 1, including any padding */ unsigned number; /* this fragment's number as produced by fragmenting */ - unsigned zeroed:1; /* if this fragment has been zeroed since last flip */ + unsigned cleared:1; /* if this fragment has been cleared since last flip */ } til_fb_fragment_t; /* This is a page handle object for page flip submission/life-cycle. @@ -101,15 +101,15 @@ static inline void til_fb_fragment_fill(til_fb_fragment_t *fragment, uint32_t pi } -/* zero a fragment */ -static inline void til_fb_fragment_zero(til_fb_fragment_t *fragment) +/* clear a fragment */ +static inline void til_fb_fragment_clear(til_fb_fragment_t *fragment) { - if (fragment->zeroed) + if (fragment->cleared) return; til_fb_fragment_fill(fragment, 0); - fragment->zeroed = 1; + fragment->cleared = 1; } #endif diff --git a/src/til_threads.c b/src/til_threads.c index 6f01db1..a3f6f7e 100644 --- a/src/til_threads.c +++ b/src/til_threads.c @@ -19,7 +19,7 @@ typedef struct til_threads_t { pthread_mutex_t idle_mutex; pthread_cond_t idle_cond; unsigned idle_n_fragments; - unsigned idle_n_zeroed; + unsigned idle_n_cleared; unsigned n_idle; pthread_mutex_t frame_mutex; @@ -47,7 +47,7 @@ static void * thread_func(void *_thread) pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); for (;;) { - unsigned n_fragments = 0, n_zeroed = 0; + unsigned n_fragments = 0, n_cleared = 0; /* wait for a new frame */ pthread_mutex_lock(&threads->frame_mutex); @@ -68,7 +68,7 @@ static void * thread_func(void *_thread) break; threads->render_fragment_func(threads->context, threads->ticks, thread->id, &fragment); - n_zeroed += fragment.zeroed; + n_cleared += fragment.cleared; n_fragments++; } @@ -76,11 +76,11 @@ static void * thread_func(void *_thread) pthread_mutex_lock(&threads->idle_mutex); pthread_cleanup_push((void (*)(void *))pthread_mutex_unlock, &threads->idle_mutex); threads->idle_n_fragments += n_fragments; - threads->idle_n_zeroed += n_zeroed; + threads->idle_n_cleared += n_cleared; threads->n_idle++; if (threads->n_idle == threads->n_threads) { /* Frame finished! Notify potential waiter. */ - if (threads->idle_n_zeroed == threads->idle_n_fragments) - threads->fragment->zeroed = 1; + if (threads->idle_n_cleared == threads->idle_n_fragments) + threads->fragment->cleared = 1; pthread_cond_signal(&threads->idle_cond); } @@ -115,7 +115,7 @@ void til_threads_frame_submit(til_threads_t *threads, til_fb_fragment_t *fragmen threads->context = context; threads->ticks = ticks; threads->frame_num++; - threads->n_idle = threads->idle_n_zeroed = threads->idle_n_fragments = threads->next_fragment = 0; + threads->n_idle = threads->idle_n_cleared = threads->idle_n_fragments = threads->next_fragment = 0; pthread_cond_broadcast(&threads->frame_cond); pthread_cleanup_pop(1); } |