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

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

Issue 2166973002: cc: Release pending overlay resources on swap-ack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 swapping_overlay_resources_.size() > 2) { 2758 swapping_overlay_resources_.size() > 2) {
2759 swapping_overlay_resources_.pop_front(); 2759 swapping_overlay_resources_.pop_front();
2760 } 2760 }
2761 2761
2762 output_surface_->SwapBuffers(std::move(compositor_frame)); 2762 output_surface_->SwapBuffers(std::move(compositor_frame));
2763 2763
2764 swap_buffer_rect_ = gfx::Rect(); 2764 swap_buffer_rect_ = gfx::Rect();
2765 } 2765 }
2766 2766
2767 void GLRenderer::SwapBuffersComplete() { 2767 void GLRenderer::SwapBuffersComplete() {
2768 // Once a resouce has been swap-ACKed, send a query to the GPU process to ask
2769 // if the resource is no longer being consumed by the system compositor. The
2770 // response will come with the next swap-ACK.
2771 if (settings_->release_overlay_resources_after_gpu_query) { 2768 if (settings_->release_overlay_resources_after_gpu_query) {
2769 // Once a resouce has been swap-ACKed, send a query to the GPU process to
reveman 2016/07/20 21:07:22 nit: s/resouce/resource/
Daniele Castagna 2016/07/20 23:03:58 Done.
2770 // ask if the resource is no longer being consumed by the system compositor.
2771 // The response will come with the next swap-ACK.
2772 if (!swapping_overlay_resources_.empty()) { 2772 if (!swapping_overlay_resources_.empty()) {
2773 for (OverlayResourceLock& lock : swapping_overlay_resources_.front()) { 2773 for (OverlayResourceLock& lock : swapping_overlay_resources_.front()) {
2774 unsigned texture = lock->texture_id(); 2774 unsigned texture = lock->texture_id();
2775 if (swapped_and_acked_overlay_resources_.find(texture) == 2775 if (swapped_and_acked_overlay_resources_.find(texture) ==
2776 swapped_and_acked_overlay_resources_.end()) { 2776 swapped_and_acked_overlay_resources_.end()) {
2777 swapped_and_acked_overlay_resources_[texture] = std::move(lock); 2777 swapped_and_acked_overlay_resources_[texture] = std::move(lock);
2778 } 2778 }
2779 } 2779 }
2780 swapping_overlay_resources_.pop_front(); 2780 swapping_overlay_resources_.pop_front();
2781 } 2781 }
2782 2782
2783 if (!swapped_and_acked_overlay_resources_.empty()) { 2783 if (!swapped_and_acked_overlay_resources_.empty()) {
2784 std::vector<unsigned> textures; 2784 std::vector<unsigned> textures;
2785 textures.reserve(swapped_and_acked_overlay_resources_.size()); 2785 textures.reserve(swapped_and_acked_overlay_resources_.size());
2786 for (auto& pair : swapped_and_acked_overlay_resources_) { 2786 for (auto& pair : swapped_and_acked_overlay_resources_) {
2787 textures.push_back(pair.first); 2787 textures.push_back(pair.first);
2788 } 2788 }
2789 gl_->ScheduleCALayerInUseQueryCHROMIUM(textures.size(), textures.data()); 2789 gl_->ScheduleCALayerInUseQueryCHROMIUM(textures.size(), textures.data());
2790 } 2790 }
2791 } else if (swapping_overlay_resources_.size() > 1) {
2792 DCHECK_EQ(2U, swapping_overlay_resources_.size());
reveman 2016/07/20 21:07:22 nit: 2u
Daniele Castagna 2016/07/20 23:03:58 I used the capital U to stay consistent with overl
2793 swapping_overlay_resources_.pop_front();
reveman 2016/07/20 21:07:21 I think a comment here explaining why this is corr
ccameron 2016/07/20 21:22:24 +1
2791 } 2794 }
2792 } 2795 }
2793 2796
2794 void GLRenderer::DidReceiveTextureInUseResponses( 2797 void GLRenderer::DidReceiveTextureInUseResponses(
2795 const gpu::TextureInUseResponses& responses) { 2798 const gpu::TextureInUseResponses& responses) {
2796 DCHECK(settings_->release_overlay_resources_after_gpu_query); 2799 DCHECK(settings_->release_overlay_resources_after_gpu_query);
2797 for (const gpu::TextureInUseResponse& response : responses) { 2800 for (const gpu::TextureInUseResponse& response : responses) {
2798 if (!response.in_use) { 2801 if (!response.in_use) {
2799 swapped_and_acked_overlay_resources_.erase(response.texture); 2802 swapped_and_acked_overlay_resources_.erase(response.texture);
2800 } 2803 }
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 texture_id = pending_overlay_resources_.back()->texture_id(); 3687 texture_id = pending_overlay_resources_.back()->texture_id();
3685 } 3688 }
3686 3689
3687 context_support_->ScheduleOverlayPlane( 3690 context_support_->ScheduleOverlayPlane(
3688 overlay.plane_z_order, overlay.transform, texture_id, 3691 overlay.plane_z_order, overlay.transform, texture_id,
3689 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3692 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3690 } 3693 }
3691 } 3694 }
3692 3695
3693 } // namespace cc 3696 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698