[Intel-gfx] [PATCH i-g-t 4/5] igt_kms: Add kmstest_set_connector_broadcast_rgb()
Lyude
lyude at redhat.com
Mon Jan 16 19:26:52 UTC 2017
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 at tomeuvizoso.net>
Signed-off-by: Lyude <lyude at 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 95d16ef..32ac924 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 fd9ff87..171df66 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);
@@ -183,6 +197,8 @@ bool kmstest_probe_connector_config(int drm_fd, uint32_t connector_id,
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
More information about the Intel-gfx
mailing list