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

Commit 774f5649 authored by Inseob Kim's avatar Inseob Kim Committed by Gerrit Code Review
Browse files

Merge "Remove ro.boot.vr references"

parents e282bbba 15791eaa
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -308,14 +308,6 @@ class TestDisplayManager {
class DvrDisplayManagerTest : public Test {
 protected:
  void SetUp() override {
    // dvr display manager test doesn't apply to standalone vr devices because
    // tests cannot create display manager client on these devices.
    if (property_get_bool("ro.boot.vr", false)) {
      GTEST_SKIP()
          << "All tests in DvrDisplayManagerTest test case are skipped "
             "because the device boot to VR.";
    }

    int ret;
    DvrDisplayManager* display_manager;
    DvrSurfaceState* surface_state;
+5 −38
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ namespace dvr {
namespace {

const char kDvrPerformanceProperty[] = "sys.dvr.performance";
const char kDvrStandaloneProperty[] = "ro.boot.vr";

const char kRightEyeOffsetProperty[] = "dvr.right_eye_offset_ns";

@@ -147,8 +146,6 @@ bool HardwareComposer::Initialize(
    return false;
  }

  is_standalone_device_ = property_get_bool(kDvrStandaloneProperty, false);

  request_display_callback_ = request_display_callback;

  primary_display_ = GetDisplayParams(composer, primary_display_id, true);
@@ -192,8 +189,6 @@ void HardwareComposer::OnBootFinished() {
    return;
  boot_finished_ = true;
  post_thread_wait_.notify_one();
  if (is_standalone_device_)
    request_display_callback_(true);
}

// Update the post thread quiescent state based on idle and suspended inputs.
@@ -253,17 +248,11 @@ void HardwareComposer::OnPostThreadPaused() {
  layers_.clear();

  // Phones create a new composer client on resume and destroy it on pause.
  // Standalones only create the composer client once and then use SetPowerMode
  // to control the screen on pause/resume.
  if (!is_standalone_device_) {
  if (composer_callback_ != nullptr) {
    composer_callback_->SetVsyncService(nullptr);
    composer_callback_ = nullptr;
  }
  composer_.reset(nullptr);
  } else {
    EnableDisplay(*target_display_, false);
  }

  // Trigger target-specific performance mode change.
  property_set(kDvrPerformanceProperty, "idle");
@@ -574,7 +563,7 @@ void HardwareComposer::SetDisplaySurfaces(
    surfaces_changed_ = true;
  }

  if (request_display_callback_ && !is_standalone_device_)
  if (request_display_callback_)
    request_display_callback_(!display_idle);

  // Set idle state based on whether there are any surfaces to handle.
@@ -759,28 +748,6 @@ void HardwareComposer::PostThread() {

  VsyncEyeOffsets vsync_eye_offsets = get_vsync_eye_offsets();

  if (is_standalone_device_) {
    // First, wait until boot finishes.
    std::unique_lock<std::mutex> lock(post_thread_mutex_);
    if (PostThreadCondWait(lock, -1, [this] { return boot_finished_; })) {
      return;
    }

    // Then, wait until we're either leaving the quiescent state, or the boot
    // finished display off timeout expires.
    if (PostThreadCondWait(lock, kBootFinishedDisplayOffTimeoutSec,
                           [this] { return !post_thread_quiescent_; })) {
      return;
    }

    LOG_ALWAYS_FATAL_IF(post_thread_state_ & PostThreadState::Suspended,
                        "Vr flinger should own the display by now.");
    post_thread_resumed_ = true;
    post_thread_ready_.notify_all();
    if (!composer_)
      CreateComposer();
  }

  while (1) {
    ATRACE_NAME("HardwareComposer::PostThread");

+0 −34
Original line number Diff line number Diff line
@@ -42,9 +42,6 @@ constexpr auto kVrFlingerSwitchMaxTime = std::chrono::seconds(1);
// completed.
constexpr auto kVrFlingerSwitchPollInterval = std::chrono::milliseconds(50);

// How long to wait for a device that boots to VR to have vr flinger ready.
constexpr auto kBootVrFlingerWaitTimeout = std::chrono::seconds(30);

// A Binder connection to surface flinger.
class SurfaceFlingerConnection {
 public:
@@ -154,11 +151,6 @@ TEST(VrFlingerTest, ActivateDeactivate) {
    return;
  }

  // This test doesn't apply to standalone vr devices.
  if (property_get_bool("ro.boot.vr", false)) {
    return;
  }

  auto surface_flinger_connection = SurfaceFlingerConnection::Create();
  ASSERT_NE(surface_flinger_connection, nullptr);

@@ -231,31 +223,5 @@ TEST(VrFlingerTest, ActivateDeactivate) {
      SurfaceFlingerConnection::VrFlingerSwitchResult::kSuccess);
}

// This test runs only on devices that boot to vr. Such a device should boot to
// a state where vr flinger is running, and the test verifies this after a
// delay.
TEST(BootVrFlingerTest, BootsToVrFlinger) {
  // Exit if we are not running on a device that boots to vr.
  if (!property_get_bool("ro.boot.vr", false)) {
    return;
  }

  auto surface_flinger_connection = SurfaceFlingerConnection::Create();
  ASSERT_NE(surface_flinger_connection, nullptr);

  // Verify that vr flinger is enabled.
  ASSERT_TRUE(surface_flinger_connection->IsAlive());
  auto vr_flinger_active = surface_flinger_connection->IsVrFlingerActive();
  ASSERT_TRUE(vr_flinger_active.has_value());

  bool active_value = vr_flinger_active.value();
  if (!active_value) {
    // Try again, but delay up to 30 seconds.
    ASSERT_EQ(surface_flinger_connection->WaitForVrFlingerTimed(true,
        kVrFlingerSwitchPollInterval, kBootVrFlingerWaitTimeout),
        SurfaceFlingerConnection::VrFlingerSwitchResult::kSuccess);
  }
}

}  // namespace dvr
}  // namespace android