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

Commit eca63ec2 authored by Steven Thomas's avatar Steven Thomas Committed by Android (Google) Code Review
Browse files

Merge "Fix vr_hwc crash when re-entering vr" into pi-dev

parents 1f0622ed c683dfec
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -251,13 +251,11 @@ VrHwc::~VrHwc() {}
bool VrHwc::hasCapability(hwc2_capability_t /* capability */) { return false; }

void VrHwc::registerEventCallback(EventCallback* callback) {
  event_callback_ = callback;

  if (client_ != nullptr) {
  {
    std::lock_guard<std::mutex> guard(mutex_);
    event_callback_ = callback;
    int32_t width, height;
    GetPrimaryDisplaySize(&width, &height);
      std::lock_guard<std::mutex> guard(mutex_);
    // Create the primary display late to avoid initialization issues between
    // VR HWC and SurfaceFlinger.
    displays_[kDefaultDisplayId].reset(new HwcDisplay(width, height));
@@ -265,6 +263,10 @@ void VrHwc::registerEventCallback(EventCallback* callback) {
  event_callback_->onHotplug(kDefaultDisplayId,
                             IComposerCallback::Connection::CONNECTED);
}

void VrHwc::unregisterEventCallback() {
  std::lock_guard<std::mutex> guard(mutex_);
  event_callback_ = nullptr;
}

uint32_t VrHwc::getMaxVirtualDisplayCount() { return 1; }
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ class VrHwc : public IComposer, public ComposerHal, public ComposerView {

  std::string dumpDebugInfo() override { return {}; }
  void registerEventCallback(EventCallback* callback) override;
  void unregisterEventCallback() override {}
  void unregisterEventCallback() override;

  uint32_t getMaxVirtualDisplayCount() override;
  Error createVirtualDisplay(uint32_t width, uint32_t height,