[igt-dev] [PATCH v6 11/13] chamelium: Add format support
Maxime Ripard
maxime.ripard at bootlin.com
Fri Aug 31 13:12:20 UTC 2018
In order to introduce CRC subtests for DRM formats, we need to take an
intermediate step.
The current code will generate a pattern in XR24, and will try to compare
the CRC returned by the Chamelium for each frames.
This CRC is computed on an XR24 format as well, so it works. However, as
soon as we will start implementing other formats, if we just change the
format of the pattern, the raw content of the buffer, and therefore the
CRC's won't match anymore.
In order to address that, we will need an intermediate step, and we will
now still create the XR24 pattern, and compute its CRC, then convert it to
the format we want to test, and finally retrieve the CRC from the Chamelium
to compare it with the one from the XR24 pattern.
The current code is converted to the new prototype that will take the
fourcc of the format to test, even though we're still using XR24 everywhere
for now.
Reviewed-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
tests/kms_chamelium.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 8d2b3f8e170d..dbc020459a75 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -524,13 +524,14 @@ static int chamelium_get_pattern_fb(data_t *data, drmModeModeInfo *mode,
static void do_test_display_crc(data_t *data, struct chamelium_port *port,
igt_output_t *output, drmModeModeInfo *mode,
- int count)
+ uint32_t fourcc, int count)
{
igt_crc_t *crc;
igt_crc_t *expected_crc;
struct chamelium_fb_crc_async_data *fb_crc;
- struct igt_fb fb;
+ struct igt_fb frame_fb, fb;
int i, fb_id, captured_frame_count;
+ int frame_id;
/*
* We only need to create a custom pattern if we want to
@@ -551,10 +552,13 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
igt_assert(fb_id > 0);
+ 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);
- enable_output(data, port, output, mode, &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
@@ -578,11 +582,12 @@ static void do_test_display_crc(data_t *data, struct chamelium_port *port,
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,
- int count)
+ uint32_t fourcc, int count)
{
igt_output_t *output;
drmModeConnector *connector;
@@ -595,13 +600,13 @@ 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], count);
+ do_test_display_crc(data, port, output, &connector->modes[0], fourcc, count);
drmModeFreeConnector(connector);
}
static void test_display_crc_all_modes(data_t *data, struct chamelium_port *port,
- int count)
+ uint32_t fourcc, int count)
{
igt_output_t *output;
igt_plane_t *primary;
@@ -618,7 +623,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, count);
+ do_test_display_crc(data, port, output, mode, fourcc, count);
}
drmModeFreeConnector(connector);
@@ -879,13 +884,16 @@ igt_main
edid_id, alt_edid_id);
connector_subtest("dp-crc-single", DisplayPort)
- test_display_crc_all_modes(&data, port, 1);
+ test_display_crc_all_modes(&data, port,
+ DRM_FORMAT_XRGB8888, 1);
connector_subtest("dp-crc-fast", DisplayPort)
- test_display_crc_one_mode(&data, port, 1);
+ test_display_crc_one_mode(&data, port,
+ DRM_FORMAT_XRGB8888, 1);
connector_subtest("dp-crc-multiple", DisplayPort)
- test_display_crc_all_modes(&data, port, 3);
+ test_display_crc_all_modes(&data, port,
+ DRM_FORMAT_XRGB8888, 3);
connector_subtest("dp-frame-dump", DisplayPort)
test_display_frame_dump(&data, port);
@@ -943,13 +951,16 @@ igt_main
edid_id, alt_edid_id);
connector_subtest("hdmi-crc-single", HDMIA)
- test_display_crc_all_modes(&data, port, 1);
+ test_display_crc_all_modes(&data, port,
+ DRM_FORMAT_XRGB8888, 1);
connector_subtest("hdmi-crc-fast", HDMIA)
- test_display_crc_one_mode(&data, port, 1);
+ test_display_crc_one_mode(&data, port,
+ DRM_FORMAT_XRGB8888, 1);
connector_subtest("hdmi-crc-multiple", HDMIA)
- test_display_crc_all_modes(&data, port, 3);
+ test_display_crc_all_modes(&data, port,
+ DRM_FORMAT_XRGB8888, 3);
connector_subtest("hdmi-frame-dump", HDMIA)
test_display_frame_dump(&data, port);
--
git-series 0.9.1
More information about the igt-dev
mailing list