summaryrefslogtreecommitdiff
path: root/src/modules/montage
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-04-27 13:46:04 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-04-27 13:46:04 -0700
commitc881616cfbbd8c20d67f469d363254b2c56a12b7 (patch)
treee3366155b36d06bf49441746d98912988f6ad9c6 /src/modules/montage
parent0f16aad8e0f51b8259b9a8c0a5bac26fcf8b3ef5 (diff)
til_fb: til_fb_fragment_t.{pitch,stride} uint32_t units
Originally it seemed sensible to make these units of bytes, for flexibility reasons. But it's advantageous for everything to be able to assume pixels are always 4-byte/32-bit aligned. Having the stride/pitch be in bytes of units made it theoretically possible to produce unaligned rows of pixels, which would break that assumption. I don't think anything was ever actually producing such things, and I've added some asserts to the {sdl,drm}_fb.c page acquisition code to go fatal on such pages. This change required going through all the modules and get rid of their uint32_t vs. void* dances and other such 1-byte vs. 4-byte scaling arithmetic. Code is simpler now, and probably faster in some cases. And now allows future work to just assume things cna always occur 4-bytes at a time without concern for unaligned accesses.
Diffstat (limited to 'src/modules/montage')
-rw-r--r--src/modules/montage/montage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 13c8a36..e6f6ef1 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -144,14 +144,14 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til
xoff = x * tile_width;
yoff = y * tile_height;
- res_fragment->buf = (void *)fragment->buf + (yoff * fragment->pitch) + (xoff * 4);
+ res_fragment->buf = fragment->buf + (yoff * fragment->pitch) + xoff;
res_fragment->x = 0; /* fragment is a new frame */
res_fragment->y = 0; /* fragment is a new frame */
res_fragment->width = MIN(fragment->width - xoff, tile_width);
res_fragment->height = MIN(fragment->height - yoff, tile_height);
res_fragment->frame_width = res_fragment->width; /* fragment is a new frame */
res_fragment->frame_height = res_fragment->height; /* fragment is a new frame */
- res_fragment->stride = fragment->stride + ((fragment->width - res_fragment->width) * 4);
+ res_fragment->stride = fragment->stride + (fragment->width - res_fragment->width);
res_fragment->pitch = fragment->pitch;
res_fragment->number = number;
res_fragment->cleared = fragment->cleared;
© All Rights Reserved