summaryrefslogtreecommitdiff
path: root/drmdisplaycompositor.cpp
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2015-11-25 11:04:25 -0500
committerSean Paul <seanpaul@chromium.org>2015-11-25 11:04:25 -0500
commit6c18b3b67e50e12f77f76108363493162ff36340 (patch)
tree90960a71024ca593b1e8e97e2f8d3c02c8c5da63 /drmdisplaycompositor.cpp
parent6afbb6aef0c89b8e737624c4baa1208aaec6f48e (diff)
drm_hwcomposer: Save the atomic_test result between tests
Previously, we would only test the first frame when the geometry changed. However, if SF sent us the same composition with different FBs, we could end up sending invalid frames to the kernel. This change saves the result of the atomic_test between geometry changes so we avoid using hw composition for all invalid frames. Bug: 25866352 Test: Tested on smaug, observed squashes between geometry changes Change-Id: I3b5d9e83a870481bf2e6869900eafaf0ca66a0d5 Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drmdisplaycompositor.cpp')
-rw-r--r--drmdisplaycompositor.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index 95e2333..028a6a3 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -241,6 +241,7 @@ DrmDisplayCompositor::DrmDisplayCompositor()
frame_worker_(this),
initialized_(false),
active_(false),
+ use_hw_overlays_(true),
framebuffer_index_(0),
squash_framebuffer_index_(0),
dump_frames_composited_(0),
@@ -921,26 +922,34 @@ int DrmDisplayCompositor::Composite() {
switch (composition->type()) {
case DRM_COMPOSITION_TYPE_FRAME:
- ret = PrepareFrame(composition.get());
- if (ret) {
- ALOGE("Failed to prepare frame for display %d", display_);
- return ret;
+ if (use_hw_overlays_ || composition->geometry_changed()) {
+ ret = PrepareFrame(composition.get());
+ if (ret) {
+ ALOGE("Failed to prepare 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) {
+ 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;
- }
+ use_hw_overlays_ = !ret;
+ }
+
+ // If use_hw_overlays_ is false, we can't use hardware to composite the
+ // frame. So squash all layers into a single composition and queue that
+ // instead.
+ if (!use_hw_overlays_) {
+ 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);