summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-24 23:33:09 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-04-30 18:07:58 +0200
commit29ee36f2597747c01d5c79c93ed31f5bcd06e219 (patch)
tree0405a9d1331ddb83d9357fe97819ca964e494f5e /lib
parent066ad35ee7b39ab51fb5b8e54c3abd72df016413 (diff)
lib: extract kmstest_set_connector_dpms
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_kms.c28
-rw-r--r--lib/igt_kms.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fffad9f6..d00250da 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -180,6 +180,34 @@ int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
return pfci.pipe;
}
+void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode)
+{
+ int i, dpms = 0;
+ bool found_it = false;
+
+ for (i = 0; i < connector->count_props; i++) {
+ struct drm_mode_get_property prop;
+
+ prop.prop_id = connector->props[i];
+ prop.count_values = 0;
+ prop.count_enum_blobs = 0;
+ if (drmIoctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
+ continue;
+
+ if (strcmp(prop.name, "DPMS"))
+ continue;
+
+ dpms = prop.prop_id;
+ found_it = true;
+ break;
+ }
+ igt_assert_f(found_it, "DPMS property not found on %d\n",
+ connector->connector_id);
+
+ igt_assert(drmModeConnectorSetProperty(fd, connector->connector_id,
+ dpms, mode) == 0);
+}
+
static signed long set_vt_mode(unsigned long mode)
{
int fd;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 439a6346..8e80d4be 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -88,6 +88,7 @@ const char *kmstest_pipe_str(int pipe);
const char *kmstest_encoder_type_str(int type);
const char *kmstest_connector_status_str(int type);
const char *kmstest_connector_type_str(int type);
+void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode);
/*
* A small modeset API