Skip to contentSkip to conversation

igt: chamelium: Test YUV buffers using the Chamelium

PATCH RESEND Superseded Maxime Ripard 3 participants 15 messages Dec 4, 2018 – Dec 7, 2018 Library code

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover igt: chamelium: Test YUV buffers using the Chamelium

Hi,

Here is a first attempt at expanding the current Chamelium formats test to the NV12 format.

It builds on top of the current infrastructure for the NV12 convertion, and the format suppport of the Chamelium.

Let me know what you think,
Maxime

Maxime Ripard (6):
igt: tests: chamelium: Start to unify tests
igt: tests: chamelium: Convert VGA tests to do_test_display
igt: fb: Move i915 buffer allocation to a function of its own
igt: fb: Separate YUV allocation from the rest
igt: fb: Fallback on KMS dumb buffer allocation for YUV buffers
igt: tests: chamelium: Add NV12 format

Paul Kocialkowski (2):
chamelium: Fix inverted xr24 pattern paint dimensions
chamelium: Pass and use stride for xr24 pattern paint

 lib/igt_fb.c          | 140 +++++++++++++++++--------
 tests/kms_chamelium.c | 234 ++++++++++++++++++++----------------------
 2 files changed, 210 insertions(+), 164 deletions(-)
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH RESEND 1/8 chamelium: Fix inverted xr24 pattern paint dimensions

From: Paul Kocialkowski <[email protected]>

The xr24 pattern for chamelium testing appears mangled when checking it on an actual display. This is because the horizontal and vertical display sizes are inverted when used as width and height.

Put them back in order.

---
 tests/kms_chamelium.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/kms_chamelium.c +1 -1
index 55b346a9e1c4..ee7580b54e69 100644
@@ -518,7 +518,7 @@ 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->vdisplay, mode->hdisplay);
+	chamelium_paint_xr24_pattern(ptr, mode->hdisplay, mode->vdisplay);
 	igt_fb_unmap_buffer(fb, ptr);
 
 	return fb_id;
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH RESEND 2/8 chamelium: Pass and use stride for xr24 pattern paint

In reply to Maxime Ripard

From: Paul Kocialkowski <[email protected]>

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.

---
 tests/kms_chamelium.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tests/kms_chamelium.c +5 -3
index ee7580b54e69..ebca5eefd222 100644
@@ -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;
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

PATCH RESEND 3/8 igt: tests: chamelium: Start to unify tests

In reply to Maxime Ripard

The various tests in kms_chamelium are really variants of one another but share little code.

In addition to the duplication, this gets in the way of the introduction of more tests, or to be able to run all the tests on all the output, which isn't the case at the moment, with the HDMI and DP tests and the VGA tests being different.

Start by introducing a check parameter to the do_test_display function, that will tell which test method we want to use to compare the frames.

---
 tests/kms_chamelium.c | 134 +++++++++++++++++++++++-------------------
 1 file changed, 73 insertions(+), 61 deletions(-)
tests/kms_chamelium.c +73 -61
index ebca5eefd222..8b9872a17044 100644
@@ -526,12 +526,15 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
 	return fb_id;
 }
 
-static void do_test_display_crc(data_t *data, struct chamelium_port *port,
-				igt_output_t *output, drmModeModeInfo *mode,
-				uint32_t fourcc, int count)
+enum chamelium_check {
+	CHAMELIUM_CHECK_CRC,
+};
+
+static void do_test_display(data_t *data, struct chamelium_port *port,
+			    igt_output_t *output, drmModeModeInfo *mode,
+			    uint32_t fourcc, enum chamelium_check check,
+			    int count)
 {
-	igt_crc_t *crc;
-	igt_crc_t *expected_crc;
 	struct chamelium_fb_crc_async_data *fb_crc;
 	struct igt_fb frame_fb, fb;
 	int i, fb_id, captured_frame_count;
@@ -544,39 +547,46 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
 	frame_id = igt_fb_convert(&frame_fb, &fb, fourcc);
 	igt_assert(frame_id > 0);
 
-	fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
-							&fb);
+	if (check == CHAMELIUM_CHECK_CRC)
+		fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
+								&fb);
 
 	enable_output(data, port, output, mode, &frame_fb);
 
-	/* We want to keep the display running for a little bit, since
-	 * there's always the potential the driver isn't able to keep
-	 * the display running properly for very long
-	 */
-	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, count);
-	crc = chamelium_read_captured_crcs(data->chamelium,
-					   &captured_frame_count);
+	if (check == CHAMELIUM_CHECK_CRC) {
+		igt_crc_t *expected_crc;
+		igt_crc_t *crc;
 
-	igt_assert(captured_frame_count == count);
+		/* We want to keep the display running for a little bit, since
+		 * there's always the potential the driver isn't able to keep
+		 * the display running properly for very long
+		 */
+		chamelium_capture(data->chamelium, port, 0, 0, 0, 0, count);
+		crc = chamelium_read_captured_crcs(data->chamelium,
+						   &captured_frame_count);
 
-	igt_debug("Captured %d frames\n", captured_frame_count);
+		igt_assert(captured_frame_count == count);
 
-	expected_crc = chamelium_calculate_fb_crc_async_finish(fb_crc);
+		igt_debug("Captured %d frames\n", captured_frame_count);
 
-	for (i = 0; i < captured_frame_count; i++)
-		chamelium_assert_crc_eq_or_dump(data->chamelium,
-						expected_crc, &crc[i],
-						&fb, i);
+		expected_crc = chamelium_calculate_fb_crc_async_finish(fb_crc);
 
-	free(expected_crc);
-	free(crc);
+		for (i = 0; i < captured_frame_count; i++)
+			chamelium_assert_crc_eq_or_dump(data->chamelium,
+							expected_crc, &crc[i],
+							&fb, i);
+
+		free(expected_crc);
+		free(crc);
+	}
 
 	igt_remove_fb(data->drm_fd, &frame_fb);
 	igt_remove_fb(data->drm_fd, &fb);
 }
 
