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

Commit 949c9ce5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Call validateDisplay() when skipping frames" into oc-dev

parents e721536e 0af4b9f8
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -231,6 +231,8 @@ void HardwareComposer::OnPostThreadResumed() {
      native_display_metrics_.width, native_display_metrics_.height, format,
      usage);

  hwc2_hidl_->resetCommands();

  // Associate each Layer instance with a hardware composer layer.
  for (auto layer : layers_) {
    layer->Initialize(hwc2_hidl_.get(), &native_display_metrics_);
@@ -289,6 +291,8 @@ void HardwareComposer::OnPostThreadPaused() {

  compositor_.Shutdown();

  hwc2_hidl_->resetCommands();

  // Trigger target-specific performance mode change.
  property_set(kDvrPerformanceProperty, "idle");
}
@@ -427,6 +431,12 @@ void HardwareComposer::PostLayers(bool /*is_geometry_changed*/) {
    layers_[i]->Prepare();
  }

  int32_t ret = Validate(HWC_DISPLAY_PRIMARY);
  if (ret) {
    ALOGE("HardwareComposer::Validate failed; ret=%d", ret);
    return;
  }

  // Now that we have taken in a frame from the application, we have a chance
  // to drop the frame before passing the frame along to HWC.
  // If the display driver has become backed up, we detect it here and then
@@ -467,22 +477,6 @@ void HardwareComposer::PostLayers(bool /*is_geometry_changed*/) {
          layers_[i]->GetCompositionType());
#endif

  int32_t ret = HWC2_ERROR_NONE;

  std::vector<Hwc2::IComposerClient::Rect> full_region(1);
  full_region[0].left = 0;
  full_region[0].top = 0;
  full_region[0].right = framebuffer_target_->width();
  full_region[0].bottom = framebuffer_target_->height();

  ALOGE_IF(ret, "Error setting client target : %d", ret);

  ret = Validate(HWC_DISPLAY_PRIMARY);
  if (ret) {
    ALOGE("HardwareComposer::Validate failed; ret=%d", ret);
    return;
  }

  ret = Present(HWC_DISPLAY_PRIMARY);
  if (ret) {
    ALOGE("HardwareComposer::Present failed; ret=%d", ret);
@@ -912,6 +906,13 @@ void HardwareComposer::PostThread() {
        frame_time_backlog_.clear();
        DebugHudData::data.hwc_frame_stats.SkipFrame();

        if (layer_config_changed) {
          // If the layer config changed we need to validateDisplay() even if
          // we're going to drop the frame, to flush the Composer object's
          // internal command buffer and apply our layer changes.
          Validate(HWC_DISPLAY_PRIMARY);
        }

        continue;
      } else {
        // Make the transition more obvious in systrace when the frame skip
@@ -923,10 +924,17 @@ void HardwareComposer::PostThread() {
        error = SleepUntil(display_time_est - frame_time_estimate);
        ALOGE_IF(error < 0, "HardwareComposer::PostThread: Failed to sleep: %s",
                 strerror(-error));
        if (error == kPostThreadInterrupted)
        if (error == kPostThreadInterrupted) {
          if (layer_config_changed) {
            // If the layer config changed we need to validateDisplay() even if
            // we're going to drop the frame, to flush the Composer object's
            // internal command buffer and apply our layer changes.
            Validate(HWC_DISPLAY_PRIMARY);
          }
          continue;
        }
      }
    }

    DebugHudData::data.hwc_frame_stats.AddFrame();

+4 −0
Original line number Diff line number Diff line
@@ -212,6 +212,10 @@ void Composer::registerCallback(const sp<IComposerCallback>& callback)
    }
}

void Composer::resetCommands() {
    mWriter.reset();
}

uint32_t Composer::getMaxVirtualDisplayCount()
{
    auto ret = mClient->getMaxVirtualDisplayCount();
+4 −0
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ public:

    void registerCallback(const sp<IComposerCallback>& callback);

    // Reset all pending commands in the command buffer. Useful if you want to
    // skip a frame but have already queued some commands.
    void resetCommands();

    uint32_t getMaxVirtualDisplayCount();
    bool isUsingVrComposer() const { return mIsUsingVrComposer; }
    Error createVirtualDisplay(uint32_t width, uint32_t height,