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

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

Issue 2573603005: Compute damage rect for Cast video compositing (Closed)
Patch Set: Created 4 years 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/gl_renderer.h ('k') | cc/output/output_surface_frame.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 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 const auto& context_caps = 395 const auto& context_caps =
396 output_surface_->context_provider()->ContextCapabilities(); 396 output_surface_->context_provider()->ContextCapabilities();
397 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); 397 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle);
398 398
399 use_discard_framebuffer_ = context_caps.discard_framebuffer; 399 use_discard_framebuffer_ = context_caps.discard_framebuffer;
400 use_sync_query_ = context_caps.sync_query; 400 use_sync_query_ = context_caps.sync_query;
401 use_blend_equation_advanced_ = context_caps.blend_equation_advanced; 401 use_blend_equation_advanced_ = context_caps.blend_equation_advanced;
402 use_blend_equation_advanced_coherent_ = 402 use_blend_equation_advanced_coherent_ =
403 context_caps.blend_equation_advanced_coherent; 403 context_caps.blend_equation_advanced_coherent;
404 use_swap_with_damage_ = context_caps.swap_buffers_with_damage;
404 405
405 InitializeSharedObjects(); 406 InitializeSharedObjects();
406 } 407 }
407 408
408 GLRenderer::~GLRenderer() { 409 GLRenderer::~GLRenderer() {
409 while (!pending_async_read_pixels_.empty()) { 410 while (!pending_async_read_pixels_.empty()) {
410 PendingAsyncReadPixels* pending_read = 411 PendingAsyncReadPixels* pending_read =
411 pending_async_read_pixels_.back().get(); 412 pending_async_read_pixels_.back().get();
412 pending_read->finished_read_pixels_callback.Cancel(); 413 pending_read->finished_read_pixels_callback.Cancel();
413 pending_async_read_pixels_.pop_back(); 414 pending_async_read_pixels_.pop_back();
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 DCHECK(visible_); 2899 DCHECK(visible_);
2899 2900
2900 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); 2901 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers");
2901 // We're done! Time to swapbuffers! 2902 // We're done! Time to swapbuffers!
2902 2903
2903 gfx::Size surface_size = surface_size_for_swap_buffers(); 2904 gfx::Size surface_size = surface_size_for_swap_buffers();
2904 2905
2905 OutputSurfaceFrame output_frame; 2906 OutputSurfaceFrame output_frame;
2906 output_frame.latency_info = std::move(latency_info); 2907 output_frame.latency_info = std::move(latency_info);
2907 output_frame.size = surface_size; 2908 output_frame.size = surface_size;
2909 output_frame.swap_with_damage_rect = gfx::Rect(surface_size);
2908 if (use_partial_swap_) { 2910 if (use_partial_swap_) {
2909 // If supported, we can save significant bandwidth by only swapping the 2911 // If supported, we can save significant bandwidth by only swapping the
2910 // damaged/scissored region (clamped to the viewport). 2912 // damaged/scissored region (clamped to the viewport).
2911 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); 2913 swap_buffer_rect_.Intersect(gfx::Rect(surface_size));
2912 int flipped_y_pos_of_rect_bottom = surface_size.height() - 2914 int flipped_y_pos_of_rect_bottom = surface_size.height() -
2913 swap_buffer_rect_.y() - 2915 swap_buffer_rect_.y() -
2914 swap_buffer_rect_.height(); 2916 swap_buffer_rect_.height();
2915 output_frame.sub_buffer_rect = 2917 output_frame.sub_buffer_rect =
2916 gfx::Rect(swap_buffer_rect_.x(), 2918 gfx::Rect(swap_buffer_rect_.x(),
2917 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom 2919 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom
2918 : swap_buffer_rect_.y(), 2920 : swap_buffer_rect_.y(),
2919 swap_buffer_rect_.width(), swap_buffer_rect_.height()); 2921 swap_buffer_rect_.width(), swap_buffer_rect_.height());
2920 } else { 2922 } else {
2921 // Expand the swap rect to the full surface unless it's empty, and empty 2923 // Expand the swap rect to the full surface unless it's empty, and empty
2922 // swap is allowed. 2924 // swap is allowed.
2923 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) { 2925 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) {
2924 swap_buffer_rect_ = gfx::Rect(surface_size); 2926 swap_buffer_rect_ = gfx::Rect(surface_size);
2925 } 2927 }
2926 output_frame.sub_buffer_rect = swap_buffer_rect_; 2928 output_frame.sub_buffer_rect = swap_buffer_rect_;
2927 } 2929 }
2928 2930
2931 if (use_swap_with_damage_) {
2932 gfx::Rect swap_with_damage_rect;
2933 if (overlay_processor_->GetSwapWithDamageRect(&swap_with_damage_rect)) {
2934 output_frame.swap_with_damage_rect = swap_with_damage_rect;
2935 }
2936 }
2937
2929 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); 2938 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_));
2930 pending_overlay_resources_.clear(); 2939 pending_overlay_resources_.clear();
2931 2940
2932 output_surface_->SwapBuffers(std::move(output_frame)); 2941 output_surface_->SwapBuffers(std::move(output_frame));
2933 2942
2934 swap_buffer_rect_ = gfx::Rect(); 2943 swap_buffer_rect_ = gfx::Rect();
2935 } 2944 }
2936 2945
2937 void GLRenderer::SwapBuffersComplete() { 2946 void GLRenderer::SwapBuffersComplete() {
2938 if (settings_->release_overlay_resources_after_gpu_query) { 2947 if (settings_->release_overlay_resources_after_gpu_query) {
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4043 // The alpha has already been applied when copying the RPDQ to an IOSurface. 4052 // The alpha has already been applied when copying the RPDQ to an IOSurface.
4044 GLfloat alpha = 1; 4053 GLfloat alpha = 1;
4045 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect, 4054 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect,
4046 sorting_context_id, gl_transform); 4055 sorting_context_id, gl_transform);
4047 gl_->ScheduleCALayerCHROMIUM( 4056 gl_->ScheduleCALayerCHROMIUM(
4048 texture_id, contents_rect, ca_layer_overlay->background_color, 4057 texture_id, contents_rect, ca_layer_overlay->background_color,
4049 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4058 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4050 } 4059 }
4051 4060
4052 } // namespace cc 4061 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/output_surface_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698