summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@linux.intel.com>2017-07-20 18:13:37 +0300
committerLyude <lyude@redhat.com>2017-07-20 13:13:05 -0400
commite246ff0d507a7fb1ddc8a839205f030ed44c21e5 (patch)
tree15480401b5ab5cce8fe3ba6a7af310294940c356 /tests
parent8cf32fe06c8f54bca11c485ccc1cc3899f9d81db (diff)
chamelium: Add support for VGA frame comparison testing
This adds support for VGA frame comparison testing with the reference generated from cairo. The retrieved frame from the chamelium is first cropped, as it contains the blanking intervals, through a dedicated helper. Another helper function asserts that the analog frame matches or dump it to png if not. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/chamelium.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/chamelium.c b/tests/chamelium.c
index 34448152..33ecc2e7 100644
--- a/tests/chamelium.c
+++ b/tests/chamelium.c
@@ -399,6 +399,10 @@ enable_output(data_t *data,
BROADCAST_RGB_FULL);
igt_display_commit(display);
+
+ if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
+ usleep(250000);
+
chamelium_port_wait_video_input_stable(data->chamelium, port,
HOTPLUG_TIMEOUT);
@@ -533,6 +537,56 @@ test_display_frame_dump(data_t *data, struct chamelium_port *port)
}
static void
+test_analog_frame_dump(data_t *data, struct chamelium_port *port)
+{
+ igt_display_t display;
+ 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;
+
+ output = prepare_output(data, &display, port);
+ connector = chamelium_port_get_connector(data->chamelium, port, false);
+ primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+ igt_assert(primary);
+
+ for (i = 0; i < connector->count_modes; i++) {
+ mode = &connector->modes[i];
+
+ 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);
+
+ disable_output(data, port, output);
+ igt_remove_fb(data->drm_fd, &fb);
+ }
+
+ drmModeFreeConnector(connector);
+ igt_display_fini(&display);
+}
+
+static void
test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
{
struct udev_monitor *mon = igt_watch_hotplug();
@@ -775,6 +829,9 @@ igt_main
connector_subtest("vga-hpd-without-ddc", VGA)
test_hpd_without_ddc(&data, port);
+
+ connector_subtest("vga-frame-dump", VGA)
+ test_analog_frame_dump(&data, port);
}
igt_subtest_group {