summaryrefslogtreecommitdiff
path: root/tests/kms_chamelium.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2018-10-04 14:39:07 +0200
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2018-10-08 16:58:13 +0300
commitc55a8c6fac4739b34007afc25b4d821734bd630d (patch)
tree6d3eb214ee8025e5e5b16242e8b9ab9e48487e76 /tests/kms_chamelium.c
parent9aecda27ffda312e4ecb3b85342da335e38f6538 (diff)
chamelium: Add format support
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@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'tests/kms_chamelium.c')
-rw-r--r--tests/kms_chamelium.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index d6d0f315..0c082f9c 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -524,22 +524,26 @@ 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;
fb_id = chamelium_get_pattern_fb(data, mode,
DRM_FORMAT_XRGB8888, &fb);
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
@@ -563,11 +567,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;
@@ -580,13 +585,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;
@@ -603,7 +608,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);
@@ -864,13 +869,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);
@@ -928,13 +936,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);