[igt-dev] [PATCH v3 07/11] chamelium: Add function to generate our test pattern

Maxime Ripard maxime.ripard at bootlin.com
Thu May 24 14:24:46 UTC 2018


The current pattern being used is the one generated through the
igt_create_color_pattern_fb.

However, in order to deal with multiple formats and the upsampling /
downsampling issues that might arise from converting back and forth between
formats, we will need to have a pattern with quite precise color values,
and without any shades or gradient of colors.

Let's create a function that will generate our pattern in the chamelium
code, keeping the current pattern for now. We will extend it in a later
patch.

Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
 tests/kms_chamelium.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 5d7fb83fb74f..f14e3ebb4b87 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -486,6 +486,17 @@ enable_output(data_t *data,
 	drmModeFreeConnector(connector);
 }
 
+static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
+				    uint32_t fourcc, struct igt_fb *fb)
+{
+	igt_assert(fourcc == DRM_FORMAT_XRGB8888);
+
+	return igt_create_color_pattern_fb(data->drm_fd, mode->hdisplay,
+					   mode->vdisplay, fourcc,
+					   LOCAL_DRM_FORMAT_MOD_NONE,
+					   0, 0, 0, fb);
+}
+
 static void do_test_display_crc(data_t *data, struct chamelium_port *port,
 				igt_output_t *output, drmModeModeInfo *mode,
 				int count)
@@ -496,12 +507,7 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
 	struct igt_fb fb;
 	int i, fb_id, captured_frame_count;
 
-	fb_id = igt_create_color_pattern_fb(data->drm_fd,
-					    mode->hdisplay,
-					    mode->vdisplay,
-					    DRM_FORMAT_XRGB8888,
-					    LOCAL_DRM_FORMAT_MOD_NONE,
-					    0, 0, 0, &fb);
+	fb_id = chamelium_get_pattern_fb(data, mode, DRM_FORMAT_XRGB8888, &fb);
 	igt_assert(fb_id > 0);
 
 	fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
-- 
git-series 0.9.1


More information about the igt-dev mailing list