[PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This test actually *fails* in GLK and possibly SKL and others too. When
using limited range, the pipe crc when using the cursor plane is
different than the one when using an overlay plane, although the fb and
plane position is the same.

Since this test fails it should probably not be merged, but it is here
to prove the point of the previous patch.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx>
---
 tests/Makefile.sources     |   1 +
 tests/kms_cursor_limited.c | 175 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 176 insertions(+)
 create mode 100644 tests/kms_cursor_limited.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 45c21a0..c7d36f6 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -99,6 +99,7 @@ TESTS_progs_M = \
 	kms_chv_cursor_fail \
 	kms_cursor_crc \
 	kms_cursor_legacy \
+	kms_cursor_limited \
 	kms_draw_crc \
 	kms_fbc_crc \
 	kms_fbcon_fbt \
diff --git a/tests/kms_cursor_limited.c b/tests/kms_cursor_limited.c
new file mode 100644
index 0000000..88c130c
--- /dev/null
+++ b/tests/kms_cursor_limited.c
@@ -0,0 +1,175 @@
+#include "igt.h"
+
+typedef struct {
+	int drm_fd;
+	igt_display_t display;
+	struct igt_fb primary_fb;
+	struct igt_fb fb;
+	int fb_w, fb_h;
+	igt_output_t *output;
+	enum pipe pipe;
+	igt_pipe_crc_t *pipe_crc;
+} data_t;
+
+static void cursor_enable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *cursor;
+
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_fb(cursor, &data->fb);
+	igt_plane_set_size(cursor, data->fb_w, data->fb_h);
+}
+
+static void cursor_disable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *cursor;
+
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_fb(cursor, NULL);
+}
+
+static void overlay_enable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *overlay;
+
+	overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_fb(overlay, &data->fb);
+	igt_plane_set_size(overlay, data->fb_w, data->fb_h);
+}
+
+static void overlay_disable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *overlay;
+
+	overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_fb(overlay, NULL);
+}
+
+static void create_fb(data_t *data)
+{
+	uint32_t fb_id;
+
+	fb_id = igt_create_color_fb(data->drm_fd, data->fb_w, data->fb_h,
+				    DRM_FORMAT_ARGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.5, 0.5, 0.5,
+				    &data->fb);
+	igt_assert(fb_id);
+}
+
+static void prepare_crtc(data_t *data, igt_output_t *output, int w, int h)
+{
+	drmModeModeInfo *mode;
+	igt_display_t *display = &data->display;
+	igt_plane_t *primary;
+
+	/* select the pipe we want to use */
+	igt_output_set_pipe(output, data->pipe);
+	cursor_disable(data);
+
+	/* create and set the primary plane fb */
+	mode = igt_output_get_mode(output);
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 0.0, 0.0,
+			    &data->primary_fb);
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_set_fb(primary, &data->primary_fb);
+
+	igt_display_commit(display);
+
+	/* create the pipe_crc object for this pipe */
+	if (data->pipe_crc)
+		igt_pipe_crc_free(data->pipe_crc);
+
+	data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
+					  INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	data->fb_w = w;
+	data->fb_h = h;
+	create_fb(data);
+
+	/* make sure cursor is disabled */
+	cursor_disable(data);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+}
+
+static void do_single_test(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
+	igt_crc_t cursor_crc, overlay_crc;
+	igt_plane_t *cursor, *overlay;
+
+	cursor_enable(data);
+	cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_position(cursor, 0, 0);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &cursor_crc);
+
+	cursor_disable(data);
+	overlay_enable(data);
+	overlay = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_position(overlay, 0, 0);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &overlay_crc);
+
+	igt_assert_crc_equal(&cursor_crc, &overlay_crc);
+
+	overlay_disable(data);
+	igt_display_commit(display);
+}
+
+static void run_tests(data_t *data)
+{
+	enum pipe p;
+	igt_output_t *output;
+
+	struct {
+		const char *name;
+		enum kmstest_broadcast_rgb_mode mode;
+	} tests[] = {
+		{ .name = "full", .mode = BROADCAST_RGB_FULL },
+		{ .name = "limited", .mode = BROADCAST_RGB_16_235 },
+	};
+
+
+	for (int i = 0; i < ARRAY_SIZE(tests); i++) {
+		igt_subtest(tests[i].name) {
+			for_each_pipe_with_valid_output(&data->display, p, output) {
+				data->output = output;
+				data->pipe = p;
+
+				prepare_crtc(data, output, 64, 64);
+
+				kmstest_set_connector_broadcast_rgb(data->drm_fd,
+								    output->config.connector,
+								    tests[i].mode);
+
+				do_single_test(data);
+			}
+		}
+	}
+}
+
+static data_t data;
+
+igt_main
+{
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_init(&data.display, data.drm_fd);
+	}
+
+	run_tests(&data);
+}
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux