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

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

Issue 1044093005: Preliminary compositor disabling patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove renderpass calculation Created 5 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
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, 197 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
198 float device_scale_factor, 198 float device_scale_factor,
199 const gfx::Rect& device_viewport_rect, 199 const gfx::Rect& device_viewport_rect,
200 const gfx::Rect& device_clip_rect, 200 const gfx::Rect& device_clip_rect,
201 bool disable_picture_quad_image_filtering) { 201 bool disable_picture_quad_image_filtering) {
202 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); 202 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame");
203 UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount", 203 UMA_HISTOGRAM_COUNTS("Renderer4.renderPassCount",
204 render_passes_in_draw_order->size()); 204 render_passes_in_draw_order->size());
205 205
206 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); 206 RenderPass* root_render_pass = render_passes_in_draw_order->back();
207 DCHECK(root_render_pass); 207 DCHECK(root_render_pass);
208 208
209 DrawingFrame frame; 209 DrawingFrame frame;
210 frame.render_passes_in_draw_order = render_passes_in_draw_order; 210 frame.render_passes_in_draw_order = render_passes_in_draw_order;
211 frame.root_render_pass = root_render_pass; 211 frame.root_render_pass = root_render_pass;
212
213 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order,
214 &frame.overlay_list);
215
216 // Merge quad damage for the root pass.
217 root_render_pass->damage_rect.Union(root_render_pass->overlay_rect);
218 root_render_pass->overlay_rect = gfx::Rect();
219
212 frame.root_damage_rect = Capabilities().using_partial_swap 220 frame.root_damage_rect = Capabilities().using_partial_swap
213 ? root_render_pass->damage_rect 221 ? root_render_pass->damage_rect
214 : root_render_pass->output_rect; 222 : root_render_pass->output_rect;
215 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size())); 223 frame.root_damage_rect.Intersect(gfx::Rect(device_viewport_rect.size()));
216 frame.device_viewport_rect = device_viewport_rect; 224 frame.device_viewport_rect = device_viewport_rect;
217 frame.device_clip_rect = device_clip_rect; 225 frame.device_clip_rect = device_clip_rect;
218 frame.disable_picture_quad_image_filtering = 226 frame.disable_picture_quad_image_filtering =
219 disable_picture_quad_image_filtering; 227 disable_picture_quad_image_filtering;
220 228
221 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order, 229 if (root_render_pass->damage_rect.IsEmpty()) {
222 &frame.overlay_list); 230 // If we have a scene that is composed of only overlays then we can
231 // potentially avoid drawing anything. However, if there are any copy
232 // requests we must do the drawing.
233 auto copy_pass = std::find_if(
234 render_passes_in_draw_order->begin(),
235 render_passes_in_draw_order->end(),
236 [](const RenderPass* pass) { return !pass->copy_requests.empty(); });
237 if (copy_pass == render_passes_in_draw_order->end()) {
238 ScheduleOverlays(&frame);
239 render_passes_in_draw_order->clear();
240 return;
241 }
242 }
223 243
224 EnsureBackbuffer(); 244 EnsureBackbuffer();
225 245
226 // Only reshape when we know we are going to draw. Otherwise, the reshape 246 // Only reshape when we know we are going to draw. Otherwise, the reshape
227 // can leave the window at the wrong size if we never draw and the proper 247 // can leave the window at the wrong size if we never draw and the proper
228 // viewport size is never set. 248 // viewport size is never set.
229 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); 249 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor);
230 250
231 BeginDrawingFrame(&frame); 251 BeginDrawingFrame(&frame);
232 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { 252 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) {
233 RenderPass* pass = render_passes_in_draw_order->at(i); 253 RenderPass* pass = render_passes_in_draw_order->at(i);
234 DrawRenderPass(&frame, pass); 254 DrawRenderPass(&frame, pass);
235 255
236 for (ScopedPtrVector<CopyOutputRequest>::iterator it = 256 for (ScopedPtrVector<CopyOutputRequest>::iterator it =
237 pass->copy_requests.begin(); 257 pass->copy_requests.begin();
238 it != pass->copy_requests.end(); 258 it != pass->copy_requests.end();
239 ++it) { 259 ++it) {
240 if (it != pass->copy_requests.begin()) { 260 if (it != pass->copy_requests.begin()) {
241 // Doing a readback is destructive of our state on Mac, so make sure 261 // Doing a readback is destructive of our state on Mac, so make sure
242 // we restore the state between readbacks. http://crbug.com/99393. 262 // we restore the state between readbacks. http://crbug.com/99393.
243 UseRenderPass(&frame, pass); 263 UseRenderPass(&frame, pass);
244 } 264 }
245 CopyCurrentRenderPassToBitmap(&frame, pass->copy_requests.take(it)); 265 CopyCurrentRenderPassToBitmap(&frame, pass->copy_requests.take(it));
246 } 266 }
247 } 267 }
248 FinishDrawingFrame(&frame); 268 FinishDrawingFrame(&frame);
269 ScheduleOverlays(&frame);
249 270
250 render_passes_in_draw_order->clear(); 271 render_passes_in_draw_order->clear();
251 } 272 }
252 273
253 gfx::Rect DirectRenderer::ComputeScissorRectForRenderPass( 274 gfx::Rect DirectRenderer::ComputeScissorRectForRenderPass(
254 const DrawingFrame* frame) { 275 const DrawingFrame* frame) {
255 gfx::Rect render_pass_scissor = frame->current_render_pass->output_rect; 276 gfx::Rect render_pass_scissor = frame->current_render_pass->output_rect;
256 277
257 if (frame->root_damage_rect == frame->root_render_pass->output_rect || 278 if (frame->root_damage_rect == frame->root_render_pass->output_rect ||
258 !frame->current_render_pass->copy_requests.empty()) 279 !frame->current_render_pass->copy_requests.empty())
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 ScopedResource* texture = render_pass_textures_.get(id); 515 ScopedResource* texture = render_pass_textures_.get(id);
495 return texture && texture->id(); 516 return texture && texture->id();
496 } 517 }
497 518
498 // static 519 // static
499 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 520 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
500 return render_pass->output_rect.size(); 521 return render_pass->output_rect.size();
501 } 522 }
502 523
503 } // namespace cc 524 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698