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

Side by Side Diff: content/renderer/gpu/mailbox_output_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/renderer/gpu/mailbox_output_surface.h" 5 #include "content/renderer/gpu/mailbox_output_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/gl_frame_data.h" 10 #include "cc/output/gl_frame_data.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
12 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
13 #include "third_party/khronos/GLES2/gl2ext.h" 13 #include "third_party/khronos/GLES2/gl2ext.h"
14 14
15 using cc::CompositorFrame; 15 using cc::CompositorFrame;
16 using cc::GLFrameData; 16 using cc::GLFrameData;
17 using gpu::Mailbox; 17 using gpu::Mailbox;
18 using WebKit::WebGraphicsContext3D;
19 18
20 namespace content { 19 namespace content {
21 20
22 MailboxOutputSurface::MailboxOutputSurface( 21 MailboxOutputSurface::MailboxOutputSurface(
23 int32 routing_id, 22 int32 routing_id,
24 WebGraphicsContext3D* context3D, 23 WebGraphicsContext3DCommandBufferImpl* context3D,
25 cc::SoftwareOutputDevice* software_device) 24 cc::SoftwareOutputDevice* software_device)
26 : CompositorOutputSurface(routing_id, context3D, software_device), 25 : CompositorOutputSurface(routing_id, context3D, software_device),
27 fbo_(0), 26 fbo_(0),
28 is_backbuffer_discarded_(false) { 27 is_backbuffer_discarded_(false) {
29 pending_textures_.push_back(TransferableFrame()); 28 pending_textures_.push_back(TransferableFrame());
30 } 29 }
31 30
32 MailboxOutputSurface::~MailboxOutputSurface() { 31 MailboxOutputSurface::~MailboxOutputSurface() {
33 DiscardBackbuffer(); 32 DiscardBackbuffer();
34 while (!pending_textures_.empty()) { 33 while (!pending_textures_.empty()) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // If it does not return a mailbox, it discarded the frontbuffer which is 178 // If it does not return a mailbox, it discarded the frontbuffer which is
180 // the oldest texture we sent. 179 // the oldest texture we sent.
181 uint32 texture_id = pending_textures_.front().texture_id; 180 uint32 texture_id = pending_textures_.front().texture_id;
182 if (texture_id) 181 if (texture_id)
183 context3d_->deleteTexture(texture_id); 182 context3d_->deleteTexture(texture_id);
184 pending_textures_.pop_front(); 183 pending_textures_.pop_front();
185 } 184 }
186 CompositorOutputSurface::OnSwapAck(ack); 185 CompositorOutputSurface::OnSwapAck(ack);
187 } 186 }
188 187
189 void MailboxOutputSurface::SwapBuffers() { 188 void MailboxOutputSurface::SwapBuffers(const cc::LatencyInfo&) {
190 } 189 }
191 190
192 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect) { 191 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect,
192 const cc::LatencyInfo&) {
193 NOTIMPLEMENTED() 193 NOTIMPLEMENTED()
194 << "Partial swap not supported with composite-to-mailbox yet."; 194 << "Partial swap not supported with composite-to-mailbox yet.";
195 195
196 // The browser only copies damage correctly for two buffers in use. 196 // The browser only copies damage correctly for two buffers in use.
197 DCHECK(GetNumAcksPending() < 3); 197 DCHECK(GetNumAcksPending() < 3);
198 } 198 }
199 199
200 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) { 200 void MailboxOutputSurface::ConsumeTexture(const TransferableFrame& frame) {
201 DCHECK(!frame.mailbox.IsZero()); 201 DCHECK(!frame.mailbox.IsZero());
202 if (frame.sync_point) 202 if (frame.sync_point)
203 context3d_->waitSyncPoint(frame.sync_point); 203 context3d_->waitSyncPoint(frame.sync_point);
204 204
205 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id); 205 context3d_->bindTexture(GL_TEXTURE_2D, frame.texture_id);
206 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name); 206 context3d_->consumeTextureCHROMIUM(GL_TEXTURE_2D, frame.mailbox.name);
207 } 207 }
208 208
209 size_t MailboxOutputSurface::GetNumAcksPending() { 209 size_t MailboxOutputSurface::GetNumAcksPending() {
210 DCHECK(pending_textures_.size()); 210 DCHECK(pending_textures_.size());
211 return pending_textures_.size() - 1; 211 return pending_textures_.size() - 1;
212 } 212 }
213 213
214 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698