All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] lib/igt_kms: Add support for 4K and audio HDMI EDID injection.
@ 2016-02-02 13:03 Marius Vlad
  2016-02-02 13:03 ` [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities Marius Vlad
  2016-02-02 13:03 ` [PATCH 3/3] lib/igt_kms: Remove check against HDMI on HSW and BDW when forcing a connector. This should allow running tests/kms_hdmi_inject Marius Vlad
  0 siblings, 2 replies; 4+ messages in thread
From: Marius Vlad @ 2016-02-02 13:03 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
---
 lib/igt_kms.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |   2 +
 2 files changed, 178 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 90c8da7..64aa5d1 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -858,6 +858,182 @@ void kmstest_edid_add_3d(const unsigned char *edid, size_t length,
 }
 
 /**
+ * kmstest_edid_add_4k:
+ * @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
+ * a HDMI 4K mode in vsdb.
+ */
+void kmstest_edid_add_4k(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 = 12;
+
+	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++] = 0x00; /* 3D present */
+
+	/* HDMI MODE LEN -- how many entries */
+	new_edid[pos++] = 0x20;
+	/* 2160p, specified as short descriptor */
+	new_edid[pos++] = 0x01;
+
+
+	/* checksum */
+	sum = 0;
+	for (i = 0; i < 127; i++) {
+		sum = sum + new_edid[length + i];
+	}
+	new_edid[length + 127] = 256 - sum;
+}
+
+/**
+ * kmstest_edid_add_audio:
+ * @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
+ * basic audio support.
+ *
+ */
+void kmstest_edid_add_audio(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 = 12;
+	char audio_block_len = 4;
+
+	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 + audio_block_len +
+			  video_block_len + vsdb_block_len;
+	new_edid[pos++] = (1 << 6); /* support basic audio */
+
+	/* audio block, short audio block descriptors  */
+	new_edid[pos++] = (1 << 5) | (audio_block_len - 1);
+	new_edid[pos++] = 0x09; /* Audio Format, PCM */
+	new_edid[pos++] = 0x07; /* Frequency, 32, 44.1, 48kHz  */
+	new_edid[pos++] = 0x07; /* Bit Rate 16, 20, 24 bit */
+
+	/* 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 ) -- need vsdb as well
+	 * otherwise the kernel will fallback to lower clock modes */
+	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++] = 0x00; /* 3D present */
+
+
+	/* 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 3f7add5..1f79f55 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -132,6 +132,8 @@ enum kmstest_force_connector_state {
 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_edid_add_4k(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);
+void kmstest_edid_add_audio(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);
 
-- 
2.7.0.rc3

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

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

* [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities.
  2016-02-02 13:03 [PATCH 1/3] lib/igt_kms: Add support for 4K and audio HDMI EDID injection Marius Vlad
@ 2016-02-02 13:03 ` Marius Vlad
  2016-02-11  9:13   ` Daniel Vetter
  2016-02-02 13:03 ` [PATCH 3/3] lib/igt_kms: Remove check against HDMI on HSW and BDW when forcing a connector. This should allow running tests/kms_hdmi_inject Marius Vlad
  1 sibling, 1 reply; 4+ messages in thread
From: Marius Vlad @ 2016-02-02 13:03 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
---
 tests/Makefile.sources  |   1 +
 tests/kms_hdmi_inject.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 166 insertions(+)
 create mode 100644 tests/kms_hdmi_inject.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index d431ebf..13c2552 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -170,6 +170,7 @@ TESTS_progs = \
 	gen3_render_tiledy_blits \
 	gen7_forcewake_mt \
 	kms_3d \
+	kms_hdmi_inject \
 	kms_fence_pin_leak \
 	kms_force_connector_basic \
 	kms_pwrite_crc \
diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
new file mode 100644
index 0000000..8f75116
--- /dev/null
+++ b/tests/kms_hdmi_inject.c
@@ -0,0 +1,165 @@
+/*
+ * Copyright © 2016 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.h"
+
+#define HDISPLAY_4K	3840
+#define VDISPLAY_4K	2160
+
+IGT_TEST_DESCRIPTION("Tests 4K and audio HDMI injection.");
+
+static drmModeConnector *
+get_connector(int drm_fd, drmModeRes *res)
+{
+	int i;
+	drmModeConnector *connector;
+
+	for (i = 0; i < res->count_connectors; i++) {
+
+		connector =
+			drmModeGetConnectorCurrent(drm_fd, res->connectors[i]);
+
+		if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA &&
+		    connector->connection == DRM_MODE_DISCONNECTED)
+			break;
+
+		drmModeFreeConnector(connector);
+		connector = NULL;
+	}
+
+	return connector;
+}
+
+static void
+hdmi_inject_4k(int drm_fd, drmModeConnector *connector)
+{
+	unsigned char *edid;
+	size_t length;
+	struct kmstest_connector_config config;
+	int ret, cid, i, crtc_mask = -1;
+	int fb_id;
+	struct igt_fb fb;
+	uint8_t found_4k_mode = 0;
+	uint32_t devid;
+
+	devid = intel_get_drm_devid(drm_fd);
+
+	/* 4K requires at least HSW */
+	igt_require(IS_HASWELL(devid) || IS_BROADWELL(devid));
+
+	kmstest_edid_add_4k(igt_kms_get_base_edid(), EDID_LENGTH, &edid,
+			    &length);
+
+	kmstest_force_edid(drm_fd, connector, edid, length);
+
+	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
+		igt_skip("Could not force connector on\n");
+
+	cid = connector->connector_id;
+
+	connector = drmModeGetConnectorCurrent(drm_fd, cid);
+
+	for (i = 0; i < connector->count_modes; i++) {
+		if (connector->modes[i].hdisplay == HDISPLAY_4K &&
+		    connector->modes[i].vdisplay == VDISPLAY_4K) {
+			found_4k_mode++;
+			break;
+		}
+	}
+
+	igt_assert(found_4k_mode);
+
+	/* create a configuration */
+	ret = kmstest_get_connector_config(drm_fd, cid, crtc_mask, &config);
+	igt_assert(ret);
+
+	igt_info("  ");
+	kmstest_dump_mode(&connector->modes[i]);
+
+	/* create framebuffer */
+	fb_id = igt_create_fb(drm_fd, connector->modes[i].hdisplay,
+			      connector->modes[i].vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      LOCAL_DRM_FORMAT_MOD_NONE, &fb);
+
+	ret = drmModeSetCrtc(drm_fd, config.crtc->crtc_id, fb_id, 0, 0,
+			     &connector->connector_id, 1,
+			     &connector->modes[i]);
+
+	igt_assert(ret == 0);
+
+	igt_remove_fb(drm_fd, &fb);
+
+	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
+	kmstest_force_edid(drm_fd, connector, NULL, 0);
+
+	free(edid);
+}
+
+static void
+hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
+{
+	unsigned char *edid;
+	size_t length;
+
+	kmstest_edid_add_audio(igt_kms_get_base_edid(), EDID_LENGTH, &edid,
+			       &length);
+
+	kmstest_force_edid(drm_fd, connector, edid, length);
+
+	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
+		igt_skip("Could not force connector on\n");
+
+	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
+	kmstest_force_edid(drm_fd, connector, NULL, 0);
+
+	free(edid);
+}
+
+igt_main
+{
+	int drm_fd;
+	drmModeRes *res;
+	drmModeConnector *connector;
+
+	igt_fixture {
+		drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		res = drmModeGetResources(drm_fd);
+
+		connector = get_connector(drm_fd, res);
+		igt_require(connector);
+
+
+	}
+
+	igt_subtest("inject-4k")
+		hdmi_inject_4k(drm_fd, connector);
+
+	igt_subtest("inject-audio")
+		hdmi_inject_audio(drm_fd, connector);
+
+	igt_fixture {
+		drmModeFreeConnector(connector);
+	}
+}
-- 
2.7.0.rc3

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

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

