All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Wood <thomas.wood@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 3/3] tests: add kms_3d test
Date: Wed, 20 Aug 2014 11:54:09 +0100	[thread overview]
Message-ID: <1408532049-9215-3-git-send-email-thomas.wood@intel.com> (raw)
In-Reply-To: <1408532049-9215-1-git-send-email-thomas.wood@intel.com>

Add a test to verify creation and use of 3D stereo modes.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_fb.c           |   4 +-
 tests/.gitignore       |   1 +
 tests/Android.mk       |   1 +
 tests/Makefile.sources |   1 +
 tests/kms_3d.c         | 118 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 123 insertions(+), 2 deletions(-)
 create mode 100644 tests/kms_3d.c

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 9a13969..0096836 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -614,10 +614,10 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode)
 				  enable_tiling, &fb);
 	cr = igt_get_cairo_ctx(drm_fd, &fb);
 
-	igt_paint_image(cr, IGT_DATADIR"1080p-left.png",
+	igt_paint_image(cr, IGT_DATADIR"/1080p-left.png",
 			    layout.left.x, layout.left.y,
 			    layout.left.width, layout.left.height);
-	igt_paint_image(cr, IGT_DATADIR"1080p-right.png",
+	igt_paint_image(cr, IGT_DATADIR"/1080p-right.png",
 			    layout.right.x, layout.right.y,
 			    layout.right.width, layout.right.height);
 
diff --git a/tests/.gitignore b/tests/.gitignore
index 3da061e..9b5cf7d 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -116,6 +116,7 @@ igt_no_exit
 igt_no_exit_list_only
 igt_no_subtest
 igt_simulation
+kms_3d
 kms_addfb
 kms_cursor_crc
 kms_fbc_crc
diff --git a/tests/Android.mk b/tests/Android.mk
index 3644aa1..f28b400 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -55,6 +55,7 @@ ifeq ("${ANDROID_HAS_CAIRO}", "1")
 else
 # the following tests depend on cairo, so skip them
     skip_tests_list += \
+    kms_3d \
     kms_plane \
     kms_addfb \
     kms_cursor_crc \
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 698e290..078df57 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -141,6 +141,7 @@ TESTS_progs = \
 	gen3_render_tiledx_blits \
 	gen3_render_tiledy_blits \
 	gen7_forcewake_mt \
+	kms_3d \
 	kms_force_connector \
 	kms_sink_crc_basic \
 	kms_fence_pin_leak \
diff --git a/tests/kms_3d.c b/tests/kms_3d.c
new file mode 100644
index 0000000..c593f34
--- /dev/null
+++ b/tests/kms_3d.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt_core.h"
+#include "igt_kms.h"
+#include "drmtest.h"
+#include "igt_edid.h"
+
+igt_simple_main
+{
+	int drm_fd;
+	drmModeRes *res;
+	drmModeConnector *connector;
+	unsigned char *edid;
+	size_t length;
+	int mode_count, connector_id;
+
+	drm_fd = drm_open_any();
+	res = drmModeGetResources(drm_fd);
+
+	igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) >= 0);
+
+	/* find an hdmi connector */
+	for (int i = 0; i < res->count_connectors; i++) {
+
+		connector = drmModeGetConnector(drm_fd, res->connectors[i]);
+
+		if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA &&
+		    connector->connection == DRM_MODE_DISCONNECTED)
+			break;
+
+		drmModeFreeConnector(connector);
+
+		connector = NULL;
+	}
+	igt_require(connector);
+
+	kmstest_edid_add_3d(generic_edid[EDID_FHD], EDID_LENGTH, &edid,
+			    &length);
+
+	kmstest_force_edid(drm_fd, connector, edid, length);
+	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON);
+
+	connector_id = connector->connector_id;
+
+	/* check for 3D modes */
+	mode_count = 0;
+	connector = drmModeGetConnector(drm_fd, connector_id);
+	for (int i = 0; i < connector->count_modes; i++) {
+		if (connector->modes[i].flags & DRM_MODE_FLAG_3D_MASK)
+			mode_count++;
+	}
+
+	igt_assert(mode_count == 13);
+
+	/* set 3D modes */
+	igt_info("Testing:\n");
+	for (int i = 0; i < connector->count_modes; i++) {
+		int fb_id;
+		struct kmstest_connector_config config;
+		int crtc_mask = -1;
+		int ret;
+
+		if (!(connector->modes[i].flags & DRM_MODE_FLAG_3D_MASK))
+			continue;
+
+		/* create a configuration */
+		ret = kmstest_get_connector_config(drm_fd, connector_id,
+						   crtc_mask, &config);
+		if (ret != true) {
+			igt_info("Error creating configuration for:\n  ");
+			kmstest_dump_mode(&connector->modes[i]);
+
+			continue;
+		}
+
+		igt_info("  ");
+		kmstest_dump_mode(&connector->modes[i]);
+
+		/* create stereo framebuffer */
+		fb_id = igt_create_stereo_fb(drm_fd, &connector->modes[i]);
+
+		ret = drmModeSetCrtc(drm_fd, config.crtc->crtc_id, fb_id, 0, 0,
+				     &connector->connector_id, 1,
+				     &connector->modes[i]);
+
+		igt_assert(ret == 0);
+	}
+
+	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
+	kmstest_force_edid(drm_fd, connector, NULL, 0);
+
+	drmModeFreeConnector(connector);
+	free(edid);
+
+	igt_exit();
+}
-- 
1.9.3

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

  parent reply	other threads:[~2014-08-20 10:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 10:54 [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d Thomas Wood
2014-08-20 10:54 ` [PATCH i-g-t 2/3] lib: move create_stereo_fb from testdisplay to igt_fb Thomas Wood
2014-08-20 10:54 ` Thomas Wood [this message]
2014-08-26 13:38   ` [PATCH i-g-t 3/3] tests: add kms_3d test Damien Lespiau
2014-08-26 13:43 ` [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d Damien Lespiau
2014-09-04 19:57 ` Clint Taylor
2014-09-05  9:52   ` [PATCH i-g-t v2 0/6] 3D stereo mode testing Thomas Wood
2014-09-05  9:52     ` [PATCH i-g-t v2 1/6] lib: add kmstest_edid_add_3d Thomas Wood
2014-09-05  9:52     ` [PATCH i-g-t v2 2/6] lib: move create_stereo_fb from testdisplay to igt_fb Thomas Wood
2014-09-05  9:52     ` [PATCH i-g-t v2 3/6] tests: add kms_3d test Thomas Wood
2014-09-05  9:52     ` [PATCH i-g-t v2 4/6] lib/igt_fb: ensure igt_create_fb parameters are consistent Thomas Wood
2014-09-05  9:52     ` [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8 Thomas Wood
2014-09-05 12:15       ` Daniel Vetter
2014-09-09 12:42         ` Ville Syrjälä
2014-09-05  9:52     ` [PATCH i-g-t v2 6/6] tests/kms_3d: skip if connectors cannot be forced Thomas Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408532049-9215-3-git-send-email-thomas.wood@intel.com \
    --to=thomas.wood@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.