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

Unified Diff: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.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
« no previous file with comments | « components/display_compositor/buffer_queue.cc ('k') | gpu/command_buffer/common/capabilities.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
index e0464b673542e0bb869c817602abb29885aa64ba..3a0e0915ad720f2b683bc4bd1be010346c09acc9 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
@@ -63,7 +63,7 @@ bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane()
unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId()
const {
- return buffer_queue_->current_texture_id();
+ return buffer_queue_->GetCurrentTextureId();
}
void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
@@ -73,8 +73,15 @@ void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
// TODO(ccameron): What if a swap comes again before OnGpuSwapBuffersCompleted
// happens, we'd see the wrong swap size there?
swap_size_ = reshape_size_;
- buffer_queue_->SwapBuffers(frame.sub_buffer_rect ? *frame.sub_buffer_rect
- : gfx::Rect(swap_size_));
+
+ gfx::Rect damage_rect =
+ frame.sub_buffer_rect ? *frame.sub_buffer_rect : gfx::Rect(swap_size_);
+ // Use previous buffer when damage rect is empty. This avoids unnecessary
+ // partial swap work and makes it possible to support empty swaps on devices
+ // where partial swaps are disabled.
+ if (!damage_rect.IsEmpty())
+ buffer_queue_->SwapBuffers(damage_rect);
+
GpuBrowserCompositorOutputSurface::SwapBuffers(std::move(frame));
}
« no previous file with comments | « components/display_compositor/buffer_queue.cc ('k') | gpu/command_buffer/common/capabilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698