-static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
-				      uint32_t fourcc, int count)
+static void test_display_one_mode(data_t *data, struct chamelium_port *port,
+				  uint32_t fourcc, enum chamelium_check check,
+				  int count)
 {
 	igt_output_t *output;
 	drmModeConnector *connector;
@@ -589,13 +599,15 @@ static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
-	do_test_display_crc(data, port, output, &connector->modes[0], fourcc, count);
+	do_test_display(data, port, output, &connector->modes[0], fourcc,
+			check, count);
 
 	drmModeFreeConnector(connector);
 }
 
-static void test_display_crc_all_modes(data_t *data, struct chamelium_port *port,
-				       uint32_t fourcc, int count)
+static void test_display_all_modes(data_t *data, struct chamelium_port *port,
+				   uint32_t fourcc, enum chamelium_check check,
+				   int count)
 {
 	igt_output_t *output;
 	igt_plane_t *primary;
@@ -612,7 +624,7 @@ static void test_display_crc_all_modes(data_t *data, struct chamelium_port *port
 	for (i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *mode = &connector->modes[i];
 
-		do_test_display_crc(data, port, output, mode, fourcc, count);
+		do_test_display(data, port, output, mode, fourcc, check, count);
 	}
 
 	drmModeFreeConnector(connector);
@@ -873,16 +885,16 @@ igt_main
 							edid_id, alt_edid_id);
 
 		connector_subtest("dp-crc-single", DisplayPort)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 1);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("dp-crc-fast", DisplayPort)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("dp-crc-multiple", DisplayPort)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 3);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 3);
 
 		connector_subtest("dp-frame-dump", DisplayPort)
 			test_display_frame_dump(&data, port);
@@ -940,56 +952,56 @@ igt_main
 							edid_id, alt_edid_id);
 
 		connector_subtest("hdmi-crc-single", HDMIA)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 1);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-fast", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-multiple", HDMIA)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 3);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 3);
 
 		connector_subtest("hdmi-crc-argb8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ARGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ARGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-abgr8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ABGR8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ABGR8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xrgb8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xbgr8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XBGR8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XBGR8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-rgb888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_RGB888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_RGB888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-bgr888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_BGR888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_BGR888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-rgb565", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_RGB565, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_RGB565,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-bgr565", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_BGR565, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_BGR565,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-argb1555", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ARGB1555, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ARGB1555,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xrgb1555", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB1555, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB1555,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-frame-dump", HDMIA)
 			test_display_frame_dump(&data, port);
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 3/8
#4 lore raw

Re: [igt-dev] [PATCH RESEND i-g-t 3/8] igt: tests: chamelium: Start to unify tests

Hi,

Quoted 11 lines · Maxime Ripard

The various tests in kms_chamelium are really variants of one another but share little code.

In addition to the duplication, this gets in the way of the introduction of more tests, or to be able to run all the tests on all the output, which isn't the case at the moment, with the HDMI and DP tests and the VGA tests being different.

Start by introducing a check parameter to the do_test_display function, that will tell which test method we want to use to compare the frames.

Quoted 231 lines
---
 tests/kms_chamelium.c | 134 +++++++++++++++++++++++-------------------
 1 file changed, 73 insertions(+), 61 deletions(-)
tests/kms_chamelium.c +73 -61
index ebca5eefd222..8b9872a17044 100644
@@ -526,12 +526,15 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
 	return fb_id;
 }
 
-static void do_test_display_crc(data_t *data, struct chamelium_port *port,
-				igt_output_t *output, drmModeModeInfo *mode,
-				uint32_t fourcc, int count)
+enum chamelium_check {
+	CHAMELIUM_CHECK_CRC,
+};
+
+static void do_test_display(data_t *data, struct chamelium_port *port,
+			    igt_output_t *output, drmModeModeInfo *mode,
+			    uint32_t fourcc, enum chamelium_check check,
+			    int count)
 {
-	igt_crc_t *crc;
-	igt_crc_t *expected_crc;
 	struct chamelium_fb_crc_async_data *fb_crc;
 	struct igt_fb frame_fb, fb;
 	int i, fb_id, captured_frame_count;
@@ -544,39 +547,46 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
 	frame_id = igt_fb_convert(&frame_fb, &fb, fourcc);
 	igt_assert(frame_id > 0);
 
-	fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
-							&fb);
+	if (check == CHAMELIUM_CHECK_CRC)
+		fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
+								&fb);
 
 	enable_output(data, port, output, mode, &frame_fb);
 
