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

Side by Side Diff: content/common/gpu/image_transport_surface_mac.cc

Issue 123563002: Remove gpu side LatencyInfo merging (Closed) Base URL: http://git.chromium.org/chromium/src.git@gpu-per-event-latency-6-small
Patch Set: fix mac_rel compiler error. Move kMaxLatencyInfoNumber to .cc file Created 6 years, 11 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 (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 #include "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 #include "base/mac/scoped_cftyperef.h" 7 #include "base/mac/scoped_cftyperef.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/gpu/gpu_command_buffer_stub.h" 9 #include "content/common/gpu/gpu_command_buffer_stub.h"
10 #include "content/common/gpu/gpu_messages.h" 10 #include "content/common/gpu/gpu_messages.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 56 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
57 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; 57 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE;
58 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 58 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
59 59
60 protected: 60 protected:
61 // ImageTransportSurface implementation 61 // ImageTransportSurface implementation
62 virtual void OnBufferPresented( 62 virtual void OnBufferPresented(
63 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; 63 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE;
64 virtual void OnResizeViewACK() OVERRIDE; 64 virtual void OnResizeViewACK() OVERRIDE;
65 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; 65 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE;
66 virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; 66 virtual void SetLatencyInfo(
67 const std::vector<ui::LatencyInfo>&) OVERRIDE;
67 virtual void WakeUpGpu() OVERRIDE; 68 virtual void WakeUpGpu() OVERRIDE;
68 69
69 // GpuCommandBufferStub::DestructionObserver implementation. 70 // GpuCommandBufferStub::DestructionObserver implementation.
70 virtual void OnWillDestroyStub() OVERRIDE; 71 virtual void OnWillDestroyStub() OVERRIDE;
71 72
72 private: 73 private:
73 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; 74 virtual ~IOSurfaceImageTransportSurface() OVERRIDE;
74 75
75 void AdjustBufferAllocation(); 76 void AdjustBufferAllocation();
76 void UnrefIOSurface(); 77 void UnrefIOSurface();
(...skipping 21 matching lines...) Expand all
98 99
99 // Whether or not we've successfully made the surface current once. 100 // Whether or not we've successfully made the surface current once.
100 bool made_current_; 101 bool made_current_;
101 102
102 // Whether a SwapBuffers is pending. 103 // Whether a SwapBuffers is pending.
103 bool is_swap_buffers_pending_; 104 bool is_swap_buffers_pending_;
104 105
105 // Whether we unscheduled command buffer because of pending SwapBuffers. 106 // Whether we unscheduled command buffer because of pending SwapBuffers.
106 bool did_unschedule_; 107 bool did_unschedule_;
107 108
108 ui::LatencyInfo latency_info_; 109 std::vector<ui::LatencyInfo> latency_info_;
109 110
110 scoped_ptr<ImageTransportHelper> helper_; 111 scoped_ptr<ImageTransportHelper> helper_;
111 112
112 DISALLOW_COPY_AND_ASSIGN(IOSurfaceImageTransportSurface); 113 DISALLOW_COPY_AND_ASSIGN(IOSurfaceImageTransportSurface);
113 }; 114 };
114 115
115 void AddBooleanValue(CFMutableDictionaryRef dictionary, 116 void AddBooleanValue(CFMutableDictionaryRef dictionary,
116 const CFStringRef key, 117 const CFStringRef key,
117 bool value) { 118 bool value) {
118 CFDictionaryAddValue(dictionary, key, 119 CFDictionaryAddValue(dictionary, key,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bool IOSurfaceImageTransportSurface::SwapBuffers() { 243 bool IOSurfaceImageTransportSurface::SwapBuffers() {
243 DCHECK(backbuffer_suggested_allocation_); 244 DCHECK(backbuffer_suggested_allocation_);
244 if (!frontbuffer_suggested_allocation_) 245 if (!frontbuffer_suggested_allocation_)
245 return true; 246 return true;
246 glFlush(); 247 glFlush();
247 248
248 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 249 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
249 params.surface_handle = io_surface_handle_; 250 params.surface_handle = io_surface_handle_;
250 params.size = GetSize(); 251 params.size = GetSize();
251 params.scale_factor = scale_factor_; 252 params.scale_factor = scale_factor_;
252 params.latency_info = latency_info_; 253 params.latency_info.swap(latency_info_);
253 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 254 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
254 255
255 DCHECK(!is_swap_buffers_pending_); 256 DCHECK(!is_swap_buffers_pending_);
256 is_swap_buffers_pending_ = true; 257 is_swap_buffers_pending_ = true;
257 return true; 258 return true;
258 } 259 }
259 260
260 bool IOSurfaceImageTransportSurface::PostSubBuffer( 261 bool IOSurfaceImageTransportSurface::PostSubBuffer(
261 int x, int y, int width, int height) { 262 int x, int y, int width, int height) {
262 DCHECK(backbuffer_suggested_allocation_); 263 DCHECK(backbuffer_suggested_allocation_);
263 if (!frontbuffer_suggested_allocation_) 264 if (!frontbuffer_suggested_allocation_)
264 return true; 265 return true;
265 glFlush(); 266 glFlush();
266 267
267 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; 268 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
268 params.surface_handle = io_surface_handle_; 269 params.surface_handle = io_surface_handle_;
269 params.x = x; 270 params.x = x;
270 params.y = y; 271 params.y = y;
271 params.width = width; 272 params.width = width;
272 params.height = height; 273 params.height = height;
273 params.surface_size = GetSize(); 274 params.surface_size = GetSize();
274 params.surface_scale_factor = scale_factor_; 275 params.surface_scale_factor = scale_factor_;
275 params.latency_info = latency_info_; 276 params.latency_info.swap(latency_info_);
276 helper_->SendAcceleratedSurfacePostSubBuffer(params); 277 helper_->SendAcceleratedSurfacePostSubBuffer(params);
277 278
278 DCHECK(!is_swap_buffers_pending_); 279 DCHECK(!is_swap_buffers_pending_);
279 is_swap_buffers_pending_ = true; 280 is_swap_buffers_pending_ = true;
280 return true; 281 return true;
281 } 282 }
282 283
283 std::string IOSurfaceImageTransportSurface::GetExtensions() { 284 std::string IOSurfaceImageTransportSurface::GetExtensions() {
284 std::string extensions = gfx::GLSurface::GetExtensions(); 285 std::string extensions = gfx::GLSurface::GetExtensions();
285 extensions += extensions.empty() ? "" : " "; 286 extensions += extensions.empty() ? "" : " ";
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Caching |context_| from OnMakeCurrent. It should still be current. 318 // Caching |context_| from OnMakeCurrent. It should still be current.
318 DCHECK(context_->IsCurrent(this)); 319 DCHECK(context_->IsCurrent(this));
319 320
320 size_ = size; 321 size_ = size;
321 scale_factor_ = scale_factor; 322 scale_factor_ = scale_factor;
322 323
323 CreateIOSurface(); 324 CreateIOSurface();
324 } 325 }
325 326
326 void IOSurfaceImageTransportSurface::SetLatencyInfo( 327 void IOSurfaceImageTransportSurface::SetLatencyInfo(
327 const ui::LatencyInfo& latency_info) { 328 const std::vector<ui::LatencyInfo>& latency_info) {
328 latency_info_ = latency_info; 329 for (size_t i = 0; i < latency_info.size(); i++)
330 latency_info_.push_back(latency_info[i]);
329 } 331 }
330 332
331 void IOSurfaceImageTransportSurface::WakeUpGpu() { 333 void IOSurfaceImageTransportSurface::WakeUpGpu() {
332 NOTIMPLEMENTED(); 334 NOTIMPLEMENTED();
333 } 335 }
334 336
335 void IOSurfaceImageTransportSurface::OnWillDestroyStub() { 337 void IOSurfaceImageTransportSurface::OnWillDestroyStub() {
336 helper_->stub()->RemoveDestructionObserver(this); 338 helper_->stub()->RemoveDestructionObserver(this);
337 Destroy(); 339 Destroy();
338 } 340 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 manager, stub, surface.get(), false)); 552 manager, stub, surface.get(), false));
551 } 553 }
552 } 554 }
553 555
554 // static 556 // static
555 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { 557 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) {
556 g_allow_os_mesa = allow; 558 g_allow_os_mesa = allow;
557 } 559 }
558 560
559 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface.cc ('k') | content/common/gpu/image_transport_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698