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

Commit c2cbe4ed authored by Alex Sakhartchouk's avatar Alex Sakhartchouk Committed by Alex Vakulenko
Browse files

Start VR WindowManager in a headless mode.

Only allocate resources when we need to show ourselves
and draw something.

Bug: None
Test: None

Change-Id: Ied48f024b145ee6f574484883375b939e7814e53
parent 0bcc104a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -161,8 +161,10 @@ void Application::ProcessTasks(const std::vector<MainThreadTask>& tasks) {
        }
        break;
      case MainThreadTask::EnteringVrMode:
        if (!initialized_)
          AllocateResources();
        if (!initialized_) {
          if (AllocateResources())
            ALOGE("Failed to allocate resources");
        }
        break;
      case MainThreadTask::ExitingVrMode:
        if (initialized_)
+0 −1
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ void RenderThread::RunRenderLoop(
  jobject android_context = env->NewLocalRef(android_context_global_ref_);

  int init_result = shell_view_.Initialize(env, android_context, class_loader);
  init_result += shell_view_.AllocateResources();
  init_result_promise->set_value(init_result);
  if (init_result == 0) {
    while (!quit_)
+3 −1
Original line number Diff line number Diff line
@@ -395,9 +395,11 @@ void ShellView::OnFrame(std::unique_ptr<HwcCallback::Frame> frame) {

  // If we are showing ourselves the main thread is not processing anything,
  // so give it a kick.
  if (visibility && !current_frame_.visibility)
  if (visibility && !current_frame_.visibility) {
    QueueTask(MainThreadTask::EnteringVrMode);
    QueueTask(MainThreadTask::Show);
  }
}

bool ShellView::IsHit(const vec3& view_location, const vec3& view_direction,
                      vec3* hit_location, vec2* hit_location_in_window_coord,
+0 −5
Original line number Diff line number Diff line
@@ -11,11 +11,6 @@ int main(int /* argc */, char** /* argv */) {
    return 1;
  }

  if (app.AllocateResources()) {
    ALOGE("Failed to allocate resources");
    return 1;
  }

  while (true)
    app.DrawFrame();