-	/* We want to keep the display running for a little bit, since
-	 * there's always the potential the driver isn't able to keep
-	 * the display running properly for very long
-	 */
-	chamelium_capture(data->chamelium, port, 0, 0, 0, 0, count);
-	crc = chamelium_read_captured_crcs(data->chamelium,
-					   &captured_frame_count);
+	if (check == CHAMELIUM_CHECK_CRC) {
+		igt_crc_t *expected_crc;
+		igt_crc_t *crc;
 
-	igt_assert(captured_frame_count == count);
+		/* We want to keep the display running for a little bit, since
+		 * there's always the potential the driver isn't able to keep
+		 * the display running properly for very long
+		 */
+		chamelium_capture(data->chamelium, port, 0, 0, 0, 0, count);
+		crc = chamelium_read_captured_crcs(data->chamelium,
+						   &captured_frame_count);
 
-	igt_debug("Captured %d frames\n", captured_frame_count);
+		igt_assert(captured_frame_count == count);
 
-	expected_crc = chamelium_calculate_fb_crc_async_finish(fb_crc);
+		igt_debug("Captured %d frames\n", captured_frame_count);
 
-	for (i = 0; i < captured_frame_count; i++)
-		chamelium_assert_crc_eq_or_dump(data->chamelium,
-						expected_crc, &crc[i],
-						&fb, i);
+		expected_crc = chamelium_calculate_fb_crc_async_finish(fb_crc);
 
-	free(expected_crc);
-	free(crc);
+		for (i = 0; i < captured_frame_count; i++)
+			chamelium_assert_crc_eq_or_dump(data->chamelium,
+							expected_crc, &crc[i],
+							&fb, i);
+
+		free(expected_crc);
+		free(crc);
+	}
 
 	igt_remove_fb(data->drm_fd, &frame_fb);
 	igt_remove_fb(data->drm_fd, &fb);
 }
 
-static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
-				      uint32_t fourcc, int count)
+static void test_display_one_mode(data_t *data, struct chamelium_port *port,
+				  uint32_t fourcc, enum chamelium_check check,
+				  int count)
 {
 	igt_output_t *output;
 	drmModeConnector *connector;
@@ -589,13 +599,15 @@ static void test_display_crc_one_mode(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
-	do_test_display_crc(data, port, output, &connector->modes[0], fourcc, count);
+	do_test_display(data, port, output, &connector->modes[0], fourcc,
+			check, count);
 
 	drmModeFreeConnector(connector);
 }
 
-static void test_display_crc_all_modes(data_t *data, struct chamelium_port *port,
-				       uint32_t fourcc, int count)
+static void test_display_all_modes(data_t *data, struct chamelium_port *port,
+				   uint32_t fourcc, enum chamelium_check check,
+				   int count)
 {
 	igt_output_t *output;
 	igt_plane_t *primary;
@@ -612,7 +624,7 @@ static void test_display_crc_all_modes(data_t *data, struct chamelium_port *port
 	for (i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *mode = &connector->modes[i];
 
-		do_test_display_crc(data, port, output, mode, fourcc, count);
+		do_test_display(data, port, output, mode, fourcc, check, count);
 	}
 
 	drmModeFreeConnector(connector);
@@ -873,16 +885,16 @@ igt_main
 							edid_id, alt_edid_id);
 
 		connector_subtest("dp-crc-single", DisplayPort)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 1);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("dp-crc-fast", DisplayPort)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("dp-crc-multiple", DisplayPort)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 3);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 3);
 
 		connector_subtest("dp-frame-dump", DisplayPort)
 			test_display_frame_dump(&data, port);
@@ -940,56 +952,56 @@ igt_main
 							edid_id, alt_edid_id);
 
 		connector_subtest("hdmi-crc-single", HDMIA)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 1);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-fast", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-multiple", HDMIA)
-			test_display_crc_all_modes(&data, port,
-						   DRM_FORMAT_XRGB8888, 3);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_CRC, 3);
 
 		connector_subtest("hdmi-crc-argb8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ARGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ARGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-abgr8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ABGR8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ABGR8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xrgb8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xbgr8888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XBGR8888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XBGR8888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-rgb888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_RGB888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_RGB888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-bgr888", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_BGR888, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_BGR888,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-rgb565", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_RGB565, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_RGB565,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-bgr565", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_BGR565, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_BGR565,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-argb1555", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_ARGB1555, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_ARGB1555,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-crc-xrgb1555", HDMIA)
-			test_display_crc_one_mode(&data, port,
-						  DRM_FORMAT_XRGB1555, 1);
+			test_display_one_mode(&data, port, DRM_FORMAT_XRGB1555,
+					      CHAMELIUM_CHECK_CRC, 1);
 
 		connector_subtest("hdmi-frame-dump", HDMIA)
 			test_display_frame_dump(&data, port);
Signature · 8 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw

PATCH RESEND 4/8 igt: tests: chamelium: Convert VGA tests to do_test_display

In reply to Maxime Ripard

The VGA tests were run so far as part of a separate function. However, the only difference between that function and the do_test_display function was the kind of comparison we wanted to use. Indeed, VGA being an analog output, we can't rely on a pixel perfect image, and thus only compare the CRCs, but we need to make some more advanced comparison.

Let's add a new check method, add support for the analog check to do_test_display and remove the old version.

---
 tests/kms_chamelium.c | 92 ++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 59 deletions(-)
tests/kms_chamelium.c +33 -59
index 8b9872a17044..80b279c4f1c2 100644
@@ -527,6 +527,7 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
 }
 
 enum chamelium_check {
+	CHAMELIUM_CHECK_ANALOG,
 	CHAMELIUM_CHECK_CRC,
 };
 
@@ -578,6 +579,18 @@ static void do_test_display(data_t *data, struct chamelium_port *port,
 
 		free(expected_crc);
 		free(crc);
+	} else if (check == CHAMELIUM_CHECK_ANALOG) {
+		struct chamelium_frame_dump *dump;
+
+		igt_assert(count == 1);
+
+		dump = chamelium_port_dump_pixels(data->chamelium, port, 0, 0,
+						  0, 0);
+		chamelium_crop_analog_frame(dump, mode->hdisplay,
+					    mode->vdisplay);
+		chamelium_assert_analog_frame_match_or_dump(data->chamelium,
+							    port, dump, &fb);
+		chamelium_destroy_frame_dump(dump);
 	}
 
 	igt_remove_fb(data->drm_fd, &frame_fb);
