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
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index f1d925a..95e2333 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -926,19 +926,21 @@
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);