From: Corey Tabaka Date: Tue, 6 Jun 2017 23:33:31 +0000 (-0700) Subject: libvrflinger: Move display request to avoid duplicate calls. X-Git-Tag: android-x86-9.0-r1~411^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=69a5973c81c80f5abb72f089d87d080727d4d40f;p=android-x86%2Fframeworks-native.git 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 599017f2bd..00172a1d84 100644 --- a/libs/vr/libvrflinger/hardware_composer.cpp +++ b/libs/vr/libvrflinger/hardware_composer.cpp @@ -210,6 +210,9 @@ void HardwareComposer::UpdatePostThreadState(PostThreadStateType state, } 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 @@ void HardwareComposer::OnPostThreadPaused() { // 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 @@ void HardwareComposer::SetDisplaySurfaces( // 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,