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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/display_compositor/buffer_queue.h" 5 #include "components/display_compositor/buffer_queue.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "components/display_compositor/gl_helper.h" 10 #include "components/display_compositor/gl_helper.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 new_surface->damage = surface->damage; 177 new_surface->damage = surface->damage;
178 178
179 // Copy the entire texture. 179 // Copy the entire texture.
180 CopyBufferDamage(new_surface->texture, surface->texture, gfx::Rect(), 180 CopyBufferDamage(new_surface->texture, surface->texture, gfx::Rect(),
181 gfx::Rect(size_)); 181 gfx::Rect(size_));
182 return new_surface; 182 return new_surface;
183 } 183 }
184 184
185 void BufferQueue::PageFlipComplete() { 185 void BufferQueue::PageFlipComplete() {
186 DCHECK(!in_flight_surfaces_.empty()); 186 // Early out when no surface is in-flight. This can happen when using
187 // overlays and page flipping without changing the primary plane.
188 if (in_flight_surfaces_.empty())
189 return;
187 if (displayed_surface_) 190 if (displayed_surface_)
188 available_surfaces_.push_back(std::move(displayed_surface_)); 191 available_surfaces_.push_back(std::move(displayed_surface_));
189 displayed_surface_ = std::move(in_flight_surfaces_.front()); 192 displayed_surface_ = std::move(in_flight_surfaces_.front());
190 in_flight_surfaces_.pop_front(); 193 in_flight_surfaces_.pop_front();
191 } 194 }
192 195
196 uint32_t BufferQueue::GetCurrentTextureId() const {
197 // Return current surface texture if bound.
198 if (current_surface_)
199 return current_surface_->texture;
200
201 // Return in-flight or displayed surface texture if no surface is
202 // currently bound. This can happen when using overlays and surface
203 // damage is empty.
204 if (!in_flight_surfaces_.empty())
205 return in_flight_surfaces_.back()->texture;
206 if (displayed_surface_)
207 return displayed_surface_->texture;
208
209 return 0;
210 }
211
193 void BufferQueue::FreeAllSurfaces() { 212 void BufferQueue::FreeAllSurfaces() {
194 displayed_surface_.reset(); 213 displayed_surface_.reset();
195 current_surface_.reset(); 214 current_surface_.reset();
196 // This is intentionally not emptied since the swap buffers acks are still 215 // This is intentionally not emptied since the swap buffers acks are still
197 // expected to arrive. 216 // expected to arrive.
198 for (auto& surface : in_flight_surfaces_) 217 for (auto& surface : in_flight_surfaces_)
199 surface = nullptr; 218 surface = nullptr;
200 available_surfaces_.clear(); 219 available_surfaces_.clear();
201 } 220 }
202 221
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 texture(texture), 293 texture(texture),
275 image(image), 294 image(image),
276 stencil(stencil), 295 stencil(stencil),
277 damage(rect) {} 296 damage(rect) {}
278 297
279 BufferQueue::AllocatedSurface::~AllocatedSurface() { 298 BufferQueue::AllocatedSurface::~AllocatedSurface() {
280 buffer_queue->FreeSurfaceResources(this); 299 buffer_queue->FreeSurfaceResources(this);
281 } 300 }
282 301
283 } // namespace display_compositor 302 } // namespace display_compositor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698