Remove the VR compositor from the framework.
Remove the VR compositor framework and enable out-of-process VR composition
in VrCore.
This CL seems large due to the ripple effect of changing the VrFlinger
API and protocol types. There are three major modules that require
concurrent changes:
1. Protocol definitions and low-level VrFlinger API in libdisplay.
* Additional changes needed to keep old interfaces working for
a short time while replacing the dependent code (dvrGraphics*).
2. VrFlinger service implementation changes to support VrCore compositor
and the removal of the internal compositor.
3. Changes to libdvr platform library API due to changes in #1 and #2.
Because of the nature of the interdependence of types and other defs it is
difficult to break this CL into smaller chunks. However, review of the three
major modules (libdisplay, libdvr, and libvrflinger) may be done separately
to ease the mental burden on reviewers.
Change Summary:
- Remove obsolete screenshot service. VR screenshots will be implemented
by VrCore.
- Update display protocol definitions for changes in VrFlinger service
requirements. The majority of the changes in libdisplay are a
consequence of these protocol and service changes.
- Update VrFlinger to support two kinds of surfaces:
1. Application - use by VR apps.
2. Direct - used by VrCore (protected by permission check).
- Remove VrFlinger internal compositor and GL context.
- Remove obsolete debug console.
- Update VrFlinger hardware composer interface to handle direct
surfaces only, removing the concept of GPU (compositor) layers.
- Update display manager to expose access to application surface info
to VrCore (protected by permission check).
- Update libdvr platform library interfaces for changes to VrFlinger
API / protocol.
- Clean up libdvr API struct setup using a common include.
- Add C++ header-only helpers for DVR platform library opaque types.
Bug: 36401174
Test: Build; run VrFlinger display test tool.
Change-Id: I15abfde5f72dbb3725a3f58621486afba6b64902
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bc4e6c5..4fb428f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -581,6 +581,7 @@
if (useVrFlinger) {
auto vrFlingerRequestDisplayCallback = [this] (bool requestDisplay) {
+ ALOGI("VR request display mode: requestDisplay=%d", requestDisplay);
mVrFlingerRequestsDisplay = requestDisplay;
signalTransaction();
};
diff --git a/services/surfaceflinger/surfaceflinger.rc b/services/surfaceflinger/surfaceflinger.rc
index 1c0427d..ff6be81 100644
--- a/services/surfaceflinger/surfaceflinger.rc
+++ b/services/surfaceflinger/surfaceflinger.rc
@@ -6,5 +6,4 @@
writepid /dev/stune/foreground/tasks
socket pdx/system/vr/display/client stream 0666 system graphics
socket pdx/system/vr/display/manager stream 0666 system graphics
- socket pdx/system/vr/display/screenshot stream 0660 system graphics
socket pdx/system/vr/display/vsync stream 0666 system graphics
diff --git a/services/vr/hardware_composer/impl/vr_hwc.cpp b/services/vr/hardware_composer/impl/vr_hwc.cpp
index 504b26f..5d51827 100644
--- a/services/vr/hardware_composer/impl/vr_hwc.cpp
+++ b/services/vr/hardware_composer/impl/vr_hwc.cpp
@@ -60,24 +60,22 @@
*height = 1920;
int error = 0;
- auto display_client = DisplayClient::Create(&error);
- SystemDisplayMetrics metrics;
-
- if (error) {
+ auto display_client = display::DisplayClient::Create(&error);
+ if (!display_client) {
ALOGE("Could not connect to display service : %s(%d)", strerror(error),
error);
return;
}
- error = display_client->GetDisplayMetrics(&metrics);
- if (error) {
+ auto status = display_client->GetDisplayMetrics();
+ if (!status) {
ALOGE("Could not get display metrics from display service : %s(%d)",
- strerror(error), error);
+ status.GetErrorMessage().c_str(), status.error());
return;
}
- *width = metrics.display_native_width;
- *height = metrics.display_native_height;
+ *width = status.get().display_width;
+ *height = status.get().display_height;
}
} // namespace
diff --git a/services/vr/vr_window_manager/shell_view.cpp b/services/vr/vr_window_manager/shell_view.cpp
index 2b53cd6..abd0651 100644
--- a/services/vr/vr_window_manager/shell_view.cpp
+++ b/services/vr/vr_window_manager/shell_view.cpp
@@ -196,8 +196,8 @@
result.appendFormat("count = %zu\n", displays_.size());
for (size_t i = 0; i < displays_.size(); ++i) {
result.appendFormat(" display_id = %" PRId32 "\n", displays_[i]->id());
- result.appendFormat(" size=%fx%f\n",
- displays_[i]->size().x(), displays_[i]->size().y());
+ result.appendFormat(" size=%fx%f\n", displays_[i]->size().x(),
+ displays_[i]->size().y());
}
result.append("\n");
@@ -210,7 +210,7 @@
void ShellView::SetRotation(int angle) {
mat4 m(Eigen::AngleAxisf(M_PI * -0.5f * angle, vec3::UnitZ()));
- for (auto& d: displays_)
+ for (auto& d : displays_)
d->set_rotation(m);
}
@@ -300,7 +300,7 @@
// Do this on demand in case vr_flinger crashed and we are reconnecting.
if (!display_client_.get()) {
int error = 0;
- display_client_ = DisplayClient::Create(&error);
+ display_client_ = display::DisplayClient::Create(&error);
if (error) {
ALOGE("Could not connect to display service : %s(%d)", strerror(error),
@@ -310,7 +310,13 @@
}
// TODO(achaulk): change when moved into vrcore.
- bool vr_running = display_client_->IsVrAppRunning();
+ auto status = display_client_->IsVrAppRunning();
+ if (!status) {
+ ALOGE("Failed to check VR running status: %s",
+ status.GetErrorMessage().c_str());
+ return base::unique_fd();
+ }
+ const bool vr_running = status.get();
base::unique_fd fd(
display->OnFrame(std::move(frame), debug_mode_, vr_running, &showing));
@@ -488,8 +494,8 @@
// Device is portrait, but in landscape when in VR.
// Rotate touch input appropriately.
const android::status_t status = dvrVirtualTouchpadTouch(
- virtual_touchpad_.get(), active_display_->touchpad_id(),
- x, y, is_touching_ ? 1.0f : 0.0f);
+ virtual_touchpad_.get(), active_display_->touchpad_id(), x, y,
+ is_touching_ ? 1.0f : 0.0f);
if (status != OK) {
ALOGE("touch failed: %d", status);
}
diff --git a/services/vr/vr_window_manager/shell_view.h b/services/vr/vr_window_manager/shell_view.h
index d90e833..9b51600 100644
--- a/services/vr/vr_window_manager/shell_view.h
+++ b/services/vr/vr_window_manager/shell_view.h
@@ -68,7 +68,7 @@
std::unique_ptr<SurfaceFlingerView> surface_flinger_view_;
std::unique_ptr<Reticle> reticle_;
- std::unique_ptr<DisplayClient> display_client_;
+ std::unique_ptr<display::DisplayClient> display_client_;
struct DvrVirtualTouchpadDeleter {
void operator()(DvrVirtualTouchpad* p) {