* [PATCH 3/3] lib/igt_kms: Remove check against HDMI on HSW and BDW when forcing a connector. This should allow running tests/kms_hdmi_inject.
  2016-02-02 13:03 [PATCH 1/3] lib/igt_kms: Add support for 4K and audio HDMI EDID injection Marius Vlad
  2016-02-02 13:03 ` [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities Marius Vlad
@ 2016-02-02 13:03 ` Marius Vlad
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Vlad @ 2016-02-02 13:03 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
---
 lib/igt_kms.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 64aa5d1..9b294dd 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -384,16 +384,8 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
 	const char *value;
 	int debugfs_fd, ret, len;
 	drmModeConnector *temp;
-	uint32_t devid;
 
-	devid = intel_get_drm_devid(drm_fd);
-
-	/* forcing hdmi or dp connectors on HSW and BDW 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_HASWELL(devid) || IS_BROADWELL(devid)))
+	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
 		return false;
 
 	switch (state) {
-- 
2.7.0.rc3

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

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

* Re: [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities.
  2016-02-02 13:03 ` [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities Marius Vlad
@ 2016-02-11  9:13   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2016-02-11  9:13 UTC (permalink / raw)
  To: Marius Vlad; +Cc: intel-gfx

On Tue, Feb 02, 2016 at 03:03:37PM +0200, Marius Vlad wrote:
> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
> ---
>  tests/Makefile.sources  |   1 +
>  tests/kms_hdmi_inject.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 166 insertions(+)
>  create mode 100644 tests/kms_hdmi_inject.c
> 
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index d431ebf..13c2552 100644

Some of this should be bat tests I think, and then probably in
kms_force_connector_basic.
-Daniel
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -170,6 +170,7 @@ TESTS_progs = \
>  	gen3_render_tiledy_blits \
>  	gen7_forcewake_mt \
>  	kms_3d \
> +	kms_hdmi_inject \
>  	kms_fence_pin_leak \
>  	kms_force_connector_basic \
>  	kms_pwrite_crc \
> diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
> new file mode 100644
> index 0000000..8f75116
> --- /dev/null
> +++ b/tests/kms_hdmi_inject.c
> @@ -0,0 +1,165 @@
> +/*
> + * Copyright © 2016 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.h"
> +
> +#define HDISPLAY_4K	3840
> +#define VDISPLAY_4K	2160
> +
> +IGT_TEST_DESCRIPTION("Tests 4K and audio HDMI injection.");
> +
> +static drmModeConnector *
> +get_connector(int drm_fd, drmModeRes *res)
> +{
> +	int i;
> +	drmModeConnector *connector;
> +
> +	for (i = 0; i < res->count_connectors; i++) {
> +
> +		connector =
> +			drmModeGetConnectorCurrent(drm_fd, res->connectors[i]);
> +
> +		if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA &&
> +		    connector->connection == DRM_MODE_DISCONNECTED)
> +			break;
> +
> +		drmModeFreeConnector(connector);
> +		connector = NULL;
> +	}
> +
> +	return connector;
> +}
> +
> +static void
> +hdmi_inject_4k(int drm_fd, drmModeConnector *connector)
> +{
> +	unsigned char *edid;
> +	size_t length;
> +	struct kmstest_connector_config config;
> +	int ret, cid, i, crtc_mask = -1;
> +	int fb_id;
> +	struct igt_fb fb;
> +	uint8_t found_4k_mode = 0;
> +	uint32_t devid;
> +
> +	devid = intel_get_drm_devid(drm_fd);
> +
> +	/* 4K requires at least HSW */
> +	igt_require(IS_HASWELL(devid) || IS_BROADWELL(devid));
> +
> +	kmstest_edid_add_4k(igt_kms_get_base_edid(), EDID_LENGTH, &edid,
> +			    &length);
> +
> +	kmstest_force_edid(drm_fd, connector, edid, length);
> +
> +	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
> +		igt_skip("Could not force connector on\n");
> +
> +	cid = connector->connector_id;
> +
> +	connector = drmModeGetConnectorCurrent(drm_fd, cid);
> +
> +	for (i = 0; i < connector->count_modes; i++) {
> +		if (connector->modes[i].hdisplay == HDISPLAY_4K &&
> +		    connector->modes[i].vdisplay == VDISPLAY_4K) {
> +			found_4k_mode++;
> +			break;
> +		}
> +	}
> +
> +	igt_assert(found_4k_mode);
> +
> +	/* create a configuration */
> +	ret = kmstest_get_connector_config(drm_fd, cid, crtc_mask, &config);
> +	igt_assert(ret);
> +
> +	igt_info("  ");
> +	kmstest_dump_mode(&connector->modes[i]);
> +
> +	/* create framebuffer */
> +	fb_id = igt_create_fb(drm_fd, connector->modes[i].hdisplay,
> +			      connector->modes[i].vdisplay,
> +			      DRM_FORMAT_XRGB8888,
> +			      LOCAL_DRM_FORMAT_MOD_NONE, &fb);
> +
> +	ret = drmModeSetCrtc(drm_fd, config.crtc->crtc_id, fb_id, 0, 0,
> +			     &connector->connector_id, 1,
> +			     &connector->modes[i]);
> +
> +	igt_assert(ret == 0);
> +
> +	igt_remove_fb(drm_fd, &fb);
> +
> +	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
> +	kmstest_force_edid(drm_fd, connector, NULL, 0);
> +
> +	free(edid);
> +}
> +
> +static void
> +hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
> +{
> +	unsigned char *edid;
> +	size_t length;
> +
> +	kmstest_edid_add_audio(igt_kms_get_base_edid(), EDID_LENGTH, &edid,
> +			       &length);
> +
> +	kmstest_force_edid(drm_fd, connector, edid, length);
> +
> +	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
> +		igt_skip("Could not force connector on\n");
> +
> +	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
> +	kmstest_force_edid(drm_fd, connector, NULL, 0);
> +
> +	free(edid);
> +}
> +
> +igt_main
> +{
> +	int drm_fd;
> +	drmModeRes *res;
> +	drmModeConnector *connector;
> +
> +	igt_fixture {
> +		drm_fd = drm_open_driver_master(DRIVER_INTEL);
> +		res = drmModeGetResources(drm_fd);
> +
> +		connector = get_connector(drm_fd, res);
> +		igt_require(connector);
> +
> +
> +	}
> +
> +	igt_subtest("inject-4k")
> +		hdmi_inject_4k(drm_fd, connector);
> +
> +	igt_subtest("inject-audio")
> +		hdmi_inject_audio(drm_fd, connector);
> +
> +	igt_fixture {
> +		drmModeFreeConnector(connector);
> +	}
> +}
> -- 
> 2.7.0.rc3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-02-11  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 13:03 [PATCH 1/3] lib/igt_kms: Add support for 4K and audio HDMI EDID injection Marius Vlad
2016-02-02 13:03 ` [PATCH 2/3] tests/kms_hdmi_inject: Test to make use of HDMI injection capabilities Marius Vlad
2016-02-11  9:13   ` Daniel Vetter
2016-02-02 13:03 ` [PATCH 3/3] lib/igt_kms: Remove check against HDMI on HSW and BDW when forcing a connector. This should allow running tests/kms_hdmi_inject Marius Vlad

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.