summaryrefslogtreecommitdiff
path: root/drmdisplaycomposition.cpp
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2015-06-24 18:43:01 -0700
committerSean Paul <seanpaul@chromium.org>2015-07-13 11:57:56 -0400
commitacb2a4494e79f0026f8615acc561257276a71062 (patch)
tree4a11dcad21d7b06b2ba12b19c541ac3c44bd5410 /drmdisplaycomposition.cpp
parent98e73c89a683a92f44c99fb8dc85e51bdda243ba (diff)
downloaddrm_hwcomposer-acb2a4494e79f0026f8615acc561257276a71062.tar.gz
drm_hwcomposer-acb2a4494e79f0026f8615acc561257276a71062.tar.xz
drm_hwcomposer: Add composition type to DrmComposition
This allows us to have different types of compositions. This will enable injection of non-frame related compositions such as dpms and mode. Change-Id: Ia62421c114c0c6bebccef3ce6ae936366b6aafe2 Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drmdisplaycomposition.cpp')
-rw-r--r--drmdisplaycomposition.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/drmdisplaycomposition.cpp b/drmdisplaycomposition.cpp
index 75046fb..f049f2d 100644
--- a/drmdisplaycomposition.cpp
+++ b/drmdisplaycomposition.cpp
@@ -39,7 +39,11 @@ DrmCompositionLayer::~DrmCompositionLayer() {
}
DrmDisplayComposition::DrmDisplayComposition()
- : drm_(NULL), importer_(NULL), timeline_fd_(-1), timeline_(0) {
+ : drm_(NULL),
+ importer_(NULL),
+ type_(DRM_COMPOSITION_TYPE_EMPTY),
+ timeline_fd_(-1),
+ timeline_(0) {
}
DrmDisplayComposition::~DrmDisplayComposition() {
@@ -69,11 +73,22 @@ int DrmDisplayComposition::Init(DrmResources *drm, Importer *importer) {
return 0;
}
+DrmCompositionType DrmDisplayComposition::type() const {
+ return type_;
+}
+
+bool DrmDisplayComposition::validate_composition_type(DrmCompositionType des) {
+ return type_ == DRM_COMPOSITION_TYPE_EMPTY || type_ == des;
+}
+
int DrmDisplayComposition::AddLayer(hwc_layer_1_t *layer, hwc_drm_bo_t *bo,
DrmCrtc *crtc, DrmPlane *plane) {
if (layer->transform != 0)
return -EINVAL;
+ if (!validate_composition_type(DRM_COMPOSITION_TYPE_FRAME))
+ return -EINVAL;
+
++timeline_;
layer->releaseFenceFd =
sw_sync_fence_create(timeline_fd_, "drm_fence", timeline_);
@@ -90,6 +105,7 @@ int DrmDisplayComposition::AddLayer(hwc_layer_1_t *layer, hwc_drm_bo_t *bo,
layer->acquireFenceFd = -1; // We own this now
layers_.push_back(c_layer);
+ type_ = DRM_COMPOSITION_TYPE_FRAME;
return 0;
}