libvrflinger: Move display request to avoid duplicate calls.
Move the request display call to avoid duplicate calls when direct
surfaces change but the current VrFlinger mode does not change.
Bug: 62389162
Test: build; flash; VrFlinger mode works.
Change-Id: I1348ada93e2992306cba7e319f9b20726fb97cb7
diff --git a/libs/vr/libvrflinger/hardware_composer.cpp b/libs/vr/libvrflinger/hardware_composer.cpp
index 599017f..00172a1 100644
--- a/libs/vr/libvrflinger/hardware_composer.cpp
+++ b/libs/vr/libvrflinger/hardware_composer.cpp
@@ -210,6 +210,9 @@
}
void HardwareComposer::OnPostThreadResumed() {
+ if (request_display_callback_)
+ request_display_callback_(true);
+
hwc2_hidl_->resetCommands();
// HIDL HWC seems to have an internal race condition. If we submit a frame too
@@ -246,6 +249,9 @@
// Trigger target-specific performance mode change.
property_set(kDvrPerformanceProperty, "idle");
+
+ if (request_display_callback_)
+ request_display_callback_(false);
}
HWC::Error HardwareComposer::Validate(hwc2_display_t display) {
@@ -475,17 +481,6 @@
// Set idle state based on whether there are any surfaces to handle.
UpdatePostThreadState(PostThreadState::Idle, display_idle);
-
- // XXX: TEMPORARY
- // Request control of the display based on whether there are any surfaces to
- // handle. This callback sets the post thread active state once the transition
- // is complete in SurfaceFlinger.
- // TODO(eieio): Unify the control signal used to move SurfaceFlinger into VR
- // mode. Currently this is hooked up to persistent VR mode, but perhaps this
- // makes more sense to control it from VrCore, which could in turn base its
- // decision on persistent VR mode.
- if (request_display_callback_)
- request_display_callback_(!display_idle);
}
int HardwareComposer::OnNewGlobalBuffer(DvrGlobalBufferKey key,