compositor-drm: Record current DPMS level

Track the current DPMS level for any given output, and track failure (or
otherwise) of the DPMS-setting property call.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
dev
Daniel Stone 10 years ago
parent eee580b894
commit 36609c740f
  1. 12
      src/compositor-drm.c

@ -170,6 +170,8 @@ struct drm_output {
drmModePropertyPtr dpms_prop; drmModePropertyPtr dpms_prop;
uint32_t format; uint32_t format;
enum dpms_enum dpms;
int vblank_pending; int vblank_pending;
int page_flip_pending; int page_flip_pending;
int destroy_pending; int destroy_pending;
@ -1670,12 +1672,20 @@ drm_set_dpms(struct weston_output *output_base, enum dpms_enum level)
struct drm_output *output = (struct drm_output *) output_base; struct drm_output *output = (struct drm_output *) output_base;
struct weston_compositor *ec = output_base->compositor; struct weston_compositor *ec = output_base->compositor;
struct drm_backend *b = (struct drm_backend *)ec->backend; struct drm_backend *b = (struct drm_backend *)ec->backend;
int ret;
if (!output->dpms_prop) if (!output->dpms_prop)
return; return;
drmModeConnectorSetProperty(b->drm.fd, output->connector_id, ret = drmModeConnectorSetProperty(b->drm.fd, output->connector_id,
output->dpms_prop->prop_id, level); output->dpms_prop->prop_id, level);
if (ret) {
weston_log("DRM: DPMS: failed property set for %s\n",
output->base.name);
return;
}
output->dpms = level;
} }
static const char * const connector_type_names[] = { static const char * const connector_type_names[] = {

Loading…
Cancel
Save