@@ -588,8 +601,9 @@ static void test_display_one_mode(data_t *data, struct chamelium_port *port,
 				  uint32_t fourcc, enum chamelium_check check,
 				  int count)
 {
-	igt_output_t *output;
 	drmModeConnector *connector;
+	drmModeModeInfo *mode;
+	igt_output_t *output;
 	igt_plane_t *primary;
 
 	reset_state(data, port);
@@ -599,8 +613,14 @@ static void test_display_one_mode(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
-	do_test_display(data, port, output, &connector->modes[0], fourcc,
-			check, count);
+	mode = &connector->modes[0];
+	if (check == CHAMELIUM_CHECK_ANALOG) {
+		bool bridge = check_analog_bridge(data, port);
+
+		igt_assert(!(bridge && prune_vga_mode(data, mode)));
+	}
+
+	do_test_display(data, port, output, mode, fourcc, check, count);
 
 	drmModeFreeConnector(connector);
 }
@@ -612,6 +632,7 @@ static void test_display_all_modes(data_t *data, struct chamelium_port *port,
 	igt_output_t *output;
 	igt_plane_t *primary;
 	drmModeConnector *connector;
+	bool bridge;
 	int i;
 
 	reset_state(data, port);
@@ -621,9 +642,16 @@ static void test_display_all_modes(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
+	if (check == CHAMELIUM_CHECK_ANALOG)
+		bridge = check_analog_bridge(data, port);
+
 	for (i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *mode = &connector->modes[i];
 
+		if (check == CHAMELIUM_CHECK_ANALOG && bridge &&
+		    prune_vga_mode(data, mode))
+			continue;
+
 		do_test_display(data, port, output, mode, fourcc, check, count);
 	}
 
@@ -674,61 +702,6 @@ test_display_frame_dump(data_t *data, struct chamelium_port *port)
 	drmModeFreeConnector(connector);
 }
 
-static void
-test_analog_frame_dump(data_t *data, struct chamelium_port *port)
-{
-	igt_output_t *output;
-	igt_plane_t *primary;
-	struct igt_fb fb;
-	struct chamelium_frame_dump *frame;
-	drmModeModeInfo *mode;
-	drmModeConnector *connector;
-	int fb_id, i;
-	bool bridge;
-
-	reset_state(data, port);
-
-	output = prepare_output(data, port);
-	connector = chamelium_port_get_connector(data->chamelium, port, false);
-	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-	igt_assert(primary);
-
-	bridge = check_analog_bridge(data, port);
-
-	for (i = 0; i < connector->count_modes; i++) {
-		mode = &connector->modes[i];
-
-		if (bridge && prune_vga_mode(data, mode))
-			continue;
-
-		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);
-		igt_assert(fb_id > 0);
-
-		enable_output(data, port, output, mode, &fb);
-
-		igt_debug("Reading frame dumps from Chamelium...\n");
-
-		frame = chamelium_port_dump_pixels(data->chamelium, port, 0, 0,
-						   0, 0);
-
-		chamelium_crop_analog_frame(frame, mode->hdisplay,
-					    mode->vdisplay);
-
-		chamelium_assert_analog_frame_match_or_dump(data->chamelium,
-							    port, frame, &fb);
-
-		chamelium_destroy_frame_dump(frame);
-
-		igt_remove_fb(data->drm_fd, &fb);
-	}
-
-	drmModeFreeConnector(connector);
-}
-
 static void
 test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
 {
@@ -1040,7 +1013,8 @@ igt_main
 			test_hpd_without_ddc(&data, port);
 
 		connector_subtest("vga-frame-dump", VGA)
-			test_analog_frame_dump(&data, port);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_ANALOG, 1);
 	}
 
 	igt_subtest_group {
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 4/8
#6 lore raw

Re: [igt-dev] [PATCH RESEND i-g-t 4/8] igt: tests: chamelium: Convert VGA tests to do_test_display

Hi,

Quoted 9 lines · Maxime Ripard

The VGA tests were run so far as part of a separate function. However, the only difference between that function and the do_test_display function was the kind of comparison we wanted to use. Indeed, VGA being an analog output, we can't rely on a pixel perfect image, and thus only compare the CRCs, but we need to make some more advanced comparison.

Let's add a new check method, add support for the analog check to do_test_display and remove the old version.

Quoted 161 lines
---
 tests/kms_chamelium.c | 92 ++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 59 deletions(-)
tests/kms_chamelium.c +33 -59
index 8b9872a17044..80b279c4f1c2 100644
@@ -527,6 +527,7 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
 }
 
 enum chamelium_check {
+	CHAMELIUM_CHECK_ANALOG,
 	CHAMELIUM_CHECK_CRC,
 };
 
@@ -578,6 +579,18 @@ static void do_test_display(data_t *data, struct chamelium_port *port,
 
 		free(expected_crc);
 		free(crc);
+	} else if (check == CHAMELIUM_CHECK_ANALOG) {
+		struct chamelium_frame_dump *dump;
+
+		igt_assert(count == 1);
+
+		dump = chamelium_port_dump_pixels(data->chamelium, port, 0, 0,
+						  0, 0);
+		chamelium_crop_analog_frame(dump, mode->hdisplay,
+					    mode->vdisplay);
+		chamelium_assert_analog_frame_match_or_dump(data->chamelium,
+							    port, dump, &fb);
+		chamelium_destroy_frame_dump(dump);
 	}
 
 	igt_remove_fb(data->drm_fd, &frame_fb);
