| OLD | NEW |
| 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" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (!fbo_) | 118 if (!fbo_) |
| 119 fbo_ = context3d_->createFramebuffer(); | 119 fbo_ = context3d_->createFramebuffer(); |
| 120 context3d_->bindFramebuffer(GL_FRAMEBUFFER, fbo_); | 120 context3d_->bindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 121 context3d_->framebufferTexture2D( | 121 context3d_->framebufferTexture2D( |
| 122 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 122 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 123 current_backing_.texture_id, 0); | 123 current_backing_.texture_id, 0); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void MailboxOutputSurface::SendFrameToParentCompositor( | 126 void MailboxOutputSurface::SendFrameToParentCompositor( |
| 127 cc::CompositorFrame* frame) { | 127 cc::CompositorFrame* frame) { |
| 128 frame->gl_frame_data.reset(new GLFrameData()); | |
| 129 | |
| 130 DCHECK(!surface_size_.IsEmpty()); | 128 DCHECK(!surface_size_.IsEmpty()); |
| 131 DCHECK(surface_size_ == current_backing_.size); | 129 DCHECK(surface_size_ == current_backing_.size); |
| 132 DCHECK(!current_backing_.mailbox.IsZero()); | 130 DCHECK(!current_backing_.mailbox.IsZero()); |
| 133 | 131 |
| 134 frame->gl_frame_data->mailbox = current_backing_.mailbox; | 132 frame->gl_frame_data->mailbox = current_backing_.mailbox; |
| 135 frame->gl_frame_data->size = current_backing_.size; | 133 frame->gl_frame_data->size = current_backing_.size; |
| 136 context3d_->flush(); | 134 context3d_->flush(); |
| 137 frame->gl_frame_data->sync_point = context3d_->insertSyncPoint(); | 135 frame->gl_frame_data->sync_point = context3d_->insertSyncPoint(); |
| 138 CompositorOutputSurface::SendFrameToParentCompositor(frame); | 136 CompositorOutputSurface::SendFrameToParentCompositor(frame); |
| 139 | 137 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 pending_textures_.pop_front(); | 175 pending_textures_.pop_front(); |
| 178 } | 176 } |
| 179 CompositorOutputSurface::OnSwapAck(ack); | 177 CompositorOutputSurface::OnSwapAck(ack); |
| 180 } | 178 } |
| 181 | 179 |
| 182 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { | 180 void MailboxOutputSurface::SwapBuffers(const ui::LatencyInfo&) { |
| 183 } | 181 } |
| 184 | 182 |
| 185 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, | 183 void MailboxOutputSurface::PostSubBuffer(gfx::Rect rect, |
| 186 const ui::LatencyInfo&) { | 184 const ui::LatencyInfo&) { |
| 187 NOTIMPLEMENTED() | |
| 188 << "Partial swap not supported with composite-to-mailbox yet."; | |
| 189 | |
| 190 // The browser only copies damage correctly for two buffers in use. | 185 // The browser only copies damage correctly for two buffers in use. |
| 191 DCHECK(GetNumAcksPending() < 2); | 186 DCHECK(GetNumAcksPending() < 2); |
| 192 } | 187 } |
| 193 | 188 |
| 194 size_t MailboxOutputSurface::GetNumAcksPending() { | 189 size_t MailboxOutputSurface::GetNumAcksPending() { |
| 195 DCHECK(pending_textures_.size()); | 190 DCHECK(pending_textures_.size()); |
| 196 return pending_textures_.size() - 1; | 191 return pending_textures_.size() - 1; |
| 197 } | 192 } |
| 198 | 193 |
| 199 } // namespace content | 194 } // namespace content |
| OLD | NEW |