Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Unified Diff: components/display_compositor/buffer_queue.cc

Issue 2829543003: gpu: Empty swaps for surfaceless output surfaces. (Closed)
Patch Set: new workaround Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/display_compositor/buffer_queue.cc
diff --git a/components/display_compositor/buffer_queue.cc b/components/display_compositor/buffer_queue.cc
index afb40e1a4912accfc68929b8d7b72d70e7ac8cb8..60b50d7a8bbab3979758bcc60b78e77488d1bf76 100644
--- a/components/display_compositor/buffer_queue.cc
+++ b/components/display_compositor/buffer_queue.cc
@@ -183,13 +183,32 @@ std::unique_ptr<BufferQueue::AllocatedSurface> BufferQueue::RecreateBuffer(
}
void BufferQueue::PageFlipComplete() {
- DCHECK(!in_flight_surfaces_.empty());
+ // Early out when no surface is in-flight. This can happen when using
+ // overlays and page flipping without changing the primary plane.
+ if (in_flight_surfaces_.empty())
+ return;
if (displayed_surface_)
available_surfaces_.push_back(std::move(displayed_surface_));
displayed_surface_ = std::move(in_flight_surfaces_.front());
in_flight_surfaces_.pop_front();
}
+uint32_t BufferQueue::GetCurrentTextureId() const {
+ // Return current surface texture if bound.
+ if (current_surface_)
+ return current_surface_->texture;
+
+ // Return in-flight or displayed surface texture if no surface is
+ // currently bound. This can happen when using overlays and surface
+ // damage is empty.
+ if (!in_flight_surfaces_.empty())
+ return in_flight_surfaces_.back()->texture;
+ if (displayed_surface_)
+ return displayed_surface_->texture;
+
+ return 0;
+}
+
void BufferQueue::FreeAllSurfaces() {
displayed_surface_.reset();
current_surface_.reset();

Powered by Google App Engine
This is Rietveld 408576698