@@ -588,8 +601,9 @@ static void test_display_one_mode(data_t *data, struct chamelium_port *port,
 				  uint32_t fourcc, enum chamelium_check check,
 				  int count)
 {
-	igt_output_t *output;
 	drmModeConnector *connector;
+	drmModeModeInfo *mode;
+	igt_output_t *output;
 	igt_plane_t *primary;
 
 	reset_state(data, port);
@@ -599,8 +613,14 @@ static void test_display_one_mode(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
-	do_test_display(data, port, output, &connector->modes[0], fourcc,
-			check, count);
+	mode = &connector->modes[0];
+	if (check == CHAMELIUM_CHECK_ANALOG) {
+		bool bridge = check_analog_bridge(data, port);
+
+		igt_assert(!(bridge && prune_vga_mode(data, mode)));
+	}
+
+	do_test_display(data, port, output, mode, fourcc, check, count);
 
 	drmModeFreeConnector(connector);
 }
@@ -612,6 +632,7 @@ static void test_display_all_modes(data_t *data, struct chamelium_port *port,
 	igt_output_t *output;
 	igt_plane_t *primary;
 	drmModeConnector *connector;
+	bool bridge;
 	int i;
 
 	reset_state(data, port);
@@ -621,9 +642,16 @@ static void test_display_all_modes(data_t *data, struct chamelium_port *port,
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
 
+	if (check == CHAMELIUM_CHECK_ANALOG)
+		bridge = check_analog_bridge(data, port);
+
 	for (i = 0; i < connector->count_modes; i++) {
 		drmModeModeInfo *mode = &connector->modes[i];
 
+		if (check == CHAMELIUM_CHECK_ANALOG && bridge &&
+		    prune_vga_mode(data, mode))
+			continue;
+
 		do_test_display(data, port, output, mode, fourcc, check, count);
 	}
 
@@ -674,61 +702,6 @@ test_display_frame_dump(data_t *data, struct chamelium_port *port)
 	drmModeFreeConnector(connector);
 }
 
-static void
-test_analog_frame_dump(data_t *data, struct chamelium_port *port)
-{
-	igt_output_t *output;
-	igt_plane_t *primary;
-	struct igt_fb fb;
-	struct chamelium_frame_dump *frame;
-	drmModeModeInfo *mode;
-	drmModeConnector *connector;
-	int fb_id, i;
-	bool bridge;
-
-	reset_state(data, port);
-
-	output = prepare_output(data, port);
-	connector = chamelium_port_get_connector(data->chamelium, port, false);
-	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-	igt_assert(primary);
-
-	bridge = check_analog_bridge(data, port);
-
-	for (i = 0; i < connector->count_modes; i++) {
-		mode = &connector->modes[i];
-
-		if (bridge && prune_vga_mode(data, mode))
-			continue;
-
-		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);
-		igt_assert(fb_id > 0);
-
-		enable_output(data, port, output, mode, &fb);
-
-		igt_debug("Reading frame dumps from Chamelium...\n");
-
-		frame = chamelium_port_dump_pixels(data->chamelium, port, 0, 0,
-						   0, 0);
-
-		chamelium_crop_analog_frame(frame, mode->hdisplay,
-					    mode->vdisplay);
-
-		chamelium_assert_analog_frame_match_or_dump(data->chamelium,
-							    port, frame, &fb);
-
-		chamelium_destroy_frame_dump(frame);
-
-		igt_remove_fb(data->drm_fd, &fb);
-	}
-
-	drmModeFreeConnector(connector);
-}
-
 static void
 test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
 {
@@ -1040,7 +1013,8 @@ igt_main
 			test_hpd_without_ddc(&data, port);
 
 		connector_subtest("vga-frame-dump", VGA)
-			test_analog_frame_dump(&data, port);
+			test_display_all_modes(&data, port, DRM_FORMAT_XRGB8888,
+					       CHAMELIUM_CHECK_ANALOG, 1);
 	}
 
 	igt_subtest_group {
Signature · 8 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw

PATCH RESEND 5/8 igt: fb: Move i915 buffer allocation to a function of its own

In reply to Maxime Ripard

The create_bo_for_fb function has a rather big, non trivial block of code to allocate buffers in some non-trivial situation on the i915 driver.

Since this is both non-trivial and driver specific, move that code into a function of its own so that we can rework that function later on.

---
 lib/igt_fb.c | 89 +++++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 42 deletions(-)
lib/igt_fb.c +47 -42
index 2462d6ba6fab..d96689aa5fe6 100644
@@ -453,6 +453,52 @@ uint64_t igt_fb_tiling_to_mod(uint64_t tiling)
 	}
 }
 
