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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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_messages.h" 9 #include "content/common/gpu/gpu_messages.h"
10 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 53 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
54 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; 54 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE;
55 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 55 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
56 56
57 protected: 57 protected:
58 // ImageTransportSurface implementation 58 // ImageTransportSurface implementation
59 virtual void OnBufferPresented( 59 virtual void OnBufferPresented(
60 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; 60 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE;
61 virtual void OnResizeViewACK() OVERRIDE; 61 virtual void OnResizeViewACK() OVERRIDE;
62 virtual void OnResize(gfx::Size size) OVERRIDE; 62 virtual void OnResize(gfx::Size size) OVERRIDE;
63 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE;
63 64
64 private: 65 private:
65 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; 66 virtual ~IOSurfaceImageTransportSurface() OVERRIDE;
66 67
67 void AdjustBufferAllocation(); 68 void AdjustBufferAllocation();
68 void UnrefIOSurface(); 69 void UnrefIOSurface();
69 void CreateIOSurface(); 70 void CreateIOSurface();
70 71
71 // Tracks the current buffer allocation state. 72 // Tracks the current buffer allocation state.
72 bool backbuffer_suggested_allocation_; 73 bool backbuffer_suggested_allocation_;
(...skipping 15 matching lines...) Expand all
88 89
89 // Whether or not we've successfully made the surface current once. 90 // Whether or not we've successfully made the surface current once.
90 bool made_current_; 91 bool made_current_;
91 92
92 // Whether a SwapBuffers is pending. 93 // Whether a SwapBuffers is pending.
93 bool is_swap_buffers_pending_; 94 bool is_swap_buffers_pending_;
94 95
95 // Whether we unscheduled command buffer because of pending SwapBuffers. 96 // Whether we unscheduled command buffer because of pending SwapBuffers.
96 bool did_unschedule_; 97 bool did_unschedule_;
97 98
99 cc::LatencyInfo latency_info_;
100
98 scoped_ptr<ImageTransportHelper> helper_; 101 scoped_ptr<ImageTransportHelper> helper_;
99 102
100 DISALLOW_COPY_AND_ASSIGN(IOSurfaceImageTransportSurface); 103 DISALLOW_COPY_AND_ASSIGN(IOSurfaceImageTransportSurface);
101 }; 104 };
102 105
103 void AddBooleanValue(CFMutableDictionaryRef dictionary, 106 void AddBooleanValue(CFMutableDictionaryRef dictionary,
104 const CFStringRef key, 107 const CFStringRef key,
105 bool value) { 108 bool value) {
106 CFDictionaryAddValue(dictionary, key, 109 CFDictionaryAddValue(dictionary, key,
107 (value ? kCFBooleanTrue : kCFBooleanFalse)); 110 (value ? kCFBooleanTrue : kCFBooleanFalse));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 224
222 bool IOSurfaceImageTransportSurface::SwapBuffers() { 225 bool IOSurfaceImageTransportSurface::SwapBuffers() {
223 DCHECK(backbuffer_suggested_allocation_); 226 DCHECK(backbuffer_suggested_allocation_);
224 if (!frontbuffer_suggested_allocation_) 227 if (!frontbuffer_suggested_allocation_)
225 return true; 228 return true;
226 glFlush(); 229 glFlush();
227 230
228 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 231 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
229 params.surface_handle = io_surface_handle_; 232 params.surface_handle = io_surface_handle_;
230 params.size = GetSize(); 233 params.size = GetSize();
234 params.latency_info = latency_info_;
231 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 235 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
232 236
233 DCHECK(!is_swap_buffers_pending_); 237 DCHECK(!is_swap_buffers_pending_);
234 is_swap_buffers_pending_ = true; 238 is_swap_buffers_pending_ = true;
235 return true; 239 return true;
236 } 240 }
237 241
238 bool IOSurfaceImageTransportSurface::PostSubBuffer( 242 bool IOSurfaceImageTransportSurface::PostSubBuffer(
239 int x, int y, int width, int height) { 243 int x, int y, int width, int height) {
240 DCHECK(backbuffer_suggested_allocation_); 244 DCHECK(backbuffer_suggested_allocation_);
241 if (!frontbuffer_suggested_allocation_) 245 if (!frontbuffer_suggested_allocation_)
242 return true; 246 return true;
243 glFlush(); 247 glFlush();
244 248
245 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; 249 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
246 params.surface_handle = io_surface_handle_; 250 params.surface_handle = io_surface_handle_;
247 params.x = x; 251 params.x = x;
248 params.y = y; 252 params.y = y;
249 params.width = width; 253 params.width = width;
250 params.height = height; 254 params.height = height;
251 params.surface_size = GetSize(); 255 params.surface_size = GetSize();
256 params.latency_info = latency_info_;
252 helper_->SendAcceleratedSurfacePostSubBuffer(params); 257 helper_->SendAcceleratedSurfacePostSubBuffer(params);
253 258
254 DCHECK(!is_swap_buffers_pending_); 259 DCHECK(!is_swap_buffers_pending_);
255 is_swap_buffers_pending_ = true; 260 is_swap_buffers_pending_ = true;
256 return true; 261 return true;
257 } 262 }
258 263
259 std::string IOSurfaceImageTransportSurface::GetExtensions() { 264 std::string IOSurfaceImageTransportSurface::GetExtensions() {
260 std::string extensions = gfx::GLSurface::GetExtensions(); 265 std::string extensions = gfx::GLSurface::GetExtensions();
261 extensions += extensions.empty() ? "" : " "; 266 extensions += extensions.empty() ? "" : " ";
(...skipping 28 matching lines...) Expand all
290 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", 295 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize",
291 "old_width", size_.width(), "new_width", size.width()); 296 "old_width", size_.width(), "new_width", size.width());
292 // Caching |context_| from OnMakeCurrent. It should still be current. 297 // Caching |context_| from OnMakeCurrent. It should still be current.
293 DCHECK(context_->IsCurrent(this)); 298 DCHECK(context_->IsCurrent(this));
294 299
295 size_ = size; 300 size_ = size;
296 301
297 CreateIOSurface(); 302 CreateIOSurface();
298 } 303 }
299 304
305 void IOSurfaceImageTransportSurface::SetLatencyInfo(
306 const cc::LatencyInfo& latency_info) {
307 latency_info_ = latency_info;
308 }
309
300 void IOSurfaceImageTransportSurface::UnrefIOSurface() { 310 void IOSurfaceImageTransportSurface::UnrefIOSurface() {
301 // If we have resources to destroy, then make sure that we have a current 311 // If we have resources to destroy, then make sure that we have a current
302 // context which we can use to delete the resources. 312 // context which we can use to delete the resources.
303 if (context_ || fbo_id_ || texture_id_) { 313 if (context_ || fbo_id_ || texture_id_) {
304 DCHECK(gfx::GLContext::GetCurrent() == context_); 314 DCHECK(gfx::GLContext::GetCurrent() == context_);
305 DCHECK(context_->IsCurrent(this)); 315 DCHECK(context_->IsCurrent(this));
306 DCHECK(CGLGetCurrentContext()); 316 DCHECK(CGLGetCurrentContext());
307 } 317 }
308 318
309 if (fbo_id_) { 319 if (fbo_id_) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 manager, stub, surface.get(), false)); 478 manager, stub, surface.get(), false));
469 } 479 }
470 } 480 }
471 481
472 // static 482 // static
473 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { 483 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) {
474 g_allow_os_mesa = allow; 484 g_allow_os_mesa = allow;
475 } 485 }
476 486
477 } // namespace content 487 } // 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