summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2018-12-27 15:57:37 +0100
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2018-12-31 10:12:33 +0200
commitacaaa8eaf2d02357dd6e05a09ff5fd7cdc085daf (patch)
tree03ac1a1ed5d024264d27cfe3caa47c1c96558ab3 /tests
parent54c864b1b5b02f13264326c6877a444714709a68 (diff)
chamelium: Pass and use stride for xr24 pattern paint
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@bootlin.com> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_chamelium.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index ee7580b54..ebca5eefd 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;