All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d
@ 2014-08-20 10:54 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
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Thomas Wood @ 2014-08-20 10:54 UTC (permalink / raw)
  To: intel-gfx

kmstest_edid_add_3d adds an EDID extension block with 3D support to a
copy of the specified EDID.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 81 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a414d96..eb898f8 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -657,6 +657,86 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 }
 
 /**
+ * kmstest_edid_add_3d:
+ * @edid: an existing valid edid block
+ * @length: length of @edid
+ * @new_edid_ptr: pointer to where the new edid will be placed
+ * @new_length: pointer to the size of the new edid
+ *
+ * Makes a copy of an existing edid block and adds an extension indicating
+ * stereo 3D capabilities.
+ */
+void kmstest_edid_add_3d(const unsigned char *edid, size_t length,
+			 unsigned char *new_edid_ptr[], size_t *new_length)
+{
+	unsigned char *new_edid;
+	int n_extensions;
+	char sum = 0;
+	int pos;
+	int i;
+	char cea_header_len = 4, video_block_len = 6, vsdb_block_len = 11;
+
+	igt_assert(new_edid_ptr != NULL && new_length != NULL);
+
+	*new_length = length + 128;
+
+	new_edid = calloc(*new_length, sizeof(char));
+	memcpy(new_edid, edid, length);
+	*new_edid_ptr = new_edid;
+
+	n_extensions = new_edid[126];
+	n_extensions++;
+	new_edid[126] = n_extensions;
+
+	/* recompute checksum */
+	for (i = 0; i < 127; i++) {
+		sum = sum + new_edid[i];
+	}
+	new_edid[127] = 256 - sum;
+
+	/* add a cea-861 extension block */
+	pos = length;
+	new_edid[pos++] = 0x2;
+	new_edid[pos++] = 0x3;
+	new_edid[pos++] = cea_header_len + video_block_len + vsdb_block_len;
+	new_edid[pos++] = 0x0;
+
+	/* video block (id | length) */
+	new_edid[pos++] = 2 << 5 | (video_block_len - 1);
+	new_edid[pos++] = 32 | 0x80; /* 1080p @ 24Hz | (native)*/
+	new_edid[pos++] = 5;         /* 1080i @ 60Hz */
+	new_edid[pos++] = 20;        /* 1080i @ 50Hz */
+	new_edid[pos++] = 4;         /* 720p @ 60Hz*/
+	new_edid[pos++] = 19;        /* 720p @ 50Hz*/
+
+	/* vsdb block ( id | length ) */
+	new_edid[pos++] = 3 << 5 | (vsdb_block_len - 1);
+	/* registration id */
+	new_edid[pos++] = 0x3;
+	new_edid[pos++] = 0xc;
+	new_edid[pos++] = 0x0;
+	/* source physical address */
+	new_edid[pos++] = 0x0;
+	new_edid[pos++] = 0x0;
+	/* Supports_AI ... etc */
+	new_edid[pos++] = 0x00;
+	/* Max TMDS Clock */
+	new_edid[pos++] = 0x00;
+	/* Latency present, HDMI Video Present */
+	new_edid[pos++] = 0x20;
+	/* HDMI Video */
+	new_edid[pos++] = 0x80;
+	new_edid[pos++] = 0x00;
+
+	/* checksum */
+	sum = 0;
+	for (i = 0; i < 127; i++) {
+		sum = sum + new_edid[length + i];
+	}
+	new_edid[length + 127] = 256 - sum;
+}
+
+/**
  * kmstest_unset_all_crtcs:
  * @drm_fd: the DRM fd
  * @resources: libdrm resources pointer
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4263a01..921afef 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -149,6 +149,7 @@ enum kmstest_generic_edid {
 
 bool kmstest_force_connector(int fd, drmModeConnector *connector,
 			     enum kmstest_force_connector_state state);
+void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);
 void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
 			const unsigned char *edid, size_t length);
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t 2/3] lib: move create_stereo_fb from testdisplay to igt_fb
  2014-08-20 10:54 [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d Thomas Wood
@ 2014-08-20 10:54 ` Thomas Wood
  2014-08-20 10:54 ` [PATCH i-g-t 3/3] tests: add kms_3d test Thomas Wood
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-08-20 10:54 UTC (permalink / raw)
  To: intel-gfx

Move create_stereo_fb from testdisplay to igt_create_stereo_fb in igt_fb
so that it can be used in other tests.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/Makefile.am     |   4 +-
 lib/igt_fb.c        | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_fb.h        |   2 +
 lib/igt_kms.h       |   1 +
 tests/testdisplay.c | 116 +---------------------------------------------
 5 files changed, 138 insertions(+), 116 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 001ecab..36cf2d3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -7,7 +7,9 @@ noinst_LTLIBRARIES = libintel_tools.la
 noinst_HEADERS = check-ndebug.h
 
 AM_CPPFLAGS = -I$(top_srcdir)
-AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)
+AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)  \
+	    -DIGT_DATADIR=\""$(abs_top_srcdir)/tests"\"
+
 
 LDADD = $(CAIRO_LIBS)
 AM_CFLAGS += $(CAIRO_CFLAGS)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d07af0d..9a13969 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -507,6 +507,137 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
 	return fb_id;
 }
 
+
+struct box {
+	int x, y, width, height;
+};
+
+struct stereo_fb_layout {
+	int fb_width, fb_height;
+	struct box left, right;
+};
+
+static void box_init(struct box *box, int x, int y, int bwidth, int bheight)
+{
+	box->x = x;
+	box->y = y;
+	box->width = bwidth;
+	box->height = bheight;
+}
+
+
+static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
+				       drmModeModeInfo *mode)
+{
+	unsigned int format = mode->flags & DRM_MODE_FLAG_3D_MASK;
+	const int hdisplay = mode->hdisplay, vdisplay = mode->vdisplay;
+	int middle;
+
+	switch (format) {
+	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+		layout->fb_width = hdisplay;
+		layout->fb_height = vdisplay;
+
+		middle = vdisplay / 2;
+		box_init(&layout->left, 0, 0, hdisplay, middle);
+		box_init(&layout->right,
+			 0, middle, hdisplay, vdisplay - middle);
+		break;
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+		layout->fb_width = hdisplay;
+		layout->fb_height = vdisplay;
+
+		middle = hdisplay / 2;
+		box_init(&layout->left, 0, 0, middle, vdisplay);
+		box_init(&layout->right,
+			 middle, 0, hdisplay - middle, vdisplay);
+		break;
+	case DRM_MODE_FLAG_3D_FRAME_PACKING:
+	{
+		int vactive_space = mode->vtotal - vdisplay;
+
+		layout->fb_width = hdisplay;
+		layout->fb_height = 2 * vdisplay + vactive_space;
+
+		box_init(&layout->left,
+			 0, 0, hdisplay, vdisplay);
+		box_init(&layout->right,
+			 0, vdisplay + vactive_space, hdisplay, vdisplay);
+		break;
+	}
+	default:
+		igt_assert(0);
+	}
+}
+static const char *stereo_mode_str(drmModeModeInfo *mode)
+{
+	unsigned int layout = mode->flags & DRM_MODE_FLAG_3D_MASK;
+
+	switch (layout) {
+	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+		return "TB";
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+		return "SbSH";
+	case DRM_MODE_FLAG_3D_FRAME_PACKING:
+		return "FP";
+	default:
+		igt_assert(0);
+	}
+}
+
+/**
+ * igt_create_stereo_fb:
+ * @drm_fd: open i915 drm file descriptor
+ * @mode: A stero 3D mode.
+ *
+ * Create a framebuffer for use with the stereo 3D mode specified by @mode.
+ *
+ * Returns:
+ * The kms id of the created framebuffer on success or a negative error code on
+ * failure.
+ */
+unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode)
+{
+	struct stereo_fb_layout layout;
+	cairo_t *cr;
+	uint32_t fb_id;
+	struct igt_fb fb;
+
+	/* config */
+	int bpp = 32;
+	int depth = 32;
+	bool enable_tiling = false;
+
+	stereo_fb_layout_from_mode(&layout, mode);
+	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height,
+				  igt_bpp_depth_to_drm_format(bpp, depth),
+				  enable_tiling, &fb);
+	cr = igt_get_cairo_ctx(drm_fd, &fb);
+
+	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",
+			    layout.right.x, layout.right.y,
+			    layout.right.width, layout.right.height);
+
+	cairo_destroy(cr);
+
+	{
+		char buffer[64];
+
+		snprintf(buffer, sizeof(buffer), "%dx%d@%dHz-%s.png",
+			 mode->hdisplay,
+			 mode->vdisplay,
+			 mode->vrefresh,
+			 stereo_mode_str(mode));
+
+		igt_write_fb_to_png(drm_fd, &fb, buffer);
+	}
+
+	return fb_id;
+}
+
 static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 {
 	struct format_desc_struct *f;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index f5110d4..16f6040 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -72,6 +72,8 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
 				     uint32_t format, bool tiled,
 				     double r, double g, double b,
 				     struct igt_fb *fb /* out */);
+unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode);
+
 void igt_remove_fb(int fd, struct igt_fb *fb);
 
 /* cairo-based painting */
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 921afef..abf4bcf 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -166,6 +166,7 @@ bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 			  drmModePropertyPtr *prop);
 void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources);
 
+
 /*
  * A small modeset API
  */
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 89ee110..f3471af 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -409,125 +409,11 @@ set_mode(struct connector *c)
 	drmModeFreeConnector(c->connector);
 }
 
-struct box {
-	int x, y, width, height;
-};
-
-struct stereo_fb_layout {
-	int fb_width, fb_height;
-	struct box left, right;
-};
-
-static void box_init(struct box *box, int x, int y, int bwidth, int bheight)
-{
-	box->x = x;
-	box->y = y;
-	box->width = bwidth;
-	box->height = bheight;
-}
-
-static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
-				       drmModeModeInfo *mode)
-{
-	unsigned int format = mode->flags & DRM_MODE_FLAG_3D_MASK;
-	const int hdisplay = mode->hdisplay, vdisplay = mode->vdisplay;
-	int middle;
-
-	switch (format) {
-	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
-		layout->fb_width = hdisplay;
-		layout->fb_height = vdisplay;
-
-		middle = vdisplay / 2;
-		box_init(&layout->left, 0, 0, hdisplay, middle);
-		box_init(&layout->right,
-			 0, middle, hdisplay, vdisplay - middle);
-		break;
-	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
-		layout->fb_width = hdisplay;
-		layout->fb_height = vdisplay;
-
-		middle = hdisplay / 2;
-		box_init(&layout->left, 0, 0, middle, vdisplay);
-		box_init(&layout->right,
-			 middle, 0, hdisplay - middle, vdisplay);
-		break;
-	case DRM_MODE_FLAG_3D_FRAME_PACKING:
-	{
-		int vactive_space = mode->vtotal - vdisplay;
-
-		layout->fb_width = hdisplay;
-		layout->fb_height = 2 * vdisplay + vactive_space;
-
-		box_init(&layout->left,
-			 0, 0, hdisplay, vdisplay);
-		box_init(&layout->right,
-			 0, vdisplay + vactive_space, hdisplay, vdisplay);
-		break;
-	}
-	default:
-		igt_assert(0);
-	}
-}
-
-static const char *stereo_mode_str(drmModeModeInfo *mode)
-{
-	unsigned int layout = mode->flags & DRM_MODE_FLAG_3D_MASK;
-
-	switch (layout) {
-	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
-		return "TB";
-	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
-		return "SbSH";
-	case DRM_MODE_FLAG_3D_FRAME_PACKING:
-		return "FP";
-	default:
-		igt_assert(0);
-	}
-}
-
-static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct igt_fb *fb)
-{
-	struct stereo_fb_layout layout;
-	cairo_t *cr;
-	uint32_t fb_id;
-
-	stereo_fb_layout_from_mode(&layout, mode);
-	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height,
-				  igt_bpp_depth_to_drm_format(bpp, depth),
-				  enable_tiling, fb);
-	cr = igt_get_cairo_ctx(drm_fd, fb);
-
-	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",
-			    layout.right.x, layout.right.y,
-			    layout.right.width, layout.right.height);
-
-	cairo_destroy(cr);
-
-	{
-		char buffer[64];
-
-		snprintf(buffer, sizeof(buffer), "%dx%d@%dHz-%s.png",
-			 mode->hdisplay,
-			 mode->vdisplay,
-			 mode->vrefresh,
-			 stereo_mode_str(mode));
-
-		igt_write_fb_to_png(drm_fd, fb, buffer);
-	}
-
-	return fb_id;
-}
-
 static void do_set_stereo_mode(struct connector *c)
 {
 	uint32_t fb_id;
-	struct igt_fb fb_info;
 
-	fb_id = create_stereo_fb(&c->mode, &fb_info);
+	fb_id = igt_create_stereo_fb(drm_fd, &c->mode);
 
 	igt_warn_on_f(drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode),
 		      "failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t 3/3] tests: add kms_3d test
  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
  2014-08-26 13:38   ` 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
  3 siblings, 1 reply; 15+ messages in thread
From: Thomas Wood @ 2014-08-20 10:54 UTC (permalink / raw)
  To: intel-gfx

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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH i-g-t 3/3] tests: add kms_3d test
  2014-08-20 10:54 ` [PATCH i-g-t 3/3] tests: add kms_3d test Thomas Wood
@ 2014-08-26 13:38   ` Damien Lespiau
  0 siblings, 0 replies; 15+ messages in thread
From: Damien Lespiau @ 2014-08-26 13:38 UTC (permalink / raw)
  To: Thomas Wood; +Cc: intel-gfx

On Wed, Aug 20, 2014 at 11:54:09AM +0100, Thomas Wood wrote:
> 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);

I guess this hunk really belongs to the previous commit, but for i-g-t,
whatever really.

>  
> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d
  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 ` [PATCH i-g-t 3/3] tests: add kms_3d test Thomas Wood
@ 2014-08-26 13:43 ` Damien Lespiau
  2014-09-04 19:57 ` Clint Taylor
  3 siblings, 0 replies; 15+ messages in thread
From: Damien Lespiau @ 2014-08-26 13:43 UTC (permalink / raw)
  To: Thomas Wood; +Cc: intel-gfx

On Wed, Aug 20, 2014 at 11:54:07AM +0100, Thomas Wood wrote:
> kmstest_edid_add_3d adds an EDID extension block with 3D support to a
> copy of the specified EDID.
> 
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>

The series looks reasonable, ship it!

-- 
Damien

> ---
>  lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_kms.h |  1 +
>  2 files changed, 81 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index a414d96..eb898f8 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -657,6 +657,86 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
>  }
>  
>  /**
> + * kmstest_edid_add_3d:
> + * @edid: an existing valid edid block
> + * @length: length of @edid
> + * @new_edid_ptr: pointer to where the new edid will be placed
> + * @new_length: pointer to the size of the new edid
> + *
> + * Makes a copy of an existing edid block and adds an extension indicating
> + * stereo 3D capabilities.
> + */
> +void kmstest_edid_add_3d(const unsigned char *edid, size_t length,
> +			 unsigned char *new_edid_ptr[], size_t *new_length)
> +{
> +	unsigned char *new_edid;
> +	int n_extensions;
> +	char sum = 0;
> +	int pos;
> +	int i;
> +	char cea_header_len = 4, video_block_len = 6, vsdb_block_len = 11;
> +
> +	igt_assert(new_edid_ptr != NULL && new_length != NULL);
> +
> +	*new_length = length + 128;
> +
> +	new_edid = calloc(*new_length, sizeof(char));
> +	memcpy(new_edid, edid, length);
> +	*new_edid_ptr = new_edid;
> +
> +	n_extensions = new_edid[126];
> +	n_extensions++;
> +	new_edid[126] = n_extensions;
> +
> +	/* recompute checksum */
> +	for (i = 0; i < 127; i++) {
> +		sum = sum + new_edid[i];
> +	}
> +	new_edid[127] = 256 - sum;
> +
> +	/* add a cea-861 extension block */
> +	pos = length;
> +	new_edid[pos++] = 0x2;
> +	new_edid[pos++] = 0x3;
> +	new_edid[pos++] = cea_header_len + video_block_len + vsdb_block_len;
> +	new_edid[pos++] = 0x0;
> +
> +	/* video block (id | length) */
> +	new_edid[pos++] = 2 << 5 | (video_block_len - 1);
> +	new_edid[pos++] = 32 | 0x80; /* 1080p @ 24Hz | (native)*/
> +	new_edid[pos++] = 5;         /* 1080i @ 60Hz */
> +	new_edid[pos++] = 20;        /* 1080i @ 50Hz */
> +	new_edid[pos++] = 4;         /* 720p @ 60Hz*/
> +	new_edid[pos++] = 19;        /* 720p @ 50Hz*/
> +
> +	/* vsdb block ( id | length ) */
> +	new_edid[pos++] = 3 << 5 | (vsdb_block_len - 1);
> +	/* registration id */
> +	new_edid[pos++] = 0x3;
> +	new_edid[pos++] = 0xc;
> +	new_edid[pos++] = 0x0;
> +	/* source physical address */
> +	new_edid[pos++] = 0x0;
> +	new_edid[pos++] = 0x0;
> +	/* Supports_AI ... etc */
> +	new_edid[pos++] = 0x00;
> +	/* Max TMDS Clock */
> +	new_edid[pos++] = 0x00;
> +	/* Latency present, HDMI Video Present */
> +	new_edid[pos++] = 0x20;
> +	/* HDMI Video */
> +	new_edid[pos++] = 0x80;
> +	new_edid[pos++] = 0x00;
> +
> +	/* checksum */
> +	sum = 0;
> +	for (i = 0; i < 127; i++) {
> +		sum = sum + new_edid[length + i];
> +	}
> +	new_edid[length + 127] = 256 - sum;
> +}
> +
> +/**
>   * kmstest_unset_all_crtcs:
>   * @drm_fd: the DRM fd
>   * @resources: libdrm resources pointer
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4263a01..921afef 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -149,6 +149,7 @@ enum kmstest_generic_edid {
>  
>  bool kmstest_force_connector(int fd, drmModeConnector *connector,
>  			     enum kmstest_force_connector_state state);
> +void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);
>  void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
>  			const unsigned char *edid, size_t length);
>  
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d
  2014-08-20 10:54 [PATCH i-g-t 1/3] lib: add kmstest_edid_add_3d Thomas Wood
                   ` (2 preceding siblings ...)
  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
  3 siblings, 1 reply; 15+ messages in thread
From: Clint Taylor @ 2014-09-04 19:57 UTC (permalink / raw)
  To: Thomas Wood, intel-gfx

On 08/20/2014 03:54 AM, Thomas Wood wrote:
> kmstest_edid_add_3d adds an EDID extension block with 3D support to a
> copy of the specified EDID.
>
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>   lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  1 +
>   2 files changed, 81 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index a414d96..eb898f8 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -657,6 +657,86 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
>   }
>
>   /**
> + * kmstest_edid_add_3d:
> + * @edid: an existing valid edid block
> + * @length: length of @edid
> + * @new_edid_ptr: pointer to where the new edid will be placed
> + * @new_length: pointer to the size of the new edid
> + *
> + * Makes a copy of an existing edid block and adds an extension indicating
> + * stereo 3D capabilities.
> + */
> +void kmstest_edid_add_3d(const unsigned char *edid, size_t length,
> +			 unsigned char *new_edid_ptr[], size_t *new_length)
> +{
> +	unsigned char *new_edid;
> +	int n_extensions;
> +	char sum = 0;
> +	int pos;
> +	int i;
> +	char cea_header_len = 4, video_block_len = 6, vsdb_block_len = 11;
> +
> +	igt_assert(new_edid_ptr != NULL && new_length != NULL);
> +
> +	*new_length = length + 128;
> +
> +	new_edid = calloc(*new_length, sizeof(char));
> +	memcpy(new_edid, edid, length);
> +	*new_edid_ptr = new_edid;
> +
> +	n_extensions = new_edid[126];
> +	n_extensions++;
> +	new_edid[126] = n_extensions;
> +
> +	/* recompute checksum */
> +	for (i = 0; i < 127; i++) {
> +		sum = sum + new_edid[i];
> +	}
> +	new_edid[127] = 256 - sum;
> +
> +	/* add a cea-861 extension block */
> +	pos = length;
> +	new_edid[pos++] = 0x2;
> +	new_edid[pos++] = 0x3;
> +	new_edid[pos++] = cea_header_len + video_block_len + vsdb_block_len;
> +	new_edid[pos++] = 0x0;
> +
> +	/* video block (id | length) */
> +	new_edid[pos++] = 2 << 5 | (video_block_len - 1);
> +	new_edid[pos++] = 32 | 0x80; /* 1080p @ 24Hz | (native)*/
> +	new_edid[pos++] = 5;         /* 1080i @ 60Hz */
> +	new_edid[pos++] = 20;        /* 1080i @ 50Hz */
> +	new_edid[pos++] = 4;         /* 720p @ 60Hz*/
> +	new_edid[pos++] = 19;        /* 720p @ 50Hz*/
> +
> +	/* vsdb block ( id | length ) */
> +	new_edid[pos++] = 3 << 5 | (vsdb_block_len - 1);
> +	/* registration id */
> +	new_edid[pos++] = 0x3;
> +	new_edid[pos++] = 0xc;
> +	new_edid[pos++] = 0x0;
> +	/* source physical address */
> +	new_edid[pos++] = 0x0;
> +	new_edid[pos++] = 0x0;

A CEC SPA of 0.0.0.0 is actually invalid and may cause issues with the 
EDID decoder. Suggest since this is dummy VSDB make the SPA 1.0.0.0.

Clint


> +	/* Supports_AI ... etc */
> +	new_edid[pos++] = 0x00;
> +	/* Max TMDS Clock */
> +	new_edid[pos++] = 0x00;
> +	/* Latency present, HDMI Video Present */
> +	new_edid[pos++] = 0x20;
> +	/* HDMI Video */
> +	new_edid[pos++] = 0x80;
> +	new_edid[pos++] = 0x00;
> +
> +	/* checksum */
> +	sum = 0;
> +	for (i = 0; i < 127; i++) {
> +		sum = sum + new_edid[length + i];
> +	}
> +	new_edid[length + 127] = 256 - sum;
> +}
> +
> +/**
>    * kmstest_unset_all_crtcs:
>    * @drm_fd: the DRM fd
>    * @resources: libdrm resources pointer
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4263a01..921afef 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -149,6 +149,7 @@ enum kmstest_generic_edid {
>
>   bool kmstest_force_connector(int fd, drmModeConnector *connector,
>   			     enum kmstest_force_connector_state state);
> +void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);
>   void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
>   			const unsigned char *edid, size_t length);
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 0/6] 3D stereo mode testing
  2014-09-04 19:57 ` Clint Taylor
@ 2014-09-05  9:52   ` Thomas Wood
  2014-09-05  9:52     ` [PATCH i-g-t v2 1/6] lib: add kmstest_edid_add_3d Thomas Wood
                       ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

This updated and rebased series fixes various issues with the previous one and
also skips testing on gen 7 and 8 where it is not currently possible to force
the HDMI and DP connector states. There is also a small documentation fix for
igt_create_fb.

Thomas Wood (6):
  lib: add kmstest_edid_add_3d
  lib: move create_stereo_fb from testdisplay to igt_fb
  tests: add kms_3d test
  lib/igt_fb: ensure igt_create_fb parameters are consistent
  lib: don't force HDMI or DP connectors on gen 7 and 8
  tests/kms_3d: skip if connectors cannot be forced

 lib/Makefile.am        |   4 +-
 lib/igt_fb.c           | 102 ++++++++++++++++++++++++++++++++++++++++-
 lib/igt_fb.h           |   4 +-
 lib/igt_kms.c          |  92 +++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h          |   1 +
 tests/.gitignore       |   1 +
 tests/Android.mk       |   1 +
 tests/Makefile.sources |   1 +
 tests/kms_3d.c         | 121 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/testdisplay.c    | 118 ++---------------------------------------------
 10 files changed, 327 insertions(+), 118 deletions(-)
 create mode 100644 tests/kms_3d.c

-- 
1.9.3

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 1/6] lib: add kmstest_edid_add_3d
  2014-09-05  9:52   ` [PATCH i-g-t v2 0/6] 3D stereo mode testing Thomas Wood
@ 2014-09-05  9:52     ` 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
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

kmstest_edid_add_3d adds an EDID extension block with 3D support to a
copy of the specified EDID.

v2: Avoid using an invalid CEC SPA (Clint Taylor)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 81 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d763013..0dc46f9 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -649,6 +649,86 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 }
 
 /**
+ * kmstest_edid_add_3d:
+ * @edid: an existing valid edid block
+ * @length: length of @edid
+ * @new_edid_ptr: pointer to where the new edid will be placed
+ * @new_length: pointer to the size of the new edid
+ *
+ * Makes a copy of an existing edid block and adds an extension indicating
+ * stereo 3D capabilities.
+ */
+void kmstest_edid_add_3d(const unsigned char *edid, size_t length,
+			 unsigned char *new_edid_ptr[], size_t *new_length)
+{
+	unsigned char *new_edid;
+	int n_extensions;
+	char sum = 0;
+	int pos;
+	int i;
+	char cea_header_len = 4, video_block_len = 6, vsdb_block_len = 11;
+
+	igt_assert(new_edid_ptr != NULL && new_length != NULL);
+
+	*new_length = length + 128;
+
+	new_edid = calloc(*new_length, sizeof(char));
+	memcpy(new_edid, edid, length);
+	*new_edid_ptr = new_edid;
+
+	n_extensions = new_edid[126];
+	n_extensions++;
+	new_edid[126] = n_extensions;
+
+	/* recompute checksum */
+	for (i = 0; i < 127; i++) {
+		sum = sum + new_edid[i];
+	}
+	new_edid[127] = 256 - sum;
+
+	/* add a cea-861 extension block */
+	pos = length;
+	new_edid[pos++] = 0x2;
+	new_edid[pos++] = 0x3;
+	new_edid[pos++] = cea_header_len + video_block_len + vsdb_block_len;
+	new_edid[pos++] = 0x0;
+
+	/* video block (id | length) */
+	new_edid[pos++] = 2 << 5 | (video_block_len - 1);
+	new_edid[pos++] = 32 | 0x80; /* 1080p @ 24Hz | (native)*/
+	new_edid[pos++] = 5;         /* 1080i @ 60Hz */
+	new_edid[pos++] = 20;        /* 1080i @ 50Hz */
+	new_edid[pos++] = 4;         /* 720p @ 60Hz*/
+	new_edid[pos++] = 19;        /* 720p @ 50Hz*/
+
+	/* vsdb block ( id | length ) */
+	new_edid[pos++] = 3 << 5 | (vsdb_block_len - 1);
+	/* registration id */
+	new_edid[pos++] = 0x3;
+	new_edid[pos++] = 0xc;
+	new_edid[pos++] = 0x0;
+	/* source physical address */
+	new_edid[pos++] = 0x10;
+	new_edid[pos++] = 0x00;
+	/* Supports_AI ... etc */
+	new_edid[pos++] = 0x00;
+	/* Max TMDS Clock */
+	new_edid[pos++] = 0x00;
+	/* Latency present, HDMI Video Present */
+	new_edid[pos++] = 0x20;
+	/* HDMI Video */
+	new_edid[pos++] = 0x80;
+	new_edid[pos++] = 0x00;
+
+	/* checksum */
+	sum = 0;
+	for (i = 0; i < 127; i++) {
+		sum = sum + new_edid[length + i];
+	}
+	new_edid[length + 127] = 256 - sum;
+}
+
+/**
  * kmstest_unset_all_crtcs:
  * @drm_fd: the DRM fd
  * @resources: libdrm resources pointer
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4263a01..921afef 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -149,6 +149,7 @@ enum kmstest_generic_edid {
 
 bool kmstest_force_connector(int fd, drmModeConnector *connector,
 			     enum kmstest_force_connector_state state);
+void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);
 void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
 			const unsigned char *edid, size_t length);
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 2/6] lib: move create_stereo_fb from testdisplay to igt_fb
  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     ` Thomas Wood
  2014-09-05  9:52     ` [PATCH i-g-t v2 3/6] tests: add kms_3d test Thomas Wood
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

Move create_stereo_fb from testdisplay to igt_create_stereo_fb in igt_fb
so that it can be used in other tests.

v2: update for new igt_create_fb API
    add parameters for format and tiling
    remove some old debug code

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/Makefile.am     |   4 +-
 lib/igt_fb.c        | 100 ++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_fb.h        |   2 +
 tests/testdisplay.c | 118 ++--------------------------------------------------
 4 files changed, 108 insertions(+), 116 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 001ecab..36cf2d3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -7,7 +7,9 @@ noinst_LTLIBRARIES = libintel_tools.la
 noinst_HEADERS = check-ndebug.h
 
 AM_CPPFLAGS = -I$(top_srcdir)
-AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)
+AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)  \
+	    -DIGT_DATADIR=\""$(abs_top_srcdir)/tests"\"
+
 
 LDADD = $(CAIRO_LIBS)
 AM_CFLAGS += $(CAIRO_CFLAGS)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 71d9a26..f9f5de2 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -502,6 +502,106 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
 	return fb_id;
 }
 
+struct box {
+	int x, y, width, height;
+};
+
+struct stereo_fb_layout {
+	int fb_width, fb_height;
+	struct box left, right;
+};
+
+static void box_init(struct box *box, int x, int y, int bwidth, int bheight)
+{
+	box->x = x;
+	box->y = y;
+	box->width = bwidth;
+	box->height = bheight;
+}
+
+
+static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
+				       drmModeModeInfo *mode)
+{
+	unsigned int format = mode->flags & DRM_MODE_FLAG_3D_MASK;
+	const int hdisplay = mode->hdisplay, vdisplay = mode->vdisplay;
+	int middle;
+
+	switch (format) {
+	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+		layout->fb_width = hdisplay;
+		layout->fb_height = vdisplay;
+
+		middle = vdisplay / 2;
+		box_init(&layout->left, 0, 0, hdisplay, middle);
+		box_init(&layout->right,
+			 0, middle, hdisplay, vdisplay - middle);
+		break;
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+		layout->fb_width = hdisplay;
+		layout->fb_height = vdisplay;
+
+		middle = hdisplay / 2;
+		box_init(&layout->left, 0, 0, middle, vdisplay);
+		box_init(&layout->right,
+			 middle, 0, hdisplay - middle, vdisplay);
+		break;
+	case DRM_MODE_FLAG_3D_FRAME_PACKING:
+	{
+		int vactive_space = mode->vtotal - vdisplay;
+
+		layout->fb_width = hdisplay;
+		layout->fb_height = 2 * vdisplay + vactive_space;
+
+		box_init(&layout->left,
+			 0, 0, hdisplay, vdisplay);
+		box_init(&layout->right,
+			 0, vdisplay + vactive_space, hdisplay, vdisplay);
+		break;
+	}
+	default:
+		igt_assert(0);
+	}
+}
+
+/**
+ * igt_create_stereo_fb:
+ * @drm_fd: open i915 drm file descriptor
+ * @mode: A stereo 3D mode.
+ * @format: drm fourcc pixel format code
+ * @tiling: tiling layout of the framebuffer
+ *
+ * Create a framebuffer for use with the stereo 3D mode specified by @mode.
+ *
+ * Returns:
+ * The kms id of the created framebuffer on success or a negative error code on
+ * failure.
+ */
+unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
+				  uint32_t format, unsigned int tiling)
+{
+	struct stereo_fb_layout layout;
+	cairo_t *cr;
+	uint32_t fb_id;
+	struct igt_fb fb;
+
+	stereo_fb_layout_from_mode(&layout, mode);
+	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height, format,
+			      tiling, &fb);
+	cr = igt_get_cairo_ctx(drm_fd, &fb);
+
+	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",
+			layout.right.x, layout.right.y,
+			layout.right.width, layout.right.height);
+
+	cairo_destroy(cr);
+
+	return fb_id;
+}
+
 static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 {
 	struct format_desc_struct *f;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 4295df9..e6f72e9 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -75,6 +75,8 @@ unsigned int igt_create_color_fb(int fd, int width, int height,
 				 uint32_t format, unsigned int tiling,
 				 double r, double g, double b,
 				 struct igt_fb *fb /* out */);
+unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
+				  uint32_t format, unsigned int tiling);
 void igt_remove_fb(int fd, struct igt_fb *fb);
 
 /* cairo-based painting */
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index dbca203..a3cba44 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -410,125 +410,13 @@ set_mode(struct connector *c)
 	drmModeFreeConnector(c->connector);
 }
 
