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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 208213003: Plumb overlay processing into DirectRenderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Introduced ScopedExportLock Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 InitializeSharedObjects(); 251 InitializeSharedObjects();
252 } 252 }
253 253
254 GLRenderer::~GLRenderer() { 254 GLRenderer::~GLRenderer() {
255 while (!pending_async_read_pixels_.empty()) { 255 while (!pending_async_read_pixels_.empty()) {
256 PendingAsyncReadPixels* pending_read = pending_async_read_pixels_.back(); 256 PendingAsyncReadPixels* pending_read = pending_async_read_pixels_.back();
257 pending_read->finished_read_pixels_callback.Cancel(); 257 pending_read->finished_read_pixels_callback.Cancel();
258 pending_async_read_pixels_.pop_back(); 258 pending_async_read_pixels_.pop_back();
259 } 259 }
260 260
261 in_use_overlay_resources_.clear();
262
261 CleanupSharedObjects(); 263 CleanupSharedObjects();
262 } 264 }
263 265
264 const RendererCapabilitiesImpl& GLRenderer::Capabilities() const { 266 const RendererCapabilitiesImpl& GLRenderer::Capabilities() const {
265 return capabilities_; 267 return capabilities_;
266 } 268 }
267 269
268 void GLRenderer::DebugGLCall(GLES2Interface* gl, 270 void GLRenderer::DebugGLCall(GLES2Interface* gl,
269 const char* command, 271 const char* command,
270 const char* file, 272 const char* file,
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 1995
1994 GLC(gl_, gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); 1996 GLC(gl_, gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, 0));
1995 } 1997 }
1996 1998
1997 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { 1999 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) {
1998 current_framebuffer_lock_.reset(); 2000 current_framebuffer_lock_.reset();
1999 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); 2001 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect));
2000 2002
2001 GLC(gl_, gl_->Disable(GL_BLEND)); 2003 GLC(gl_, gl_->Disable(GL_BLEND));
2002 blend_shadow_ = false; 2004 blend_shadow_ = false;
2005
2006 ScheduleOverlays(frame);
2003 } 2007 }
2004 2008
2005 void GLRenderer::FinishDrawingQuadList() { FlushTextureQuadCache(); } 2009 void GLRenderer::FinishDrawingQuadList() { FlushTextureQuadCache(); }
2006 2010
2007 bool GLRenderer::FlippedFramebuffer() const { return true; } 2011 bool GLRenderer::FlippedFramebuffer() const { return true; }
2008 2012
2009 void GLRenderer::EnsureScissorTestEnabled() { 2013 void GLRenderer::EnsureScissorTestEnabled() {
2010 if (is_scissor_enabled_) 2014 if (is_scissor_enabled_)
2011 return; 2015 return;
2012 2016
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 gfx::Rect(swap_buffer_rect_.x(), 2168 gfx::Rect(swap_buffer_rect_.x(),
2165 flipped_y_pos_of_rect_bottom, 2169 flipped_y_pos_of_rect_bottom,
2166 swap_buffer_rect_.width(), 2170 swap_buffer_rect_.width(),
2167 swap_buffer_rect_.height()); 2171 swap_buffer_rect_.height());
2168 } else { 2172 } else {
2169 compositor_frame.gl_frame_data->sub_buffer_rect = 2173 compositor_frame.gl_frame_data->sub_buffer_rect =
2170 gfx::Rect(output_surface_->SurfaceSize()); 2174 gfx::Rect(output_surface_->SurfaceSize());
2171 } 2175 }
2172 output_surface_->SwapBuffers(&compositor_frame); 2176 output_surface_->SwapBuffers(&compositor_frame);
2173 2177
2178 // Release previously used overlay resources and hold onto the pending ones
2179 // until the next swap buffers.
2180 in_use_overlay_resources_.clear();
2181 in_use_overlay_resources_.swap(pending_overlay_resources_);
2182
2174 swap_buffer_rect_ = gfx::Rect(); 2183 swap_buffer_rect_ = gfx::Rect();
2175 2184
2176 // We don't have real fences, so we mark read fences as passed 2185 // We don't have real fences, so we mark read fences as passed
2177 // assuming a double-buffered GPU pipeline. A texture can be 2186 // assuming a double-buffered GPU pipeline. A texture can be
2178 // written to after one full frame has past since it was last read. 2187 // written to after one full frame has past since it was last read.
2179 if (last_swap_fence_.get()) 2188 if (last_swap_fence_.get())
2180 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed(); 2189 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed();
2181 last_swap_fence_ = resource_provider_->GetReadLockFence(); 2190 last_swap_fence_ = resource_provider_->GetReadLockFence();
2182 resource_provider_->SetReadLockFence(new SimpleSwapFence()); 2191 resource_provider_->SetReadLockFence(new SimpleSwapFence());
2183 } 2192 }
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 // Make sure scissoring starts as disabled. 3049 // Make sure scissoring starts as disabled.
3041 is_scissor_enabled_ = false; 3050 is_scissor_enabled_ = false;
3042 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); 3051 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST));
3043 scissor_rect_needs_reset_ = true; 3052 scissor_rect_needs_reset_ = true;
3044 } 3053 }
3045 3054
3046 bool GLRenderer::IsContextLost() { 3055 bool GLRenderer::IsContextLost() {
3047 return output_surface_->context_provider()->IsContextLost(); 3056 return output_surface_->context_provider()->IsContextLost();
3048 } 3057 }
3049 3058
3059 void GLRenderer::ScheduleOverlays(DrawingFrame* frame) {
3060 if (!frame->overlay_list.size())
3061 return;
3062
3063 ResourceProvider::ResourceIdArray resources;
3064 OverlayCandidateList& overlays = frame->overlay_list;
3065 OverlayCandidateList::iterator it;
3066 for (it = overlays.begin(); it != overlays.end(); ++it) {
3067 const OverlayCandidate& overlay = *it;
3068 // Skip primary plane.
3069 if (overlay.plane_z_order == 0)
3070 continue;
3071
3072 pending_overlay_resources_.push_back(
3073 make_scoped_ptr(new ResourceProvider::ScopedExportLock(
3074 resource_provider(), overlay.resource_id)));
3075
3076 context_support_->ScheduleOverlayPlane(
3077 overlay.plane_z_order,
3078 overlay.transform,
3079 pending_overlay_resources_.back()->GetMailbox(),
3080 overlay.display_rect,
3081 overlay.uv_rect);
3082 }
3083 }
3084
3050 } // namespace cc 3085 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698