OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "content/common/gpu/gpu_channel.h" | 13 #include "content/common/gpu/gpu_channel.h" |
14 #include "content/common/gpu/gpu_channel_manager.h" | 14 #include "content/common/gpu/gpu_channel_manager.h" |
15 #include "content/common/gpu/gpu_command_buffer_stub.h" | 15 #include "content/common/gpu/gpu_command_buffer_stub.h" |
16 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
17 #include "gpu/command_buffer/service/gpu_scheduler.h" | 17 #include "gpu/command_buffer/service/gpu_scheduler.h" |
18 #include "ui/gl/gl_switches.h" | 18 #include "ui/gl/gl_switches.h" |
| 19 #include "ui/gl/gl_implementation.h" |
19 | 20 |
20 ImageTransportSurface::ImageTransportSurface() {} | 21 ImageTransportSurface::ImageTransportSurface() {} |
21 | 22 |
22 ImageTransportSurface::~ImageTransportSurface() {} | 23 ImageTransportSurface::~ImageTransportSurface() {} |
23 | 24 |
24 void ImageTransportSurface::GetRegionsToCopy( | 25 void ImageTransportSurface::GetRegionsToCopy( |
25 const gfx::Rect& previous_damage_rect, | 26 const gfx::Rect& previous_damage_rect, |
26 const gfx::Rect& new_damage_rect, | 27 const gfx::Rect& new_damage_rect, |
27 std::vector<gfx::Rect>* regions) { | 28 std::vector<gfx::Rect>* regions) { |
28 gfx::Rect intersection = previous_damage_rect.Intersect(new_damage_rect); | 29 gfx::Rect intersection = previous_damage_rect.Intersect(new_damage_rect); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 params.surface_id = stub_->surface_id(); | 106 params.surface_id = stub_->surface_id(); |
106 params.route_id = route_id_; | 107 params.route_id = route_id_; |
107 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
108 params.window = handle_; | 109 params.window = handle_; |
109 #endif | 110 #endif |
110 manager_->Send(new GpuHostMsg_AcceleratedSurfaceNew(params)); | 111 manager_->Send(new GpuHostMsg_AcceleratedSurfaceNew(params)); |
111 } | 112 } |
112 | 113 |
113 void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( | 114 void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped( |
114 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) { | 115 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) { |
| 116 // TRACE_EVENT for gpu tests: |
| 117 TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", |
| 118 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), |
| 119 "width", surface_->GetSize().width()); |
115 params.surface_id = stub_->surface_id(); | 120 params.surface_id = stub_->surface_id(); |
116 params.route_id = route_id_; | 121 params.route_id = route_id_; |
117 #if defined(OS_MACOSX) | 122 #if defined(OS_MACOSX) |
118 params.window = handle_; | 123 params.window = handle_; |
119 #endif | 124 #endif |
120 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); | 125 manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); |
121 } | 126 } |
122 | 127 |
123 void ImageTransportHelper::SendAcceleratedSurfacePostSubBuffer( | 128 void ImageTransportHelper::SendAcceleratedSurfacePostSubBuffer( |
124 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params) { | 129 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 new_size_ = size; | 324 new_size_ = size; |
320 | 325 |
321 if (transport_) { | 326 if (transport_) { |
322 helper_->SendResizeView(size); | 327 helper_->SendResizeView(size); |
323 helper_->SetScheduled(false); | 328 helper_->SetScheduled(false); |
324 } else { | 329 } else { |
325 Resize(new_size_); | 330 Resize(new_size_); |
326 } | 331 } |
327 } | 332 } |
328 | 333 |
| 334 gfx::Size PassThroughImageTransportSurface::GetSize() { |
| 335 return GLSurfaceAdapter::GetSize(); |
| 336 } |
| 337 |
329 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} | 338 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
330 | 339 |
331 #endif // defined(ENABLE_GPU) | 340 #endif // defined(ENABLE_GPU) |
OLD | NEW |