-struct box {
-	int x, y, width, height;
-};
-
-struct stereo_fb_layout {
-	int fb_width, fb_height;
-	struct box left, right;
-};
-
-static void box_init(struct box *box, int x, int y, int bwidth, int bheight)
-{
-	box->x = x;
-	box->y = y;
-	box->width = bwidth;
-	box->height = bheight;
-}
-
-static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
-				       drmModeModeInfo *mode)
-{
-	unsigned int format = mode->flags & DRM_MODE_FLAG_3D_MASK;
-	const int hdisplay = mode->hdisplay, vdisplay = mode->vdisplay;
-	int middle;
-
-	switch (format) {
-	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
-		layout->fb_width = hdisplay;
-		layout->fb_height = vdisplay;
-
-		middle = vdisplay / 2;
-		box_init(&layout->left, 0, 0, hdisplay, middle);
-		box_init(&layout->right,
-			 0, middle, hdisplay, vdisplay - middle);
-		break;
-	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
-		layout->fb_width = hdisplay;
-		layout->fb_height = vdisplay;
-
-		middle = hdisplay / 2;
-		box_init(&layout->left, 0, 0, middle, vdisplay);
-		box_init(&layout->right,
-			 middle, 0, hdisplay - middle, vdisplay);
-		break;
-	case DRM_MODE_FLAG_3D_FRAME_PACKING:
-	{
-		int vactive_space = mode->vtotal - vdisplay;
-
-		layout->fb_width = hdisplay;
-		layout->fb_height = 2 * vdisplay + vactive_space;
-
-		box_init(&layout->left,
-			 0, 0, hdisplay, vdisplay);
-		box_init(&layout->right,
-			 0, vdisplay + vactive_space, hdisplay, vdisplay);
-		break;
-	}
-	default:
-		igt_assert(0);
-	}
-}
-
-static const char *stereo_mode_str(drmModeModeInfo *mode)
-{
-	unsigned int layout = mode->flags & DRM_MODE_FLAG_3D_MASK;
-
-	switch (layout) {
-	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
-		return "TB";
-	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
-		return "SbSH";
-	case DRM_MODE_FLAG_3D_FRAME_PACKING:
-		return "FP";
-	default:
-		igt_assert(0);
-	}
-}
-
-static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct igt_fb *fb)
-{
-	struct stereo_fb_layout layout;
-	cairo_t *cr;
-	uint32_t fb_id;
-
-	stereo_fb_layout_from_mode(&layout, mode);
-	fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height,
-			      igt_bpp_depth_to_drm_format(bpp, depth),
-			      tiling, fb);
-	cr = igt_get_cairo_ctx(drm_fd, fb);
-
-	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",
-			    layout.right.x, layout.right.y,
-			    layout.right.width, layout.right.height);
-
-	cairo_destroy(cr);
-
-	{
-		char buffer[64];
-
-		snprintf(buffer, sizeof(buffer), "%dx%d@%dHz-%s.png",
-			 mode->hdisplay,
-			 mode->vdisplay,
-			 mode->vrefresh,
-			 stereo_mode_str(mode));
-
-		igt_write_fb_to_png(drm_fd, fb, buffer);
-	}
-
-	return fb_id;
-}
-
 static void do_set_stereo_mode(struct connector *c)
 {
 	uint32_t fb_id;
-	struct igt_fb fb_info;
 
-	fb_id = create_stereo_fb(&c->mode, &fb_info);
+	fb_id = igt_create_stereo_fb(drm_fd, &c->mode,
+				     igt_bpp_depth_to_drm_format(bpp, depth),
+				     tiling);
 
 	igt_warn_on_f(drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode),
 		      "failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 3/6] tests: add kms_3d test
  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     ` 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
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

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

v2: update for API changes

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

diff --git a/tests/.gitignore b/tests/.gitignore
index efa0c92..1ea0681 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -117,6 +117,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 551555f..a6677dd 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -142,6 +142,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..ddf4dc6
--- /dev/null
+++ b/tests/kms_3d.c
@@ -0,0 +1,120 @@
+/*
+ * 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],
+					     igt_bpp_depth_to_drm_format(32, 32),
+					     I915_TILING_NONE);
+
+		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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 4/6] lib/igt_fb: ensure igt_create_fb parameters are consistent
  2014-09-05  9:52   ` [PATCH i-g-t v2 0/6] 3D stereo mode testing Thomas Wood
                       ` (2 preceding siblings ...)
  2014-09-05  9:52     ` [PATCH i-g-t v2 3/6] tests: add kms_3d test Thomas Wood
@ 2014-09-05  9:52     ` 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  9:52     ` [PATCH i-g-t v2 6/6] tests/kms_3d: skip if connectors cannot be forced Thomas Wood
  5 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

Make sure the parameters in the prototype and implementation of
igt_create_fb match and are complete so that the documentation is
correct.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_fb.c | 2 +-
 lib/igt_fb.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index f9f5de2..ce0dd6b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -455,7 +455,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
  * The kms id of the created framebuffer.
  */
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   unsigned tiling, struct igt_fb *fb)
+			   unsigned int tiling, struct igt_fb *fb)
 {
 	return igt_create_fb_with_bo_size(fd, width, height, format, tiling, fb, 0);
 }
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index e6f72e9..d9fb6bb 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -70,7 +70,7 @@ igt_create_fb_with_bo_size(int fd, int width, int height,
 			   uint32_t format, unsigned int tiling,
 			   struct igt_fb *fb, unsigned bo_size);
 unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
-			   unsigned int , struct igt_fb *fb);
+			   unsigned int tiling, struct igt_fb *fb);
 unsigned int igt_create_color_fb(int fd, int width, int height,
 				 uint32_t format, unsigned int tiling,
 				 double r, double g, double b,
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8
  2014-09-05  9:52   ` [PATCH i-g-t v2 0/6] 3D stereo mode testing Thomas Wood
                       ` (3 preceding siblings ...)
  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     ` Thomas Wood
  2014-09-05 12:15       ` Daniel Vetter
  2014-09-05  9:52     ` [PATCH i-g-t v2 6/6] tests/kms_3d: skip if connectors cannot be forced Thomas Wood
  5 siblings, 1 reply; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

Forcing HDMI or DP connectors on gen 7 and 8 doesn't currently work, so
fail early to allow the test to skip if required.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_kms.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0dc46f9..e9455aa 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -41,6 +41,7 @@
 #include "drmtest.h"
 #include "igt_kms.h"
 #include "igt_aux.h"
+#include "intel_chipset.h"
 
 /*
  * There hasn't been a release of libdrm containing these #define's yet, so
@@ -344,6 +345,17 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
 	char *path;
 	const char *value;
 	int debugfs_fd, ret;
+	uint32_t devid;
+
+	devid = intel_get_drm_devid(drm_fd);
+
+	/* forcing hdmi or dp connectors on gen 7 and 8 doesn't currently work,
+	 * so fail early to allow the test to skip if required */
+	if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB ||
+	    connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
+		&& (IS_GEN7(devid) || IS_GEN8(devid)))
+		return false;
 
 	switch (state) {
 	case FORCE_CONNECTOR_ON:
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH i-g-t v2 6/6] tests/kms_3d: skip if connectors cannot be forced
  2014-09-05  9:52   ` [PATCH i-g-t v2 0/6] 3D stereo mode testing Thomas Wood
                       ` (4 preceding siblings ...)
  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  9:52     ` Thomas Wood
  5 siblings, 0 replies; 15+ messages in thread
From: Thomas Wood @ 2014-09-05  9:52 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/kms_3d.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/kms_3d.c b/tests/kms_3d.c
index ddf4dc6..c11873b 100644
--- a/tests/kms_3d.c
+++ b/tests/kms_3d.c
@@ -60,7 +60,8 @@ igt_simple_main
 			    &length);
 
 	kmstest_force_edid(drm_fd, connector, edid, length);
