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

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

Issue 1137093003: Mac: Add more trace events for CAOpenGLLayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix grammar Created 5 years, 7 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 "base/trace_event/trace_event.h"
7 #include "content/common/gpu/gpu_messages.h" 8 #include "content/common/gpu/gpu_messages.h"
8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" 9 #include "content/common/gpu/image_transport_surface_calayer_mac.h"
9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" 10 #include "content/common/gpu/image_transport_surface_iosurface_mac.h"
10 #include "ui/base/cocoa/remote_layer_api.h" 11 #include "ui/base/cocoa/remote_layer_api.h"
11 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gl/gl_context.h" 13 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
14 #include "ui/gl/gl_surface_osmesa.h" 15 #include "ui/gl/gl_surface_osmesa.h"
15 16
16 namespace content { 17 namespace content {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (!backbuffer_suggested_allocation_ && 163 if (!backbuffer_suggested_allocation_ &&
163 !frontbuffer_suggested_allocation_ && 164 !frontbuffer_suggested_allocation_ &&
164 has_complete_framebuffer_) { 165 has_complete_framebuffer_) {
165 DestroyFramebuffer(); 166 DestroyFramebuffer();
166 } else if (backbuffer_suggested_allocation_ && !has_complete_framebuffer_) { 167 } else if (backbuffer_suggested_allocation_ && !has_complete_framebuffer_) {
167 AllocateOrResizeFramebuffer(pixel_size_, scale_factor_); 168 AllocateOrResizeFramebuffer(pixel_size_, scale_factor_);
168 } 169 }
169 } 170 }
170 171
171 bool ImageTransportSurfaceFBO::SwapBuffers() { 172 bool ImageTransportSurfaceFBO::SwapBuffers() {
173 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SwapBuffers");
172 return SwapBuffersInternal(); 174 return SwapBuffersInternal();
173 } 175 }
174 176
175 bool ImageTransportSurfaceFBO::SwapBuffersInternal() { 177 bool ImageTransportSurfaceFBO::SwapBuffersInternal() {
176 DCHECK(backbuffer_suggested_allocation_); 178 DCHECK(backbuffer_suggested_allocation_);
177 if (!frontbuffer_suggested_allocation_) 179 if (!frontbuffer_suggested_allocation_)
178 return true; 180 return true;
179 glFlush(); 181 glFlush();
180 182
181 // It is the responsibility of the storage provider to send the swap IPC. 183 // It is the responsibility of the storage provider to send the swap IPC.
182 is_swap_buffers_send_pending_ = true; 184 is_swap_buffers_send_pending_ = true;
183 storage_provider_->SwapBuffers(); 185 storage_provider_->SwapBuffers();
184 186
185 // The call to swapBuffers could potentially result in an immediate draw. 187 // The call to swapBuffers could potentially result in an immediate draw.
186 // Ensure that any changes made to the context's state are restored. 188 // Ensure that any changes made to the context's state are restored.
187 context_->RestoreStateIfDirtiedExternally(); 189 context_->RestoreStateIfDirtiedExternally();
188 return true; 190 return true;
189 } 191 }
190 192
191 void ImageTransportSurfaceFBO::SendSwapBuffers(uint64 surface_handle, 193 void ImageTransportSurfaceFBO::SendSwapBuffers(uint64 surface_handle,
192 const gfx::Size pixel_size, 194 const gfx::Size pixel_size,
193 float scale_factor) { 195 float scale_factor) {
196 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SendSwapBuffers");
194 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 197 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
195 params.surface_handle = surface_handle; 198 params.surface_handle = surface_handle;
196 params.size = pixel_size; 199 params.size = pixel_size;
197 params.scale_factor = scale_factor; 200 params.scale_factor = scale_factor;
198 params.latency_info.swap(latency_info_); 201 params.latency_info.swap(latency_info_);
199 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 202 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
200 is_swap_buffers_send_pending_ = false; 203 is_swap_buffers_send_pending_ = false;
201 } 204 }
202 205
203 void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) { 206 void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) {
204 if (renderer_id) 207 if (renderer_id)
205 context_->share_group()->SetRendererID(renderer_id); 208 context_->share_group()->SetRendererID(renderer_id);
206 } 209 }
207 210
208 bool ImageTransportSurfaceFBO::PostSubBuffer( 211 bool ImageTransportSurfaceFBO::PostSubBuffer(
209 int x, int y, int width, int height) { 212 int x, int y, int width, int height) {
213 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::PostSubBuffer");
210 return SwapBuffersInternal(); 214 return SwapBuffersInternal();
211 } 215 }
212 216
213 bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() { 217 bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() {
214 return true; 218 return true;
215 } 219 }
216 220
217 gfx::Size ImageTransportSurfaceFBO::GetSize() { 221 gfx::Size ImageTransportSurfaceFBO::GetSize() {
218 return pixel_size_; 222 return pixel_size_;
219 } 223 }
220 224
221 void* ImageTransportSurfaceFBO::GetHandle() { 225 void* ImageTransportSurfaceFBO::GetHandle() {
222 return NULL; 226 return NULL;
223 } 227 }
224 228
225 void* ImageTransportSurfaceFBO::GetDisplay() { 229 void* ImageTransportSurfaceFBO::GetDisplay() {
226 return NULL; 230 return NULL;
227 } 231 }
228 232
229 void ImageTransportSurfaceFBO::OnBufferPresented( 233 void ImageTransportSurfaceFBO::OnBufferPresented(
230 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { 234 const AcceleratedSurfaceMsg_BufferPresented_Params& params) {
235 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::OnBufferPresented");
231 SetRendererID(params.renderer_id); 236 SetRendererID(params.renderer_id);
232 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); 237 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling);
233 } 238 }
234 239
235 void ImageTransportSurfaceFBO::OnResize(gfx::Size pixel_size, 240 void ImageTransportSurfaceFBO::OnResize(gfx::Size pixel_size,
236 float scale_factor) { 241 float scale_factor) {
237 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", 242 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize",
238 "old_size", pixel_size_.ToString(), 243 "old_size", pixel_size_.ToString(),
239 "new_size", pixel_size.ToString()); 244 "new_size", pixel_size.ToString());
240 // Caching |context_| from OnMakeCurrent. It should still be current. 245 // Caching |context_| from OnMakeCurrent. It should still be current.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 407 }
403 408
404 has_complete_framebuffer_ = true; 409 has_complete_framebuffer_ = true;
405 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_); 410 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_);
406 411
407 glBindTexture(texture_target, previous_texture_id); 412 glBindTexture(texture_target, previous_texture_id);
408 // The FBO remains bound for this GL context. 413 // The FBO remains bound for this GL context.
409 } 414 }
410 415
411 } // namespace content 416 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_calayer_mac.mm ('k') | ui/accelerated_widget_mac/io_surface_layer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698