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

Side by Side Diff: content/common/gpu/image_transport_surface_win.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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 30 matching lines...) Expand all
41 virtual std::string GetExtensions() OVERRIDE; 41 virtual std::string GetExtensions() OVERRIDE;
42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; 42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE;
43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
44 44
45 protected: 45 protected:
46 // ImageTransportSurface implementation 46 // ImageTransportSurface implementation
47 virtual void OnBufferPresented( 47 virtual void OnBufferPresented(
48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; 48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE;
49 virtual void OnResizeViewACK() OVERRIDE; 49 virtual void OnResizeViewACK() OVERRIDE;
50 virtual void OnResize(gfx::Size size) OVERRIDE; 50 virtual void OnResize(gfx::Size size) OVERRIDE;
51 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE;
51 virtual gfx::Size GetSize() OVERRIDE; 52 virtual gfx::Size GetSize() OVERRIDE;
52 53
53 private: 54 private:
54 virtual ~PbufferImageTransportSurface(); 55 virtual ~PbufferImageTransportSurface();
55 void SendBuffersSwapped(); 56 void SendBuffersSwapped();
56 void DestroySurface(); 57 void DestroySurface();
57 58
58 // Tracks the current buffer allocation state. 59 // Tracks the current buffer allocation state.
59 bool backbuffer_suggested_allocation_; 60 bool backbuffer_suggested_allocation_;
60 bool frontbuffer_suggested_allocation_; 61 bool frontbuffer_suggested_allocation_;
61 62
62 // Whether a SwapBuffers is pending. 63 // Whether a SwapBuffers is pending.
63 bool is_swap_buffers_pending_; 64 bool is_swap_buffers_pending_;
64 65
65 // Whether we unscheduled command buffer because of pending SwapBuffers. 66 // Whether we unscheduled command buffer because of pending SwapBuffers.
66 bool did_unschedule_; 67 bool did_unschedule_;
67 68
68 // Size to resize to when the surface becomes visible. 69 // Size to resize to when the surface becomes visible.
69 gfx::Size visible_size_; 70 gfx::Size visible_size_;
70 71
72 cc::LatencyInfo latency_info_;
73
71 scoped_ptr<ImageTransportHelper> helper_; 74 scoped_ptr<ImageTransportHelper> helper_;
72 75
73 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface); 76 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface);
74 }; 77 };
75 78
76 PbufferImageTransportSurface::PbufferImageTransportSurface( 79 PbufferImageTransportSurface::PbufferImageTransportSurface(
77 GpuChannelManager* manager, 80 GpuChannelManager* manager,
78 GpuCommandBufferStub* stub) 81 GpuCommandBufferStub* stub)
79 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))), 82 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))),
80 backbuffer_suggested_allocation_(true), 83 backbuffer_suggested_allocation_(true),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 extensions += extensions.empty() ? "" : " "; 191 extensions += extensions.empty() ? "" : " ";
189 extensions += "GL_CHROMIUM_front_buffer_cached"; 192 extensions += "GL_CHROMIUM_front_buffer_cached";
190 return extensions; 193 return extensions;
191 } 194 }
192 195
193 void PbufferImageTransportSurface::SendBuffersSwapped() { 196 void PbufferImageTransportSurface::SendBuffersSwapped() {
194 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 197 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
195 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); 198 params.surface_handle = reinterpret_cast<int64>(GetShareHandle());
196 CHECK(params.surface_handle); 199 CHECK(params.surface_handle);
197 params.size = GetSize(); 200 params.size = GetSize();
201 params.latency_info = latency_info_;
198 202
199 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 203 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
200 204
201 DCHECK(!is_swap_buffers_pending_); 205 DCHECK(!is_swap_buffers_pending_);
202 is_swap_buffers_pending_ = true; 206 is_swap_buffers_pending_ = true;
203 } 207 }
204 208
205 void PbufferImageTransportSurface::OnBufferPresented( 209 void PbufferImageTransportSurface::OnBufferPresented(
206 const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) { 210 const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) {
207 is_swap_buffers_pending_ = false; 211 is_swap_buffers_pending_ = false;
(...skipping 10 matching lines...) Expand all
218 void PbufferImageTransportSurface::OnResize(gfx::Size size) { 222 void PbufferImageTransportSurface::OnResize(gfx::Size size) {
219 DCHECK(backbuffer_suggested_allocation_); 223 DCHECK(backbuffer_suggested_allocation_);
220 DCHECK(frontbuffer_suggested_allocation_); 224 DCHECK(frontbuffer_suggested_allocation_);
221 Resize(size); 225 Resize(size);
222 226
223 DestroySurface(); 227 DestroySurface();
224 228
225 visible_size_ = size; 229 visible_size_ = size;
226 } 230 }
227 231
232 void PbufferImageTransportSurface::SetLatencyInfo(
233 const cc::LatencyInfo& latency_info) {
234 latency_info_ = latency_info;
235 }
236
228 gfx::Size PbufferImageTransportSurface::GetSize() { 237 gfx::Size PbufferImageTransportSurface::GetSize() {
229 return GLSurfaceAdapter::GetSize(); 238 return GLSurfaceAdapter::GetSize();
230 } 239 }
231 240
232 } // namespace anonymous 241 } // namespace anonymous
233 242
234 // static 243 // static
235 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( 244 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
236 GpuChannelManager* manager, 245 GpuChannelManager* manager,
237 GpuCommandBufferStub* stub, 246 GpuCommandBufferStub* stub,
(...skipping 23 matching lines...) Expand all
261 270
262 scoped_refptr<gfx::GLSurface> surface = 271 scoped_refptr<gfx::GLSurface> surface =
263 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); 272 gfx::GLSurface::CreateViewGLSurface(false, handle.handle);
264 if (!surface.get()) 273 if (!surface.get())
265 return surface; 274 return surface;
266 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( 275 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
267 manager, stub, surface.get(), handle.is_transport())); 276 manager, stub, surface.get(), handle.is_transport()));
268 } 277 }
269 278
270 } // namespace content 279 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_mac.cc ('k') | content/common/gpu/texture_image_transport_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698