+static int i915_create_gem_for_fb(struct igt_fb *fb)
+{
+	bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
+	int fd = fb->fd;
+	void *ptr;
+
+	fb->gem_handle = gem_create(fd, fb->size);
+	gem_set_tiling(fd, fb->gem_handle,
+		       igt_fb_mod_to_tiling(fb->tiling),
+		       fb->strides[0]);
+
+	gem_set_domain(fd, fb->gem_handle,
+		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
+	/* Ensure the framebuffer is preallocated */
+	ptr = gem_mmap__gtt(fd, fb->gem_handle,
+			    fb->size, PROT_READ | PROT_WRITE);
+	igt_assert(*(uint32_t *)ptr == 0);
+
+	switch (fb->drm_format) {
+	case DRM_FORMAT_NV12:
+		memset(ptr + fb->offsets[0],
+		       full_range ? 0x00 : 0x10,
+		       fb->strides[0] * fb->plane_height[0]);
+		memset(ptr + fb->offsets[1],
+		       0x80,
+		       fb->strides[1] * fb->plane_height[1]);
+		break;
+	case DRM_FORMAT_YUYV:
+	case DRM_FORMAT_YVYU:
+		wmemset(ptr + fb->offsets[0],
+			full_range ? 0x80008000 : 0x80108010,
+			fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
+		break;
+	case DRM_FORMAT_UYVY:
+	case DRM_FORMAT_VYUY:
+		wmemset(ptr + fb->offsets[0],
+			full_range ? 0x00800080 : 0x10801080,
+			fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
+		break;
+	}
+	gem_munmap(ptr, fb->size);
+
+	return fb->gem_handle;
+}
+
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(struct igt_fb *fb)
 {
@@ -470,48 +516,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
 		fb->is_dumb = false;
 
 		if (is_i915_device(fd)) {
-			void *ptr;
-			bool full_range = fb->color_range == IGT_COLOR_YCBCR_FULL_RANGE;
-
-			fb->gem_handle = gem_create(fd, fb->size);
-
-			gem_set_tiling(fd, fb->gem_handle,
-				       igt_fb_mod_to_tiling(fb->tiling),
-				       fb->strides[0]);
-
-			gem_set_domain(fd, fb->gem_handle,
-				       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
-			/* Ensure the framebuffer is preallocated */
-			ptr = gem_mmap__gtt(fd, fb->gem_handle,
-					    fb->size, PROT_READ | PROT_WRITE);
-			igt_assert(*(uint32_t *)ptr == 0);
-
-			switch (fb->drm_format) {
-			case DRM_FORMAT_NV12:
-				memset(ptr + fb->offsets[0],
-				       full_range ? 0x00 : 0x10,
-				       fb->strides[0] * fb->plane_height[0]);
-				memset(ptr + fb->offsets[1],
-				       0x80,
-				       fb->strides[1] * fb->plane_height[1]);
-				break;
-			case DRM_FORMAT_YUYV:
-			case DRM_FORMAT_YVYU:
-				wmemset(ptr + fb->offsets[0],
-					full_range ? 0x80008000 : 0x80108010,
-					fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
-				break;
-			case DRM_FORMAT_UYVY:
-			case DRM_FORMAT_VYUY:
-				wmemset(ptr + fb->offsets[0],
-					full_range ? 0x00800080 : 0x10801080,
-					fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
-				break;
-			}
-			gem_munmap(ptr, fb->size);
-
-			return fb->gem_handle;
+			return i915_create_gem_for_fb(fb);
 		} else {
 			bool driver_has_gem_api = false;
 
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#8 lore raw

PATCH RESEND 6/8 igt: fb: Separate YUV allocation from the rest

In reply to Maxime Ripard

Allocating YUV buffers is a different operation than allocating buffers with non-trivial setups.

Let's separate the YUV buffer allocation to a case and function of its own.

---
 lib/igt_fb.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
lib/igt_fb.c +19 -1
index d96689aa5fe6..d6242a6652f1 100644
@@ -499,12 +499,30 @@ static int i915_create_gem_for_fb(struct igt_fb *fb)
 	return fb->gem_handle;
 }
 
+static int create_yuv_bo_for_fb(struct igt_fb *fb)
+{
+	uint64_t size = calc_fb_size(fb);
+	int fd = fb->fd;
+
+	/* respect the size requested by the caller */
+	if (fb->size == 0)
+		fb->size = size;
+
+	if (is_i915_device(fd))
+		return i915_create_gem_for_fb(fb);
+
+	/* We cannot allocate any other buffer type */
+	igt_assert(true);
+}
+
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(struct igt_fb *fb)
 {
 	int fd = fb->fd;
 
-	if (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format)) {
+	if (igt_format_is_yuv(fb->drm_format)) {
+		return create_yuv_bo_for_fb(fb);
+	} else if (fb->tiling || fb->size || fb->strides[0]) {
 		uint64_t size;
 
 		size = calc_fb_size(fb);
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#9 lore raw

PATCH RESEND 7/8 igt: fb: Fallback on KMS dumb buffer allocation for YUV buffers

In reply to Maxime Ripard

The current YUV buffer allocation only works on the i915 driver, since it uses some private ioctl. However, we can to use that code on other drivers that implement only KMS, so if the driver is something else than the i915 driver, let's allocate a dumb buffer.

---
 lib/igt_fb.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
lib/igt_fb.c +33 -2
index d6242a6652f1..f2e6c89f3884 100644
@@ -501,6 +501,8 @@ static int i915_create_gem_for_fb(struct igt_fb *fb)
 
 static int create_yuv_bo_for_fb(struct igt_fb *fb)
 {
+	unsigned int virtual_height;
+	unsigned int bpp;
 	uint64_t size = calc_fb_size(fb);
 	int fd = fb->fd;
 
@@ -511,8 +513,37 @@ static int create_yuv_bo_for_fb(struct igt_fb *fb)
 	if (is_i915_device(fd))
 		return i915_create_gem_for_fb(fb);
 
-	/* We cannot allocate any other buffer type */
-	igt_assert(true);
+	switch (fb->drm_format) {
+	case DRM_FORMAT_NV12:
+		bpp = 8;
+		break;
+
+	case DRM_FORMAT_UYVY:
+	case DRM_FORMAT_VYUY:
+	case DRM_FORMAT_YUYV:
+	case DRM_FORMAT_YVYU:
+		bpp = 16;
+		break;
+
+	default:
+		igt_assert_f(false, "Unsupported YUV format\n");
+	}
+
+	switch (fb->drm_format) {
+	case DRM_FORMAT_NV12:
+		virtual_height = fb->height * 3 / 2;
+		break;
+
+	default:
+		virtual_height = fb->height;
+		break;
+	}
+
+	fb->is_dumb = true;
+	fb->gem_handle = kmstest_dumb_create(fd, fb->width, virtual_height,
+					     bpp, NULL, &fb->size);
+
+	return fb->gem_handle;
 }
 
 /* helpers to create nice-looking framebuffers */
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#10 lore raw

Re: [igt-dev] [PATCH RESEND i-g-t 7/8] igt: fb: Fallback on KMS dumb buffer allocation for YUV buffers

Hi,

Quoted 30 lines · Maxime Ripard

The current YUV buffer allocation only works on the i915 driver, since it uses some private ioctl. However, we can to use that code on other drivers that implement only KMS, so if the driver is something else than the i915 driver, let's allocate a dumb buffer.

---
 lib/igt_fb.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
lib/igt_fb.c +3 -2
index d6242a6652f1..f2e6c89f3884 100644
@@ -501,6 +501,8 @@ static int i915_create_gem_for_fb(struct igt_fb *fb)
 
 static int create_yuv_bo_for_fb(struct igt_fb *fb)
 {
+	unsigned int virtual_height;
+	unsigned int bpp;
 	uint64_t size = calc_fb_size(fb);
 	int fd = fb->fd;
 
@@ -511,8 +513,37 @@ static int create_yuv_bo_for_fb(struct igt_fb *fb)
 	if (is_i915_device(fd))
 		return i915_create_gem_for_fb(fb);
 
-	/* We cannot allocate any other buffer type */
-	igt_assert(true);
+	switch (fb->drm_format) {

lib/igt_fb.c static int create_yuv_bo_for_fb(struct igt_fb *fb) · line 526

Quoted 10 lines
lib/igt_fb.c +10 -0
+	case DRM_FORMAT_NV12:
+		bpp = 8;
+		break;
+
+	case DRM_FORMAT_UYVY:
+	case DRM_FORMAT_VYUY:
+	case DRM_FORMAT_YUYV:
+	case DRM_FORMAT_YVYU:
+		bpp = 16;
+		break;

It's probably not necessary to duplicate the bpp here since it's already described in the format_desc array, from which it gets copied to the fb->plane_bpp[i] before calling this function. You can probably reuse it from there directly.

lib/igt_fb.c static int create_yuv_bo_for_fb(struct igt_fb *fb) · line 534

Quoted 7 lines
lib/igt_fb.c +7 -0
+	default:
+		igt_assert_f(false, "Unsupported YUV format\n");
+	}
+
+	switch (fb->drm_format) {
+	case DRM_FORMAT_NV12:
+		virtual_height = fb->height * 3 / 2;

If this is the correct way to go for allocating two planes at once, perhaps there should be a comment about it to clarify the meaning of this operation?

Also, this could probably be generalized to other formats with two (or three) planes by using each plane's bpp.

What do yout think?

Cheers,

Paul

Quoted 15 lines
lib/igt_fb.c +12 -0
+		break;
+
+	default:
+		virtual_height = fb->height;
+		break;
+	}
+
+	fb->is_dumb = true;
+	fb->gem_handle = kmstest_dumb_create(fd, fb->width, virtual_height,
+					     bpp, NULL, &fb->size);
+
+	return fb->gem_handle;
 }
 
 /* helpers to create nice-looking framebuffers */
Signature · 8 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#11 lore raw

PATCH RESEND 8/8 igt: tests: chamelium: Add NV12 format

In reply to Maxime Ripard

The NV12 is a YUV format that are currently supported in IGT.

We'll want to test those formats in addition to the RGB formats, so let's add some subtests. One thing worth noting is some hardware isn't able to output a pixel-perfect image, so we do the same kind of comparison than for VGA.

---
 tests/kms_chamelium.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/kms_chamelium.c +4 -0
index 80b279c4f1c2..8a9f6bfe9235 100644
@@ -976,6 +976,10 @@ igt_main
 			test_display_one_mode(&data, port, DRM_FORMAT_XRGB1555,
 					      CHAMELIUM_CHECK_CRC, 1);
 
+		connector_subtest("hdmi-crc-nv12", HDMIA)
+			test_display_one_mode(&data, port, DRM_FORMAT_NV12,
+					      CHAMELIUM_CHECK_ANALOG, 1);
+
 		connector_subtest("hdmi-frame-dump", HDMIA)
 			test_display_frame_dump(&data, port);
 	}
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#12 lore raw

Re: [igt-dev] [PATCH RESEND i-g-t 8/8] igt: tests: chamelium: Add NV12 format

Hi,

Quoted 17 lines · Maxime Ripard

The NV12 is a YUV format that are currently supported in IGT.

We'll want to test those formats in addition to the RGB formats, so let's add some subtests. One thing worth noting is some hardware isn't able to output a pixel-perfect image, so we do the same kind of comparison than for VGA.

---
 tests/kms_chamelium.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/kms_chamelium.c +0 -0
index 80b279c4f1c2..8a9f6bfe9235 100644

tests/kms_chamelium.c igt_main · line 979

Quoted 4 lines
tests/kms_chamelium.c +1 -0
@@ -976,6 +976,10 @@ igt_main
 			test_display_one_mode(&data, port, DRM_FORMAT_XRGB1555,
 					      CHAMELIUM_CHECK_CRC, 1);
 
+		connector_subtest("hdmi-crc-nv12", HDMIA)

Well, since the test does not rely on a CRC but on an error-trend comparison, maybe it should be named differently?

Cheers,

Paul

Quoted 6 lines
tests/kms_chamelium.c +3 -0
+			test_display_one_mode(&data, port, DRM_FORMAT_NV12,
+					      CHAMELIUM_CHECK_ANALOG, 1);
+
 		connector_subtest("hdmi-frame-dump", HDMIA)
 			test_display_frame_dump(&data, port);
 	}
Signature · 8 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#13 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for igt: chamelium: Test YUV buffers using the Chamelium (rev2)

In reply to Maxime Ripard
== Series Details ==

== Series Details ==

Series: igt: chamelium: Test YUV buffers using the Chamelium (rev2)
URL : https://patchwork.freedesktop.org/series/53468/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5253 -> IGTPW_2116
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/53468/revisions/2/mbox/

Known issues
------------

Here are the changes found in IGTPW_2116 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_close_race@basic-threads:
- fi-bsw-kefka: PASS -> FAIL [fdo#108656]
- fi-bsw-n3050: PASS -> INCOMPLETE [fdo#108714]

* igt@gem_exec_suspend@basic-s4-devices:
- fi-ivb-3520m: PASS -> FAIL [fdo#108880]

* igt@i915_selftest@live_hangcheck:
- fi-bwr-2160: PASS -> DMESG-FAIL [fdo#108735]

#### Possible fixes ####

* igt@gem_ctx_create@basic-files:
- fi-bsw-kefka: FAIL [fdo#108656] -> PASS

[fdo#108656]: https://bugs.freedesktop.org/show_bug.cgi?id=108656
[fdo#108714]: https://bugs.freedesktop.org/show_bug.cgi?id=108714
[fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
[fdo#108880]: https://bugs.freedesktop.org/show_bug.cgi?id=108880

Participating hosts (48 -> 42)
------------------------------

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-7560u

Build changes
-------------

* IGT: IGT_4738 -> IGTPW_2116

CI_DRM_5253: d29c92fb8c6f2523de72be55815c283b4cec577d @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2116: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2116/
IGT_4738: 14c1b132c8f829637c55fb071a9a2e5ce00e7ed8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@kms_chamelium@hdmi-crc-nv12

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2116/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#14 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for igt: chamelium: Test YUV buffers using the Chamelium (rev2)

In reply to Maxime Ripard
== Series Details ==

== Series Details ==

Series: igt: chamelium: Test YUV buffers using the Chamelium (rev2)
URL : https://patchwork.freedesktop.org/series/53468/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5253_full -> IGTPW_2116_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with IGTPW_2116_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_2116_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/53468/revisions/2/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2116_full:

### IGT changes ###

#### Possible regressions ####

* {igt@kms_plane@pixel-format-pipe-a-planes-source-clamping}:
- shard-apl: PASS -> FAIL

* {igt@kms_plane@pixel-format-pipe-b-planes-source-clamping}:
- shard-glk: PASS -> FAIL

#### Warnings ####

* {igt@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-kbl: DMESG-WARN [fdo#105604] -> DMESG-FAIL

* igt@pm_rc6_residency@rc6-accuracy:
- shard-kbl: PASS -> SKIP

* igt@tools_test@sysfs_l3_parity:
- shard-hsw: SKIP -> PASS

Known issues
------------

Here are the changes found in IGTPW_2116_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
- shard-apl: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-kbl: PASS -> FAIL [fdo#107725] / [fdo#108145]

* igt@kms_cursor_crc@cursor-128x42-onscreen:
- shard-apl: PASS -> FAIL [fdo#103232] +2

* igt@kms_cursor_crc@cursor-64x64-dpms:
- shard-kbl: PASS -> FAIL [fdo#103232] +2

* igt@kms_cursor_crc@cursor-size-change:
- shard-glk: PASS -> FAIL [fdo#103232] +2

* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: PASS -> FAIL [fdo#105363]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
- shard-kbl: PASS -> FAIL [fdo#103167] +1

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: PASS -> FAIL [fdo#103167] +5

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-glk: PASS -> FAIL [fdo#103167] +11

* igt@kms_frontbuffer_tracking@fbc-2p-rte:
- shard-glk: PASS -> FAIL [fdo#103167] / [fdo#105682]

* igt@kms_plane@pixel-format-pipe-b-planes:
- shard-kbl: PASS -> FAIL [fdo#103166] +2
- shard-apl: NOTRUN -> FAIL [fdo#103166]

* igt@kms_plane@pixel-format-pipe-c-planes:
- shard-apl: PASS -> FAIL [fdo#103166] +1

* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-apl: PASS -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
- shard-glk: PASS -> FAIL [fdo#108145] +2

* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-glk: PASS -> FAIL [fdo#103166] +8

* igt@kms_setmode@basic:
- shard-apl: PASS -> FAIL [fdo#99912]

#### Possible fixes ####

* igt@gem_exec_reuse@baggage:
- shard-apl: INCOMPLETE [fdo#103927] -> PASS

* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: FAIL [fdo#106641] -> PASS

* igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
- shard-kbl: FAIL [fdo#107725] / [fdo#108145] -> PASS

* igt@kms_cursor_crc@cursor-128x42-sliding:
- shard-kbl: FAIL [fdo#103232] -> PASS
- shard-apl: FAIL [fdo#103232] -> PASS +1

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
- shard-apl: FAIL [fdo#103167] -> PASS

* {igt@kms_plane@pixel-format-pipe-c-planes-source-clamping}:
- shard-glk: FAIL -> PASS

* igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
- shard-kbl: FAIL [fdo#103166] -> PASS

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: FAIL [fdo#103166] -> PASS +2

* igt@kms_setmode@basic:
- shard-kbl: FAIL [fdo#99912] -> PASS

* igt@perf@blocking:
- shard-hsw: FAIL [fdo#102252] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102252]: https://bugs.freedesktop.org/show_bug.cgi?id=102252
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107725]: https://bugs.freedesktop.org/show_bug.cgi?id=107725
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 5)
------------------------------

Missing (2): shard-skl shard-iclb

Build changes
-------------

* IGT: IGT_4738 -> IGTPW_2116
* Piglit: piglit_4509 -> None

CI_DRM_5253: d29c92fb8c6f2523de72be55815c283b4cec577d @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2116: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2116/
IGT_4738: 14c1b132c8f829637c55fb071a9a2e5ce00e7ed8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2116/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev