[RESEND PATCH i-g-t 4/5] igt_kms: Add kmstest_set_connector_broadcast_rgb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
Signed-off-by: Lyude <lyude@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux