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

Side by Side Diff: content/common/gpu/image_transport_surface_fbo_mac.mm

Issue 505053002: Fix assorted issues with remote CoreAnimation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean_up_accel_layers
Patch Set: Clean up timer logic Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/gpu/image_transport_surface_fbo_mac.h" 5 #include "content/common/gpu/image_transport_surface_fbo_mac.h"
6 6
7 #include "content/common/gpu/gpu_messages.h" 7 #include "content/common/gpu/gpu_messages.h"
8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" 8 #include "content/common/gpu/image_transport_surface_calayer_mac.h"
9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" 9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h"
10 #include "ui/base/cocoa/remote_layer_api.h" 10 #include "ui/base/cocoa/remote_layer_api.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 unsigned int ImageTransportSurfaceFBO::GetBackingFrameBufferObject() { 95 unsigned int ImageTransportSurfaceFBO::GetBackingFrameBufferObject() {
96 return fbo_id_; 96 return fbo_id_;
97 } 97 }
98 98
99 bool ImageTransportSurfaceFBO::SetBackbufferAllocation(bool allocation) { 99 bool ImageTransportSurfaceFBO::SetBackbufferAllocation(bool allocation) {
100 if (backbuffer_suggested_allocation_ == allocation) 100 if (backbuffer_suggested_allocation_ == allocation)
101 return true; 101 return true;
102 backbuffer_suggested_allocation_ = allocation; 102 backbuffer_suggested_allocation_ = allocation;
103 AdjustBufferAllocation(); 103 AdjustBufferAllocation();
104 if (!allocation)
105 storage_provider_->DiscardBackbuffer();
104 return true; 106 return true;
105 } 107 }
106 108
107 void ImageTransportSurfaceFBO::SetFrontbufferAllocation(bool allocation) { 109 void ImageTransportSurfaceFBO::SetFrontbufferAllocation(bool allocation) {
108 if (frontbuffer_suggested_allocation_ == allocation) 110 if (frontbuffer_suggested_allocation_ == allocation)
109 return; 111 return;
110 frontbuffer_suggested_allocation_ = allocation; 112 frontbuffer_suggested_allocation_ = allocation;
111 AdjustBufferAllocation(); 113 AdjustBufferAllocation();
112 } 114 }
113 115
114 void ImageTransportSurfaceFBO::AdjustBufferAllocation() { 116 void ImageTransportSurfaceFBO::AdjustBufferAllocation() {
115 // On mac, the frontbuffer and backbuffer are the same buffer. The buffer is 117 // On mac, the frontbuffer and backbuffer are the same buffer. The buffer is
116 // free'd when both the browser and gpu processes have Unref'd the IOSurface. 118 // free'd when both the browser and gpu processes have Unref'd the IOSurface.
117 if (!backbuffer_suggested_allocation_ && 119 if (!backbuffer_suggested_allocation_ &&
118 !frontbuffer_suggested_allocation_ && 120 !frontbuffer_suggested_allocation_ &&
119 has_complete_framebuffer_) { 121 has_complete_framebuffer_) {
120 DestroyFramebuffer(); 122 DestroyFramebuffer();
121 helper_->Suspend(); 123 helper_->Suspend();
122 } else if (backbuffer_suggested_allocation_ && !has_complete_framebuffer_) { 124 } else if (backbuffer_suggested_allocation_ && !has_complete_framebuffer_) {
123 CreateFramebuffer(); 125 CreateFramebuffer();
124 } 126 }
125 } 127 }
126 128
127 bool ImageTransportSurfaceFBO::SwapBuffers() { 129 bool ImageTransportSurfaceFBO::SwapBuffers() {
128 DCHECK(backbuffer_suggested_allocation_); 130 DCHECK(backbuffer_suggested_allocation_);
129 if (!frontbuffer_suggested_allocation_) 131 if (!frontbuffer_suggested_allocation_)
130 return true; 132 return true;
131 glFlush(); 133 glFlush();
132 134
135 DCHECK(!is_swap_buffers_pending_);
136 is_swap_buffers_pending_ = true;
137
133 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 138 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
134 params.surface_handle = storage_provider_->GetSurfaceHandle(); 139 params.surface_handle = storage_provider_->SwapBuffersAndGetSurfaceHandle();
135 params.size = GetSize(); 140 params.size = GetSize();
136 params.scale_factor = scale_factor_; 141 params.scale_factor = scale_factor_;
137 params.latency_info.swap(latency_info_); 142 params.latency_info.swap(latency_info_);
138 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 143 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
139
140 DCHECK(!is_swap_buffers_pending_);
141 is_swap_buffers_pending_ = true;
142
143 storage_provider_->WillSwapBuffers();
144 return true; 144 return true;
145 } 145 }
146 146
147 bool ImageTransportSurfaceFBO::PostSubBuffer( 147 bool ImageTransportSurfaceFBO::PostSubBuffer(
148 int x, int y, int width, int height) { 148 int x, int y, int width, int height) {
149 // Mac does not support sub-buffer swaps. 149 // Mac does not support sub-buffer swaps.
150 NOTREACHED(); 150 NOTREACHED();
151 return false; 151 return false;
152 } 152 }
153 153
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return; 325 return;
326 } 326 }
327 327
328 has_complete_framebuffer_ = true; 328 has_complete_framebuffer_ = true;
329 329
330 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); 330 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id);
331 // The FBO remains bound for this GL context. 331 // The FBO remains bound for this GL context.
332 } 332 }
333 333
334 } // namespace content 334 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_fbo_mac.h ('k') | content/common/gpu/image_transport_surface_iosurface_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698