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

Side by Side Diff: content/common/gpu/texture_image_transport_surface.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/texture_image_transport_surface.h" 5 #include "content/common/gpu/texture_image_transport_surface.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // resources we allocated in the stub's context. 187 // resources we allocated in the stub's context.
188 if (fbo_id_) { 188 if (fbo_id_) {
189 glDeleteFramebuffersEXT(1, &fbo_id_); 189 glDeleteFramebuffersEXT(1, &fbo_id_);
190 CHECK_GL_ERROR(); 190 CHECK_GL_ERROR();
191 fbo_id_ = 0; 191 fbo_id_ = 0;
192 } 192 }
193 193
194 stub_destroyed_ = true; 194 stub_destroyed_ = true;
195 } 195 }
196 196
197 void TextureImageTransportSurface::SetLatencyInfo(
198 const cc::LatencyInfo& latency_info) {
199 latency_info_ = latency_info;
200 }
201
197 bool TextureImageTransportSurface::SwapBuffers() { 202 bool TextureImageTransportSurface::SwapBuffers() {
198 DCHECK(backbuffer_suggested_allocation_); 203 DCHECK(backbuffer_suggested_allocation_);
204
199 if (!frontbuffer_suggested_allocation_) 205 if (!frontbuffer_suggested_allocation_)
200 return true; 206 return true;
201 207
202 if (!backbuffer_->service_id()) { 208 if (!backbuffer_->service_id()) {
203 LOG(ERROR) << "Swap without valid backing."; 209 LOG(ERROR) << "Swap without valid backing.";
204 return true; 210 return true;
205 } 211 }
206 212
207 DCHECK(backbuffer_size() == current_size_); 213 DCHECK(backbuffer_size() == current_size_);
208 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 214 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
209 params.size = backbuffer_size(); 215 params.size = backbuffer_size();
210 params.mailbox_name.assign( 216 params.mailbox_name.assign(
211 reinterpret_cast<const char*>(&mailbox_name_), sizeof(mailbox_name_)); 217 reinterpret_cast<const char*>(&mailbox_name_), sizeof(mailbox_name_));
212 218
213 glFlush(); 219 glFlush();
214 ProduceTexture(); 220 ProduceTexture();
215 221
216 // Do not allow destruction while we are still waiting for a swap ACK, 222 // Do not allow destruction while we are still waiting for a swap ACK,
217 // so we do not leak a texture in the mailbox. 223 // so we do not leak a texture in the mailbox.
218 AddRef(); 224 AddRef();
219 225
226 params.latency_info = latency_info_;
220 helper_->SendAcceleratedSurfaceBuffersSwapped(params); 227 helper_->SendAcceleratedSurfaceBuffersSwapped(params);
221 228
222 DCHECK(!is_swap_buffers_pending_); 229 DCHECK(!is_swap_buffers_pending_);
223 is_swap_buffers_pending_ = true; 230 is_swap_buffers_pending_ = true;
224 return true; 231 return true;
225 } 232 }
226 233
227 bool TextureImageTransportSurface::PostSubBuffer( 234 bool TextureImageTransportSurface::PostSubBuffer(
228 int x, int y, int width, int height) { 235 int x, int y, int width, int height) {
229 DCHECK(backbuffer_suggested_allocation_); 236 DCHECK(backbuffer_suggested_allocation_);
(...skipping 21 matching lines...) Expand all
251 params.mailbox_name.assign( 258 params.mailbox_name.assign(
252 reinterpret_cast<const char*>(&mailbox_name_), sizeof(mailbox_name_)); 259 reinterpret_cast<const char*>(&mailbox_name_), sizeof(mailbox_name_));
253 260
254 glFlush(); 261 glFlush();
255 ProduceTexture(); 262 ProduceTexture();
256 263
257 // Do not allow destruction while we are still waiting for a swap ACK, 264 // Do not allow destruction while we are still waiting for a swap ACK,
258 // so we do not leak a texture in the mailbox. 265 // so we do not leak a texture in the mailbox.
259 AddRef(); 266 AddRef();
260 267
268 params.latency_info = latency_info_;
261 helper_->SendAcceleratedSurfacePostSubBuffer(params); 269 helper_->SendAcceleratedSurfacePostSubBuffer(params);
262 270
263 DCHECK(!is_swap_buffers_pending_); 271 DCHECK(!is_swap_buffers_pending_);
264 is_swap_buffers_pending_ = true; 272 is_swap_buffers_pending_ = true;
265 return true; 273 return true;
266 } 274 }
267 275
268 std::string TextureImageTransportSurface::GetExtensions() { 276 std::string TextureImageTransportSurface::GetExtensions() {
269 std::string extensions = gfx::GLSurface::GetExtensions(); 277 std::string extensions = gfx::GLSurface::GetExtensions();
270 extensions += extensions.empty() ? "" : " "; 278 extensions += extensions.empty() ? "" : " ";
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 GL_TEXTURE_2D, 495 GL_TEXTURE_2D,
488 mailbox_name_, 496 mailbox_name_,
489 backbuffer_.release(), 497 backbuffer_.release(),
490 NULL); 498 NULL);
491 DCHECK(success); 499 DCHECK(success);
492 mailbox_name_ = MailboxName(); 500 mailbox_name_ = MailboxName();
493 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0)); 501 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0));
494 } 502 }
495 503
496 } // namespace content 504 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | content/renderer/gpu/compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698