Skip to contentSkip to conversation

lib: add kmstest_edid_add_3d

PATCH Superseded Thomas Wood 5 participants 15 messages Aug 20, 2014 – Sep 9, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib: add kmstest_edid_add_3d

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

---
 lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 81 insertions(+)
lib/igt_kms.c +80 -0
index a414d96..eb898f8 100644
@@ -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
lib/igt_kms.h +1 -0
index 4263a01..921afef 100644
@@ -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);
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/3 lib: move create_stereo_fb from testdisplay to igt_fb

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

---
 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(-)
lib/Makefile.am +3 -1
index 001ecab..36cf2d3 100644
@@ -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)
lib/igt_fb.c +131 -0

137 lines not on this page · raw message

lib/igt_fb.h +2 -0
index f5110d4..16f6040 100644
@@ -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 */
lib/igt_kms.h +1 -0
index 921afef..abf4bcf 100644
@@ -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
  */
tests/testdisplay.c +1 -115

126 lines not on this page · raw message

Signature · 1 line
1.9.3
#2 lore raw

PATCH 3/3 tests: add kms_3d test

In reply to Thomas Wood

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

---
 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
lib/igt_fb.c +2 -2
index 9a13969..0096836 100644
@@ -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);
 
tests/.gitignore +1 -0
index 3da061e..9b5cf7d 100644
@@ -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
tests/Android.mk +1 -0
index 3644aa1..f28b400 100644
@@ -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 \
tests/Makefile.sources +1 -0
index 698e290..078df57 100644
@@ -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 \
tests/kms_3d.c new file +118 -0

118 lines not on this page · raw message

Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH i-g-t 3/3] tests: add kms_3d test

Quoted 18 lines · Thomas Wood

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

---
 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
lib/igt_fb.c +0 -0
index 9a13969..0096836 100644
@@ -614,10 +614,10 @@ unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode)
 				  enable_tiling, &fb);

lib/igt_fb.c unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode) · line 622

Quoted 10 lines
lib/igt_fb.c +2 -2
 	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.

Quoted 168 lines
tests/.gitignore +1 -0
index 3da061e..9b5cf7d 100644
@@ -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
tests/Android.mk +1 -0
index 3644aa1..f28b400 100644
@@ -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 \
tests/Makefile.sources +1 -0
index 698e290..078df57 100644
@@ -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 \
tests/kms_3d.c new file +118 -0
new file mode 100644
index 0000000..c593f34
@@ -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();
+}
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Thomas Wood
Quoted 4 lines · Thomas Wood

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

The series looks reasonable, ship it!

Signature · 1 line
Damien
Quoted 115 lines
---
 lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 81 insertions(+)
lib/igt_kms.c +80 -0
index a414d96..eb898f8 100644
@@ -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
lib/igt_kms.h +1 -0
index 4263a01..921afef 100644
@@ -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);
 
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
In reply to Thomas Wood
Quoted 68 lines · Thomas Wood

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

---
  lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  lib/igt_kms.h |  1 +
  2 files changed, 81 insertions(+)
lib/igt_kms.c +51 -0
index a414d96..eb898f8 100644
@@ -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*/

lib/igt_kms.c kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type, · line 720

Quoted 10 lines
lib/igt_kms.c +10 -0
+
+	/* 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

Quoted 35 lines
lib/igt_kms.c +19 -0
+	/* 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
lib/igt_kms.h +1 -0
index 4263a01..921afef 100644
@@ -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);
 
#6 lore raw

v2 cover 3D stereo mode testing

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
Signature · 1 line
1.9.3
#7 lore raw

PATCH v2 1/6 lib: add kmstest_edid_add_3d

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)

---
 lib/igt_kms.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 81 insertions(+)
lib/igt_kms.c +80 -0
index d763013..0dc46f9 100644
@@ -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
lib/igt_kms.h +1 -0
index 4263a01..921afef 100644
@@ -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);
 
Signature · 1 line
1.9.3
#8 lore raw

PATCH v2 2/6 lib: move create_stereo_fb from testdisplay to igt_fb

In reply to Thomas Wood

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

---
 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(-)
lib/Makefile.am +3 -1
index 001ecab..36cf2d3 100644
@@ -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)
lib/igt_fb.c +100 -0

106 lines not on this page · raw message

lib/igt_fb.h +2 -0
index 4295df9..e6f72e9 100644
@@ -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 */
tests/testdisplay.c +3 -115

128 lines not on this page · raw message

Signature · 1 line
1.9.3
#9 lore raw

PATCH v2 3/6 tests: add kms_3d test

In reply to Thomas Wood

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

v2: update for API changes

---
 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
tests/.gitignore +1 -0
index efa0c92..1ea0681 100644
@@ -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
tests/Android.mk +1 -0
index 3644aa1..f28b400 100644
@@ -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 \
tests/Makefile.sources +1 -0
index 551555f..a6677dd 100644
@@ -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 \
tests/kms_3d.c new file +120 -0

120 lines not on this page · raw message

Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH v2 4/6 lib/igt_fb: ensure igt_create_fb parameters are consistent

In reply to Thomas Wood

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

---
 lib/igt_fb.c | 2 +-
 lib/igt_fb.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/igt_fb.c +1 -1
index f9f5de2..ce0dd6b 100644
@@ -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);
 }
lib/igt_fb.h +1 -1
index e6f72e9..d9fb6bb 100644
@@ -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,
Signature · 1 line
1.9.3
#11 lore raw

PATCH v2 5/6 lib: don't force HDMI or DP connectors on gen 7 and 8

In reply to Thomas Wood

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.

---
 lib/igt_kms.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
lib/igt_kms.c +12 -0
index 0dc46f9..e9455aa 100644
@@ -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:
Signature · 1 line
1.9.3
#12 lore raw

Re: [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8

Quoted 24 lines · Thomas Wood

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.

---
 lib/igt_kms.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
lib/igt_kms.c +1 -0
index 0dc46f9..e9455aa 100644
@@ -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;

lib/igt_kms.c bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, · line 357

Quoted 10 lines
lib/igt_kms.c +10 -0
+	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

Quoted 11 lines
lib/igt_kms.c +1 -0
+		return false;
 
 	switch (state) {
 	case FORCE_CONNECTOR_ON:
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#13 lore raw

Re: [PATCH i-g-t v2 5/6] lib: don't force HDMI or DP connectors on gen 7 and 8

Quoted 30 lines · Daniel Vetter
Quoted 29 lines · Thomas Wood

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.

---
 lib/igt_kms.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
lib/igt_kms.c +6 -0
index 0dc46f9..e9455aa 100644
@@ -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,
Quoted 8 lines

lib/igt_kms.c bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, · line 357

Quoted 5 lines
lib/igt_kms.c +5 -0
+	 * 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

Signature · 2 lines
Ville Syrjälä
Intel OTC
#14 lore raw

PATCH v2 6/6 tests/kms_3d: skip if connectors cannot be forced

In reply to Thomas Wood
---
 tests/kms_3d.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/kms_3d.c +2 -1
index ddf4dc6..c11873b 100644
@@ -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;
 
Signature · 1 line
1.9.3