OLD | NEW |
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 on_demand_tile_raster_resource_id_(0), | 341 on_demand_tile_raster_resource_id_(0), |
342 bound_geometry_(NO_BINDING) { | 342 bound_geometry_(NO_BINDING) { |
343 DCHECK(gl_); | 343 DCHECK(gl_); |
344 DCHECK(context_support_); | 344 DCHECK(context_support_); |
345 | 345 |
346 ContextProvider::Capabilities context_caps = | 346 ContextProvider::Capabilities context_caps = |
347 output_surface_->context_provider()->ContextCapabilities(); | 347 output_surface_->context_provider()->ContextCapabilities(); |
348 | 348 |
349 capabilities_.using_partial_swap = | 349 capabilities_.using_partial_swap = |
350 settings_->partial_swap_enabled && context_caps.gpu.post_sub_buffer; | 350 settings_->partial_swap_enabled && context_caps.gpu.post_sub_buffer; |
351 capabilities_.allow_empty_swap = capabilities_.using_partial_swap || | |
352 context_caps.gpu.commit_overlay_planes; | |
353 | 351 |
354 DCHECK(!context_caps.gpu.iosurface || context_caps.gpu.texture_rectangle); | 352 DCHECK(!context_caps.gpu.iosurface || context_caps.gpu.texture_rectangle); |
355 | 353 |
356 capabilities_.using_egl_image = context_caps.gpu.egl_image_external; | 354 capabilities_.using_egl_image = context_caps.gpu.egl_image_external; |
357 | 355 |
358 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 356 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
359 capabilities_.best_texture_format = resource_provider_->best_texture_format(); | 357 capabilities_.best_texture_format = resource_provider_->best_texture_format(); |
360 | 358 |
361 // The updater can access textures while the GLRenderer is using them. | 359 // The updater can access textures while the GLRenderer is using them. |
362 capabilities_.allow_partial_texture_updates = true; | 360 capabilities_.allow_partial_texture_updates = true; |
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 // If supported, we can save significant bandwidth by only swapping the | 2611 // If supported, we can save significant bandwidth by only swapping the |
2614 // damaged/scissored region (clamped to the viewport). | 2612 // damaged/scissored region (clamped to the viewport). |
2615 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); | 2613 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); |
2616 int flipped_y_pos_of_rect_bottom = surface_size.height() - | 2614 int flipped_y_pos_of_rect_bottom = surface_size.height() - |
2617 swap_buffer_rect_.y() - | 2615 swap_buffer_rect_.y() - |
2618 swap_buffer_rect_.height(); | 2616 swap_buffer_rect_.height(); |
2619 compositor_frame.gl_frame_data->sub_buffer_rect = | 2617 compositor_frame.gl_frame_data->sub_buffer_rect = |
2620 gfx::Rect(swap_buffer_rect_.x(), | 2618 gfx::Rect(swap_buffer_rect_.x(), |
2621 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom | 2619 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom |
2622 : swap_buffer_rect_.y(), | 2620 : swap_buffer_rect_.y(), |
2623 swap_buffer_rect_.width(), swap_buffer_rect_.height()); | 2621 swap_buffer_rect_.width(), |
| 2622 swap_buffer_rect_.height()); |
2624 } else { | 2623 } else { |
2625 // Expand the swap rect to the full surface unless it's empty, and empty | 2624 compositor_frame.gl_frame_data->sub_buffer_rect = |
2626 // swap is allowed. | 2625 gfx::Rect(output_surface_->SurfaceSize()); |
2627 if (!swap_buffer_rect_.IsEmpty() || !capabilities_.allow_empty_swap) { | |
2628 swap_buffer_rect_ = gfx::Rect(surface_size); | |
2629 } | |
2630 compositor_frame.gl_frame_data->sub_buffer_rect = swap_buffer_rect_; | |
2631 } | 2626 } |
2632 output_surface_->SwapBuffers(&compositor_frame); | 2627 output_surface_->SwapBuffers(&compositor_frame); |
2633 | 2628 |
2634 // We always hold onto resources for an extra frame, to make sure we don't | 2629 // We always hold onto resources for an extra frame, to make sure we don't |
2635 // update the buffer while it's being scanned out. On some platforms, hold | 2630 // update the buffer while it's being scanned out. On some platforms, hold |
2636 // on to resources for an extra frame. | 2631 // on to resources for an extra frame. |
2637 if (settings_->delay_releasing_overlay_resources) { | 2632 if (settings_->delay_releasing_overlay_resources) { |
2638 previous_swap_overlay_resources_[1].clear(); | 2633 previous_swap_overlay_resources_[1].clear(); |
2639 previous_swap_overlay_resources_[1].swap( | 2634 previous_swap_overlay_resources_[1].swap( |
2640 previous_swap_overlay_resources_[0]); | 2635 previous_swap_overlay_resources_[0]); |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 texture_id = pending_overlay_resources_.back()->texture_id(); | 3577 texture_id = pending_overlay_resources_.back()->texture_id(); |
3583 } | 3578 } |
3584 | 3579 |
3585 context_support_->ScheduleOverlayPlane( | 3580 context_support_->ScheduleOverlayPlane( |
3586 overlay.plane_z_order, overlay.transform, texture_id, | 3581 overlay.plane_z_order, overlay.transform, texture_id, |
3587 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3582 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
3588 } | 3583 } |
3589 } | 3584 } |
3590 | 3585 |
3591 } // namespace cc | 3586 } // namespace cc |
OLD | NEW |