[igt-dev] [PATCH i-g-t] tests/kms_big_fb: Test 8bpp

Ville Syrjala ville.syrjala at linux.intel.com
Wed May 29 08:36:43 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Now that igt_fb has some support for C8 we can enable
the 8bpp subtests.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_big_fb.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c
index b8813a333643..5989c5b291f0 100644
--- a/tests/kms_big_fb.c
+++ b/tests/kms_big_fb.c
@@ -206,6 +206,34 @@ static void cleanup_fb(data_t *data)
 	data->big_fb.fb_id = 0;
 }
 
+static void set_c8_lut(data_t *data)
+{
+	igt_pipe_t *pipe = &data->display.pipes[data->pipe];
+	struct drm_color_lut *lut;
+	int i, lut_size = 256;
+
+	lut = calloc(lut_size, sizeof(lut[0]));
+
+	/* igt_fb uses RGB332 for C8 */
+	for (i = 0; i < lut_size; i++) {
+		lut[i].red = ((i & 0xe0) >> 5) * 0xffff / 0x7;
+		lut[i].green = ((i & 0x1c) >> 2) * 0xffff / 0x7;
+		lut[i].blue = ((i & 0x03) >> 0) * 0xffff / 0x3;
+	}
+
+	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT, lut,
+				       lut_size * sizeof(lut[0]));
+
+	free(lut);
+}
+
+static void unset_lut(data_t *data)
+{
+	igt_pipe_t *pipe = &data->display.pipes[data->pipe];
+
+	igt_pipe_obj_replace_prop_blob(pipe, IGT_CRTC_GAMMA_LUT, NULL, 0);
+}
+
 static bool test_plane(data_t *data)
 {
 	igt_plane_t *plane = data->plane;
@@ -355,6 +383,9 @@ static bool test_pipe(data_t *data)
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
+	if (data->format == DRM_FORMAT_C8)
+		set_c8_lut(data);
+
 	igt_display_commit2(&data->display, data->display.is_atomic ?
 			    COMMIT_ATOMIC : COMMIT_UNIVERSAL);
 
@@ -367,6 +398,9 @@ static bool test_pipe(data_t *data)
 			break;
 	}
 
+	if (data->format == DRM_FORMAT_C8)
+		unset_lut(data);
+
 	igt_pipe_crc_free(data->pipe_crc);
 
 	igt_output_set_pipe(data->output, PIPE_ANY);
@@ -545,7 +579,6 @@ static const struct {
 	uint32_t format;
 	uint8_t bpp;
 } formats[] = {
-	/* FIXME igt_fb doesn't support C8 currently */
 	{ DRM_FORMAT_C8, 8, },
 	{ DRM_FORMAT_RGB565, 16, },
 	{ DRM_FORMAT_XRGB8888, 32, },
@@ -654,7 +687,8 @@ igt_main
 
 				igt_subtest_f("%s-%dbpp-rotate-%d", modifiers[i].name,
 					      formats[j].bpp, rotations[k].angle) {
-					igt_require(igt_fb_supported_format(data.format));
+					igt_require(data.format == DRM_FORMAT_C8 ||
+						    igt_fb_supported_format(data.format));
 					igt_require(igt_display_has_format_mod(&data.display, data.format, data.modifier));
 					test_scanout(&data);
 				}
-- 
2.21.0



More information about the igt-dev mailing list