All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude <lyude@redhat.com>
To: intel-gfx@lists.freedesktop.org
Cc: Lyude <lyude@redhat.com>
Subject: [RESEND PATCH i-g-t 4/5] igt_kms: Add kmstest_set_connector_broadcast_rgb()
Date: Fri, 20 Jan 2017 13:58:23 -0500	[thread overview]
Message-ID: <20170120185824.12692-5-lyude@redhat.com> (raw)
In-Reply-To: <20170120185824.12692-1-lyude@redhat.com>

A simple helper that checks whether or not the given connector has the
"Broadcast RGB" prop, and if so sets it to the given mode. Required for
working with the Chamelium since the Chamelium EDIDs enable limited
color ranges by default on i915 and break frame dump comparisons/CRCs.

Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Signed-off-by: Lyude <lyude@redhat.com>
---
 lib/igt_kms.c | 34 ++++++++++++++++++++++++++++++++++
 lib/igt_kms.h | 16 ++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 80b7939..d9d4ad7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1035,6 +1035,40 @@ void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode)
 }
 
 /**
+ * kmstest_set_connector_broadcast_rgb:
+ * @fd: DRM fd
+ * @connector: libdrm connector
+ * @mode: Broadcast RGB mode
+ *
+ * This function sets the Broadcast RGB prop of @connector to @mode, if there
+ * is one.
+ *
+ * Returns: true if we found and set the Broadcast RGB prop, false otherwise
+ */
+bool kmstest_set_connector_broadcast_rgb(int fd, drmModeConnector *connector,
+					 enum kmstest_broadcast_rgb_mode mode)
+{
+	uint32_t prop_id;
+	int ret;
+
+	ret = kmstest_get_property(fd, connector->connector_id,
+				   DRM_MODE_OBJECT_CONNECTOR, "Broadcast RGB",
+				   &prop_id, NULL, NULL);
+	if (!ret) {
+		igt_debug("Broadcast RGB property not found on %d\n",
+			  connector->connector_id);
+		return false;
+	}
+
+	igt_debug("Setting Broadcast RGB mode on connector %d to %d\n",
+		  connector->connector_id, mode);
+	ret = drmModeConnectorSetProperty(fd, connector->connector_id, prop_id,
+					  mode);
+
+	return ret == 0;
+}
+
+/**
  * kmstest_get_property:
  * @drm_fd: drm file descriptor
  * @object_id: object whose properties we're going to get
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index d1aee07..bf9f1f4 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -166,6 +166,20 @@ enum kmstest_force_connector_state {
 	FORCE_CONNECTOR_OFF
 };
 
+/**
+ * kmstest_broadcast_rgb_mode:
+ * @BROADCAST_RGB_AUTO: Choose the color range to use automatically
+ * @BROADCAST_RGB_FULL: Force the connector to use full color range
+ * @BROADCAST_RGB_16_235: Force the connector to use a limited 16:235 color
+ * range
+ */
+enum kmstest_broadcast_rgb_mode {
+	BROADCAST_RGB_AUTO = 0,
+	BROADCAST_RGB_FULL,
+	BROADCAST_RGB_16_235
+};
+
+
 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);
@@ -184,6 +198,8 @@ int kmstest_pipe_to_index(char pipe);
 void kmstest_free_connector_config(struct kmstest_connector_config *config);
 
 void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode);
+bool kmstest_set_connector_broadcast_rgb(int fd, drmModeConnector *connector,
+					 enum kmstest_broadcast_rgb_mode mode);
 bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 			  const char *name, uint32_t *prop_id, uint64_t *value,
 			  drmModePropertyPtr *prop);
-- 
2.9.3

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

  parent reply	other threads:[~2017-01-20 18:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 18:58 [RESEND PATCH i-g-t v4 0/5] Add support for the Chamelium Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t v2 1/5] igt_aux: Add igt_set_autoresume_delay() Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t v3 2/5] igt_kms: Add helpers for watching for sysfs hotplug events Lyude
2017-01-20 18:58 ` [RESEND PATCH i-g-t 3/5] igt_kms: Add igt_output_from_connector Lyude
2017-01-20 18:58 ` Lyude [this message]
2017-01-20 18:58 ` [RESEND PATCH i-g-t v4 5/5] Add support for hotplug testing with the Chamelium Lyude

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20170120185824.12692-5-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

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

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