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

Side by Side Diff: content/common/gpu/image_transport_surface_win.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/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, float scale_factor) OVERRIDE; 50 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE;
51 virtual void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; 51 virtual void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) OVERRIDE;
52 virtual void WakeUpGpu() OVERRIDE; 52 virtual void WakeUpGpu() OVERRIDE;
53 virtual gfx::Size GetSize() OVERRIDE; 53 virtual gfx::Size GetSize() OVERRIDE;
54 54
55 private: 55 private:
56 virtual ~PbufferImageTransportSurface(); 56 virtual ~PbufferImageTransportSurface();
57 void SendBuffersSwapped(); 57 void SendBuffersSwapped();
58 void DestroySurface(); 58 void DestroySurface();
59 59
60 // Tracks the current buffer allocation state. 60 // Tracks the current buffer allocation state.
61 bool backbuffer_suggested_allocation_; 61 bool backbuffer_suggested_allocation_;
62 bool frontbuffer_suggested_allocation_; 62 bool frontbuffer_suggested_allocation_;
63 63
64 // Whether a SwapBuffers is pending. 64 // Whether a SwapBuffers is pending.
65 bool is_swap_buffers_pending_; 65 bool is_swap_buffers_pending_;
66 66
67 // Whether we unscheduled command buffer because of pending SwapBuffers. 67 // Whether we unscheduled command buffer because of pending SwapBuffers.
68 bool did_unschedule_; 68 bool did_unschedule_;
69 69
70 // Size to resize to when the surface becomes visible. 70 // Size to resize to when the surface becomes visible.
71 gfx::Size visible_size_; 71 gfx::Size visible_size_;
72 72
73 ui::LatencyInfo latency_info_; 73 std::vector<ui::LatencyInfo> latency_info_;
74 74
75 scoped_ptr<ImageTransportHelper> helper_; 75 scoped_ptr<ImageTransportHelper> helper_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface); 77 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface);
78 }; 78 };
79 79
80 PbufferImageTransportSurface::PbufferImageTransportSurface( 80 PbufferImageTransportSurface::PbufferImageTransportSurface(
81 GpuChannelManager* manager, 81 GpuChannelManager* manager,
82 GpuCommandBufferStub* stub) 82 GpuCommandBufferStub* stub)
83 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1))), 83 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(gfx::Size(1, 1))),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 extensions += extensions.empty() ? "" : " "; 191 extensions += extensions.empty() ? "" : " ";
192 extensions += "GL_CHROMIUM_front_buffer_cached"; 192 extensions += "GL_CHROMIUM_front_buffer_cached";
193 return extensions; 193 return extensions;
194 } 194 }
195 195
196 void PbufferImageTransportSurface::SendBuffersSwapped() { 196 void PbufferImageTransportSurface::SendBuffersSwapped() {
197 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 197 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
198 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); 198 params.surface_handle = reinterpret_cast<int64>(GetShareHandle());
199 CHECK(params.surface_handle); 199 CHECK(params.surface_handle);
200 params.size = GetSize(); 200 params.size = GetSize();
201 params.latency_info = latency_info_; 201 params.latency_info.swap(latency_info_);
202 202
203 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 203 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
204 204
205 DCHECK(!is_swap_buffers_pending_); 205 DCHECK(!is_swap_buffers_pending_);
206 is_swap_buffers_pending_ = true; 206 is_swap_buffers_pending_ = true;
207 } 207 }
208 208
209 void PbufferImageTransportSurface::OnBufferPresented( 209 void PbufferImageTransportSurface::OnBufferPresented(
210 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { 210 const AcceleratedSurfaceMsg_BufferPresented_Params& params) {
211 if (!params.vsync_timebase.is_null() && 211 if (!params.vsync_timebase.is_null() &&
(...skipping 17 matching lines...) Expand all
229 DCHECK(backbuffer_suggested_allocation_); 229 DCHECK(backbuffer_suggested_allocation_);
230 DCHECK(frontbuffer_suggested_allocation_); 230 DCHECK(frontbuffer_suggested_allocation_);
231 Resize(size); 231 Resize(size);
232 232
233 DestroySurface(); 233 DestroySurface();
234 234
235 visible_size_ = size; 235 visible_size_ = size;
236 } 236 }
237 237
238 void PbufferImageTransportSurface::SetLatencyInfo( 238 void PbufferImageTransportSurface::SetLatencyInfo(
239 const ui::LatencyInfo& latency_info) { 239 const std::vector<ui::LatencyInfo>& latency_info) {
240 latency_info_ = latency_info; 240 for (size_t i = 0; i < latency_info.size(); i++)
241 latency_info_.push_back(latency_info[i]);
241 } 242 }
242 243
243 void PbufferImageTransportSurface::WakeUpGpu() { 244 void PbufferImageTransportSurface::WakeUpGpu() {
244 NOTIMPLEMENTED(); 245 NOTIMPLEMENTED();
245 } 246 }
246 247
247 gfx::Size PbufferImageTransportSurface::GetSize() { 248 gfx::Size PbufferImageTransportSurface::GetSize() {
248 return GLSurfaceAdapter::GetSize(); 249 return GLSurfaceAdapter::GetSize();
249 } 250 }
250 251
(...skipping 30 matching lines...) Expand all
281 282
282 scoped_refptr<gfx::GLSurface> surface = 283 scoped_refptr<gfx::GLSurface> surface =
283 gfx::GLSurface::CreateViewGLSurface(handle.handle); 284 gfx::GLSurface::CreateViewGLSurface(handle.handle);
284 if (!surface) 285 if (!surface)
285 return surface; 286 return surface;
286 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( 287 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
287 manager, stub, surface.get(), handle.is_transport())); 288 manager, stub, surface.get(), handle.is_transport()));
288 } 289 }
289 290
290 } // namespace content 291 } // 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