-	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON);
+	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
+		igt_skip("Could not force connector on\n");
 
 	connector_id = connector->connector_id;
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8
  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ä
  0 siblings, 1 reply; 15+ messages in thread
From: Daniel Vetter @ 2014-09-05 12:15 UTC (permalink / raw)
  To: Thomas Wood; +Cc: intel-gfx

On Fri, Sep 05, 2014 at 10:52:08AM +0100, Thomas Wood wrote:
> Forcing HDMI or DP connectors on gen 7 and 8 doesn't currently work, so
> fail early to allow the test to skip if required.
> 
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>  lib/igt_kms.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 0dc46f9..e9455aa 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -41,6 +41,7 @@
>  #include "drmtest.h"
>  #include "igt_kms.h"
>  #include "igt_aux.h"
> +#include "intel_chipset.h"
>  
>  /*
>   * There hasn't been a release of libdrm containing these #define's yet, so
> @@ -344,6 +345,17 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
>  	char *path;
>  	const char *value;
>  	int debugfs_fd, ret;
> +	uint32_t devid;
> +
> +	devid = intel_get_drm_devid(drm_fd);
> +
> +	/* forcing hdmi or dp connectors on gen 7 and 8 doesn't currently work,
> +	 * so fail early to allow the test to skip if required */
> +	if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> +	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB ||
> +	    connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
> +		&& (IS_GEN7(devid) || IS_GEN8(devid)))

