From 8f774980b9222f39f9e74e8e3a694cad55753e2f Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 24 Nov 2019 11:26:23 -0800 Subject: fb: add number to fb_fragment_t This introduces a stricter coupling and requirement for modules supplying a fragmenter in their prepare_frame() to only receive fragments produced by *their* fragmenter at their render_fragment(). When modules don't explicitly perform any fragmenting they can't really make much use of this number as it will reflect an arbitrary fragmenting pass's perspective. But when modules do perform their own frame fragmenting, they can assume any fragment supplied to their render function will have been generated by it. This needs to be enforced a bit in the code. The current use case is montage using a fragmenter for tiling the montage in a threaded render. The fragment numbers map to the modules to be rendered in the tiles. As long as modules can assume their fragmenter will always be what produces their fragments, this is perfectly fine. --- src/fb.c | 2 ++ src/fb.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/fb.c b/src/fb.c index a20fdd3..c37cc04 100644 --- a/src/fb.c +++ b/src/fb.c @@ -328,6 +328,7 @@ int fb_fragment_slice_single(const fb_fragment_t *fragment, unsigned n_fragments res_fragment->frame_height = fragment->frame_height; res_fragment->stride = fragment->stride; res_fragment->pitch = fragment->pitch; + res_fragment->number = num; return 1; } @@ -362,6 +363,7 @@ int fb_fragment_tile_single(const fb_fragment_t *fragment, unsigned tile_size, u res_fragment->frame_height = fragment->frame_height; res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4); res_fragment->pitch = fragment->pitch; + res_fragment->number = num; return 1; } diff --git a/src/fb.h b/src/fb.h index dfd4550..300c134 100644 --- a/src/fb.h +++ b/src/fb.h @@ -18,6 +18,7 @@ typedef struct fb_fragment_t { unsigned frame_height; /* height of the frame this fragment is part of */ 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 */ } fb_fragment_t; /* This is a page handle object for page flip submission/life-cycle. -- cgit v1.2.1