summaryrefslogtreecommitdiff
path: root/drmresources.cpp
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2015-06-24 18:46:05 -0700
committerSean Paul <seanpaul@chromium.org>2015-07-13 11:57:56 -0400
commitdb7a17d28ca48f81be3091e99564e47fa0503e9e (patch)
treef7da7b1002eab74fd0edfcf86ab2f8efb280ca67 /drmresources.cpp
parentfd1382895821a40310da9a22d7e0dce5bef4373b (diff)
drm_hwcomposer: Process DPMS requests through compositor
This patch changes the behavior of DPMS in hwcomposer from applying asynchronously/immediately, to queuing in the compositor and being processed in order. This is desirable for a couple of reasons: 1- It ensures all frames set before set_power_mode are shown on the screen before it turns off 2- We make sure we don't rmfb a framebuffer that is currently applied to a disabled crtc. The second reason above can cause the display to turn back off once it's on since the fb will dereference to zero in the kernel and it will disable the pipe without notifying us. Change-Id: I2aab9ee0353b12fecced46766ed2dbb64f0aef4b Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drmresources.cpp')
-rw-r--r--drmresources.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/drmresources.cpp b/drmresources.cpp
index 2cda217..9be990f 100644
--- a/drmresources.cpp
+++ b/drmresources.cpp
@@ -467,19 +467,22 @@ int DrmResources::SetDpmsMode(int display, uint64_t mode) {
return -EINVAL;
}
- DrmConnector *c = GetConnectorForDisplay(display);
- if (!c) {
- ALOGE("Failed to get DrmConnector for display %d", display);
- return -ENODEV;
+ DrmComposition *comp = (DrmComposition *)compositor_.CreateComposition(NULL);
+ if (!comp) {
+ ALOGE("Failed to create composition for dpms on %d", display);
+ return -ENOMEM;
}
-
- const DrmProperty &prop = c->dpms_property();
- int ret = drmModeConnectorSetProperty(fd_, c->id(), prop.id(), mode);
+ int ret = comp->AddDpmsMode(display, mode);
if (ret) {
- ALOGE("Failed to set DPMS property for connector %d", c->id());
+ ALOGE("Failed to add dpms %ld to composition on %d %d", mode, display, ret);
+ delete comp;
+ return ret;
+ }
+ ret = compositor_.QueueComposition((Composition *)comp);
+ if (ret) {
+ ALOGE("Failed to queue dpms composition on %d %d", display, ret);
return ret;
}
-
return 0;
}