From eaf3836eda534021e3b4f125214a8fdc4ce97fa5 Mon Sep 17 00:00:00 2001 From: Kalyan Kondapally Date: Tue, 21 Nov 2017 00:03:26 -0800 Subject: [PATCH] Ignore updates for a pipe which has no planes. On some platforms we might not have any planes allocated for us to work with. In this case ignore any updates for this display queue. Jira: None. Test: We dont crash when planes are not associated for a given pipe. Signed-off-by: Kalyan Kondapally --- common/display/displayplanemanager.h | 4 ++++ common/display/displayqueue.cpp | 20 ++++++++++++++++++-- common/display/displayqueue.h | 1 + wsi/drm/drmdisplay.cpp | 4 +++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/common/display/displayplanemanager.h b/common/display/displayplanemanager.h index 8d2d9ba..8aa64b8 100644 --- a/common/display/displayplanemanager.h +++ b/common/display/displayplanemanager.h @@ -76,6 +76,10 @@ class DisplayPlaneManager { return height_; } + uint32_t GetTotalPlanes() const { + return overlay_planes_.size(); + } + protected: DisplayPlaneState *GetLastUsedOverlay(DisplayPlaneStateList &composition); bool FallbacktoGPU(DisplayPlane *target_plane, OverlayLayer *layer, diff --git a/common/display/displayqueue.cpp b/common/display/displayqueue.cpp index 927c190..0986309 100644 --- a/common/display/displayqueue.cpp +++ b/common/display/displayqueue.cpp @@ -89,8 +89,22 @@ bool DisplayQueue::Initialize(uint32_t pipe, uint32_t width, uint32_t height, return false; } + // On some platforms we might have zero planes assigned to this + // pipe but we might be in clone mode. Let's detect this and + // ignore any updates in case of clone mode. + dummy_queue_ = false; + if (display_plane_manager_->GetTotalPlanes() == 0) { + dummy_queue_ = true; + } + vblank_handler_->SetPowerMode(kOff); - vblank_handler_->Init(gpu_fd_, pipe); + + if (!dummy_queue_) { + vblank_handler_->Init(gpu_fd_, pipe); + } else { + idle_tracker_.state_ |= FrameStateTracker::kIgnoreUpdates; + } + return true; } @@ -829,7 +843,9 @@ void DisplayQueue::HandleIdleCase() { } void DisplayQueue::ForceRefresh() { idle_tracker_.idle_lock_.lock(); - idle_tracker_.state_ &= ~FrameStateTracker::kIgnoreUpdates; + if (!dummy_queue_) + idle_tracker_.state_ &= ~FrameStateTracker::kIgnoreUpdates; + idle_tracker_.state_ |= FrameStateTracker::kRevalidateLayers; idle_tracker_.idle_lock_.unlock(); power_mode_lock_.lock(); diff --git a/common/display/displayqueue.h b/common/display/displayqueue.h index 654205b..8626f9e 100644 --- a/common/display/displayqueue.h +++ b/common/display/displayqueue.h @@ -261,6 +261,7 @@ class DisplayQueue { SpinLock power_mode_lock_; bool sync_ = false; // Synchronize with compositor thread. bool handle_display_initializations_ = true; // to disable hwclock thread. + bool dummy_queue_ = false; HWCRotation rotation_ = kRotateNone; }; diff --git a/wsi/drm/drmdisplay.cpp b/wsi/drm/drmdisplay.cpp index d192a12..8378d33 100644 --- a/wsi/drm/drmdisplay.cpp +++ b/wsi/drm/drmdisplay.cpp @@ -688,7 +688,9 @@ bool DrmDisplay::PopulatePlanes( if (overlay_planes.empty()) { ETRACE("Failed to get primary plane for display %d", crtc_id_); - return false; + // It's valid case on some platforms to not have a plane associated + // with a pipe. + return true; } // We expect layers to be in ascending order. -- 2.11.0