summaryrefslogtreecommitdiff
path: root/drmdisplaycomposition.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 /drmdisplaycomposition.cpp
parentfd1382895821a40310da9a22d7e0dce5bef4373b (diff)
downloaddrm_hwcomposer-db7a17d28ca48f81be3091e99564e47fa0503e9e.tar.gz
drm_hwcomposer-db7a17d28ca48f81be3091e99564e47fa0503e9e.tar.xz
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 'drmdisplaycomposition.cpp')
-rw-r--r--drmdisplaycomposition.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/drmdisplaycomposition.cpp b/drmdisplaycomposition.cpp
index f049f2d..2f8d651 100644
--- a/drmdisplaycomposition.cpp
+++ b/drmdisplaycomposition.cpp
@@ -26,6 +26,7 @@
#include <cutils/log.h>
#include <sw_sync.h>
#include <sync/sync.h>
+#include <xf86drmMode.h>
namespace android {
@@ -43,7 +44,8 @@ DrmDisplayComposition::DrmDisplayComposition()
importer_(NULL),
type_(DRM_COMPOSITION_TYPE_EMPTY),
timeline_fd_(-1),
- timeline_(0) {
+ timeline_(0),
+ dpms_mode_(DRM_MODE_DPMS_ON) {
}
DrmDisplayComposition::~DrmDisplayComposition() {
@@ -109,6 +111,14 @@ int DrmDisplayComposition::AddLayer(hwc_layer_1_t *layer, hwc_drm_bo_t *bo,
return 0;
}
+int DrmDisplayComposition::AddDpmsMode(uint32_t dpms_mode) {
+ if (!validate_composition_type(DRM_COMPOSITION_TYPE_DPMS))
+ return -EINVAL;
+ dpms_mode_ = dpms_mode;
+ type_ = DRM_COMPOSITION_TYPE_DPMS;
+ return 0;
+}
+
int DrmDisplayComposition::FinishComposition() {
int ret = sw_sync_timeline_inc(timeline_fd_, timeline_);
if (ret)
@@ -120,4 +130,8 @@ int DrmDisplayComposition::FinishComposition() {
DrmCompositionLayerVector_t *DrmDisplayComposition::GetCompositionLayers() {
return &layers_;
}
+
+uint32_t DrmDisplayComposition::dpms_mode() const {
+ return dpms_mode_;
+}
}