[igt-dev] [PATCH i-g-t 1/9] chamelium: Pass dimensions instead of mode to pattern generation helper

Paul Kocialkowski
2018-12-06T14:13:40Z

In order to reuse the pattern generation helper for overlay planes,
let's provide the pattern generation helper with the explicit dimensions
instead of the mode (that only applies to the primary plane).

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
tests/kms_chamelium.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 8a9f6bfe..b8cab927 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -504,7 +504,7 @@ static void chamelium_paint_xr24_pattern(uint32_t *data,
*(data + i * stride / 4 + j) = colors[((j / 64) + (i / 64)) % 5];
}

-static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
+static int chamelium_get_pattern_fb(data_t *data, size_t width, size_t height,
uint32_t fourcc, struct igt_fb *fb)
{
int fb_id;
@@ -512,15 +512,14 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,

igt_assert(fourcc == DRM_FORMAT_XRGB8888);

- fb_id = igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
- fourcc, LOCAL_DRM_FORMAT_MOD_NONE, fb);
+ fb_id = igt_create_fb(data->drm_fd, width, height, fourcc,
+ LOCAL_DRM_FORMAT_MOD_NONE, fb);
igt_assert(fb_id > 0);

ptr = igt_fb_map_buffer(fb->fd, fb);
igt_assert(ptr);

- chamelium_paint_xr24_pattern(ptr, mode->hdisplay, mode->vdisplay,
- fb->strides[0]);
+ chamelium_paint_xr24_pattern(ptr, width, height, fb->strides[0]);
igt_fb_unmap_buffer(fb, ptr);

return fb_id;
@@ -541,7 +540,7 @@ static void do_test_display(data_t *data, struct chamelium_port *port,
int i, fb_id, captured_frame_count;
int frame_id;

- fb_id = chamelium_get_pattern_fb(data, mode,
+ fb_id = chamelium_get_pattern_fb(data, mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888, &fb);
igt_assert(fb_id > 0);

--
2.19.2