[igt-dev] [PATCH i-g-t 2/8] chamelium: Pass and use stride for xr24 pattern paint
Maxime Ripard
maxime.ripard at bootlin.com
Tue Dec 4 10:08:15 UTC 2018
From: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Using the width from the selected mode is not sufficient to correctly
paint a pattern on the framebuffer memory: the stride also has to be
taken in account for proper line start alignment.
Pass the stride and use it in chamelium_paint_xr24_pattern.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Reviewed-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
tests/kms_chamelium.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index ee7580b54e69..ebca5eefd222 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -489,7 +489,8 @@ enable_output(data_t *data,
}
static void chamelium_paint_xr24_pattern(uint32_t *data,
- size_t width, size_t height)
+ size_t width, size_t height,
+ size_t stride)
{
uint32_t colors[] = { 0xff000000,
0xffff0000,
@@ -500,7 +501,7 @@ static void chamelium_paint_xr24_pattern(uint32_t *data,
for (i = 0; i < height; i++)
for (j = 0; j < width; j++)
- *(data + i * width + j) = colors[((j / 64) + (i / 64)) % 5];
+ *(data + i * stride / 4 + j) = colors[((j / 64) + (i / 64)) % 5];
}
static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
@@ -518,7 +519,8 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
ptr = igt_fb_map_buffer(fb->fd, fb);
igt_assert(ptr);
- chamelium_paint_xr24_pattern(ptr, mode->hdisplay, mode->vdisplay);
+ chamelium_paint_xr24_pattern(ptr, mode->hdisplay, mode->vdisplay,
+ fb->strides[0]);
igt_fb_unmap_buffer(fb, ptr);
return fb_id;
--
2.19.1
More information about the igt-dev
mailing list