Revert "Revert "Tie vr flinger to persistent vr mode""
This reverts commit 7480c060cb3466d97ec3125d61bbace153f534c8.
Transfer display control to vr flinger when persistent vr mode is
entered, rather than when vr mode is entered. This allows cardboard
apps, which will invoke vr mode but not persistent vr mode, to work as
in N.
This activates vr flinger at device boot for Daydream ready devices,
which fixes an issue where an app would attempt to create a surface
before vr flinger was running, which would hang indefinitely.
The VrManager listener for persistent vr mode is put in vr flinger
instead of surface flinger. This is cleaner since the vr interaction
with the rest of the device is now consolidated in vr flinger.
While testing I encountered a problem where vr flinger was given control
of the display but vsync was turned off, causing vr flinger's post
thread to hang. I changed the vr flinger logic to give control over
vsync and other display settings to the post thread, and took the
opportunity to further simplify and improve vr flinger's thread
interactions.
Bug: 35885165
Test: Manually confirmed that when persistent vr mode is not invoked we
get the N-based render implementation, and when persistent vr mode is
invoked we get vr flinger.
Change-Id: I3b5ad599cc0748e38b861c714c4cc3118f854acf
diff --git a/libs/vr/libvrflinger/display_service.h b/libs/vr/libvrflinger/display_service.h
index a2b3ed5..2a71b4a 100644
--- a/libs/vr/libvrflinger/display_service.h
+++ b/libs/vr/libvrflinger/display_service.h
@@ -36,7 +36,7 @@
// Updates the list of actively displayed surfaces. This must be called after
// any change to client/manager attributes that affect visibility or z order.
- int UpdateActiveDisplaySurfaces();
+ void UpdateActiveDisplaySurfaces();
pdx::BorrowedChannelHandle SetupPoseBuffer(size_t extended_region_size,
int usage);
@@ -63,13 +63,8 @@
return hardware_composer_.display_metrics();
}
- void SetActive(bool activated) {
- if (activated) {
- hardware_composer_.Resume();
- } else {
- hardware_composer_.Suspend();
- }
- }
+ void GrantDisplayOwnership() { hardware_composer_.Enable(); }
+ void SeizeDisplayOwnership() { hardware_composer_.Disable(); }
void OnHardwareComposerRefresh();
@@ -88,8 +83,6 @@
DisplayRPC::ByteBuffer OnGetEdsCapture(pdx::Message& message);
- int OnEnterVrMode(pdx::Message& message);
- int OnExitVrMode(pdx::Message& message);
void OnSetViewerParams(pdx::Message& message,
const ViewerParams& view_params);
pdx::LocalChannelHandle OnGetPoseBuffer(pdx::Message& message);