This catches too many platforms, since on ivb, vlv and chv we _can_
already use this. As well as on earlier platforms at least. And since
those platforms are under active testing by QA I think we really want
that. So the right check for now is IS_HSW || IS_BDW || IS_SKL (if Damien
pushed the igt/libdrm stuff already).
-Daniel

> +		return false;
>  
>  	switch (state) {
>  	case FORCE_CONNECTOR_ON:
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8
  2014-09-05 12:15       ` Daniel Vetter
@ 2014-09-09 12:42         ` Ville Syrjälä
  0 siblings, 0 replies; 15+ messages in thread
From: Ville Syrjälä @ 2014-09-09 12:42 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, Thomas Wood

On Fri, Sep 05, 2014 at 02:15:08PM +0200, Daniel Vetter wrote:
> On Fri, Sep 05, 2014 at 10:52:08AM +0100, Thomas Wood wrote:
> > Forcing HDMI or DP connectors on gen 7 and 8 doesn't currently work, so
> > fail early to allow the test to skip if required.
> > 
> > Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> > ---
> >  lib/igt_kms.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 0dc46f9..e9455aa 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -41,6 +41,7 @@
> >  #include "drmtest.h"
> >  #include "igt_kms.h"
> >  #include "igt_aux.h"
> > +#include "intel_chipset.h"
> >  
> >  /*
> >   * There hasn't been a release of libdrm containing these #define's yet, so
> > @@ -344,6 +345,17 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
> >  	char *path;
> >  	const char *value;
> >  	int debugfs_fd, ret;
> > +	uint32_t devid;
> > +
> > +	devid = intel_get_drm_devid(drm_fd);
> > +
> > +	/* forcing hdmi or dp connectors on gen 7 and 8 doesn't currently work,
> > +	 * so fail early to allow the test to skip if required */
> > +	if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> > +	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB ||
> > +	    connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
> > +		&& (IS_GEN7(devid) || IS_GEN8(devid)))
> 
> This catches too many platforms, since on ivb, vlv and chv we _can_
> already use this.

That's a bit of an overstatement. Maybe someone wants to review this?
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045564.html

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-09-09 12:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH i-g-t 3/3] tests: add kms_3d test Thomas Wood
2014-08-26 13:38   ` 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

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.