Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69a5973c authored by Corey Tabaka's avatar Corey Tabaka
Browse files

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
parent 5b603552
Loading
Loading
Loading
Loading
+6 −11
Original line number Original line Diff line number Diff line
@@ -210,6 +210,9 @@ void HardwareComposer::UpdatePostThreadState(PostThreadStateType state,
}
}


void HardwareComposer::OnPostThreadResumed() {
void HardwareComposer::OnPostThreadResumed() {
  if (request_display_callback_)
    request_display_callback_(true);

  hwc2_hidl_->resetCommands();
  hwc2_hidl_->resetCommands();


  // HIDL HWC seems to have an internal race condition. If we submit a frame too
  // 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.
  // Trigger target-specific performance mode change.
  property_set(kDvrPerformanceProperty, "idle");
  property_set(kDvrPerformanceProperty, "idle");

  if (request_display_callback_)
    request_display_callback_(false);
}
}


HWC::Error HardwareComposer::Validate(hwc2_display_t display) {
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.
  // Set idle state based on whether there are any surfaces to handle.
  UpdatePostThreadState(PostThreadState::Idle, display_idle);
  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,
int HardwareComposer::OnNewGlobalBuffer(DvrGlobalBufferKey key,