summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaixia Shi <hshi@chromium.org>2015-11-24 20:42:45 (GMT)
committerHaixia Shi <hshi@chromium.org>2015-11-24 20:42:45 (GMT)
commit6afbb6aef0c89b8e737624c4baa1208aaec6f48e (patch)
treec6d66ca315cf7dd67f475c79aee91e928a54b20a
parentd0cff784a82bbb63047420da20fef7d3739715bd (diff)
downloaddrm_hwcomposer-6afbb6aef0c89b8e737624c4baa1208aaec6f48e.tar.gz
drm_hwcomposer-6afbb6aef0c89b8e737624c4baa1208aaec6f48e.tar.xz
drm_hwcomposer: only check the composition after a geometry change
Do not check the composition with kernel for every frame. We are currently using synchronous atomic ioctl calls, so all test-only calls are serialized with the actual commits. BUG=25866352 TEST=same test procedure as crosbug.com/p/47206 Change-Id: Ia423243c279fc677ff6213115a8f20efa40c235e
-rw-r--r--drmdisplaycomposition.h6
-rw-r--r--drmdisplaycompositor.cpp28
2 files changed, 20 insertions, 14 deletions
diff --git a/drmdisplaycomposition.h b/drmdisplaycomposition.h
index 9be5fdd..3c94e6b 100644
--- a/drmdisplaycomposition.h
+++ b/drmdisplaycomposition.h
@@ -17,8 +17,8 @@
#ifndef ANDROID_DRM_DISPLAY_COMPOSITION_H_
#define ANDROID_DRM_DISPLAY_COMPOSITION_H_
-#include "drmhwcomposer.h"
#include "drmcrtc.h"
+#include "drmhwcomposer.h"
#include "drmplane.h"
#include "glworker.h"
#include "importer.h"
@@ -100,6 +100,10 @@ class DrmDisplayComposition {
return composition_planes_;
}
+ bool geometry_changed() const {
+ return geometry_changed_;
+ }
+
uint64_t frame_no() const {
return frame_no_;
}
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index f1d925a..95e2333 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -926,19 +926,21 @@ int DrmDisplayCompositor::Composite() {
ALOGE("Failed to prepare frame for display %d", display_);
return ret;
}
- // Send the composition to the kernel to ensure we can commit it. This is
- // just a test, it won't actually commit the frame. If the kernel rejects
- // it, squash the frame into one layer and use the squashed composition
- ret = CommitFrame(composition.get(), true);
- if (ret) {
- ALOGI("Commit test failed, squashing frame for display %d", display_);
- std::unique_ptr<DrmDisplayComposition> squashed = CreateComposition();
- ret = SquashFrame(composition.get(), squashed.get());
- if (!ret) {
- composition = std::move(squashed);
- } else {
- ALOGE("Failed to squash frame for display %d", display_);
- return ret;
+ if (composition->geometry_changed()) {
+ // Send the composition to the kernel to ensure we can commit it. This
+ // is just a test, it won't actually commit the frame. If rejected,
+ // squash the frame into one layer and use the squashed composition
+ ret = CommitFrame(composition.get(), true);
+ if (ret) {
+ ALOGI("Commit test failed, squashing frame for display %d", display_);
+ std::unique_ptr<DrmDisplayComposition> squashed = CreateComposition();
+ ret = SquashFrame(composition.get(), squashed.get());
+ if (!ret) {
+ composition = std::move(squashed);
+ } else {
+ ALOGE("Failed to squash frame for display %d", display_);
+ return ret;
+ }
}
}
frame_worker_.QueueFrame(std::move(composition), ret);