diff options
author | Lyude <lyude@redhat.com> | 2017-01-05 13:01:18 -0500 |
---|---|---|
committer | Lyude <lyude@redhat.com> | 2017-01-26 11:22:51 -0500 |
commit | 3bd89da289fae2c98f0daaeba4d98ecf19289552 (patch) | |
tree | 9268eb437c59094247226d784d7672e14f27318f /lib/igt_kms.c | |
parent | 528cdaf063546d0a32cfad6d215db62111054619 (diff) |
igt_kms: Add kmstest_set_connector_broadcast_rgb()
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>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r-- | lib/igt_kms.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index b6cb299b..35a6bc4d 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 |