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

Unified Diff: services/ui/surfaces/display_output_surface_ozone.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 | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/surfaces/display_output_surface_ozone.cc
diff --git a/services/ui/surfaces/display_output_surface_ozone.cc b/services/ui/surfaces/display_output_surface_ozone.cc
index e63a2e88941bbe37f5c6ce8688619a5d8befa04b..da565dd3db66963c6c7731a0245aa214fa2994dc 100644
--- a/services/ui/surfaces/display_output_surface_ozone.cc
+++ b/services/ui/surfaces/display_output_surface_ozone.cc
@@ -83,8 +83,14 @@ void DisplayOutputSurfaceOzone::SwapBuffers(cc::OutputSurfaceFrame frame) {
DCHECK(reshape_size_ == frame.size);
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);
+
DisplayOutputSurface::SwapBuffers(std::move(frame));
}
@@ -98,7 +104,7 @@ bool DisplayOutputSurfaceOzone::IsDisplayedAsOverlayPlane() const {
}
unsigned DisplayOutputSurfaceOzone::GetOverlayTextureId() const {
- return buffer_queue_->current_texture_id();
+ return buffer_queue_->GetCurrentTextureId();
}
void DisplayOutputSurfaceOzone::DidReceiveSwapBuffersAck(
« no previous file with comments | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698