| 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/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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (fbo_id_) { | 185 if (fbo_id_) { |
| 186 glDeleteFramebuffersEXT(1, &fbo_id_); | 186 glDeleteFramebuffersEXT(1, &fbo_id_); |
| 187 CHECK_GL_ERROR(); | 187 CHECK_GL_ERROR(); |
| 188 fbo_id_ = 0; | 188 fbo_id_ = 0; |
| 189 } | 189 } |
| 190 | 190 |
| 191 stub_destroyed_ = true; | 191 stub_destroyed_ = true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void TextureImageTransportSurface::SetLatencyInfo( | 194 void TextureImageTransportSurface::SetLatencyInfo( |
| 195 const ui::LatencyInfo& latency_info) { | 195 const std::vector<ui::LatencyInfo>& latency_info) { |
| 196 latency_info_ = latency_info; | 196 for (size_t i = 0; i < latency_info.size(); i++) |
| 197 latency_info_.push_back(latency_info[i]); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void TextureImageTransportSurface::WakeUpGpu() { | 200 void TextureImageTransportSurface::WakeUpGpu() { |
| 200 NOTIMPLEMENTED(); | 201 NOTIMPLEMENTED(); |
| 201 } | 202 } |
| 202 | 203 |
| 203 bool TextureImageTransportSurface::SwapBuffers() { | 204 bool TextureImageTransportSurface::SwapBuffers() { |
| 204 DCHECK(IsContextValid(helper_.get())); | 205 DCHECK(IsContextValid(helper_.get())); |
| 205 DCHECK(backbuffer_suggested_allocation_); | 206 DCHECK(backbuffer_suggested_allocation_); |
| 206 | 207 |
| 207 if (!frontbuffer_suggested_allocation_) | 208 if (!frontbuffer_suggested_allocation_) |
| 208 return true; | 209 return true; |
| 209 | 210 |
| 210 if (!backbuffer_.get()) { | 211 if (!backbuffer_.get()) { |
| 211 LOG(ERROR) << "Swap without valid backing."; | 212 LOG(ERROR) << "Swap without valid backing."; |
| 212 return true; | 213 return true; |
| 213 } | 214 } |
| 214 | 215 |
| 215 DCHECK(backbuffer_size() == current_size_); | 216 DCHECK(backbuffer_size() == current_size_); |
| 216 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 217 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
| 217 params.size = backbuffer_size(); | 218 params.size = backbuffer_size(); |
| 218 params.scale_factor = scale_factor_; | 219 params.scale_factor = scale_factor_; |
| 219 params.mailbox_name.assign( | 220 params.mailbox_name.assign( |
| 220 reinterpret_cast<const char*>(&back_mailbox_name_), | 221 reinterpret_cast<const char*>(&back_mailbox_name_), |
| 221 sizeof(back_mailbox_name_)); | 222 sizeof(back_mailbox_name_)); |
| 222 | 223 |
| 223 glFlush(); | 224 glFlush(); |
| 224 | 225 |
| 225 params.latency_info = latency_info_; | 226 params.latency_info.swap(latency_info_); |
| 226 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 227 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
| 227 | 228 |
| 228 DCHECK(!is_swap_buffers_pending_); | 229 DCHECK(!is_swap_buffers_pending_); |
| 229 is_swap_buffers_pending_ = true; | 230 is_swap_buffers_pending_ = true; |
| 230 return true; | 231 return true; |
| 231 } | 232 } |
| 232 | 233 |
| 233 bool TextureImageTransportSurface::PostSubBuffer( | 234 bool TextureImageTransportSurface::PostSubBuffer( |
| 234 int x, int y, int width, int height) { | 235 int x, int y, int width, int height) { |
| 235 DCHECK(IsContextValid(helper_.get())); | 236 DCHECK(IsContextValid(helper_.get())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 255 params.x = x; | 256 params.x = x; |
| 256 params.y = y; | 257 params.y = y; |
| 257 params.width = width; | 258 params.width = width; |
| 258 params.height = height; | 259 params.height = height; |
| 259 params.mailbox_name.assign( | 260 params.mailbox_name.assign( |
| 260 reinterpret_cast<const char*>(&back_mailbox_name_), | 261 reinterpret_cast<const char*>(&back_mailbox_name_), |
| 261 sizeof(back_mailbox_name_)); | 262 sizeof(back_mailbox_name_)); |
| 262 | 263 |
| 263 glFlush(); | 264 glFlush(); |
| 264 | 265 |
| 265 params.latency_info = latency_info_; | 266 params.latency_info.swap(latency_info_); |
| 266 helper_->SendAcceleratedSurfacePostSubBuffer(params); | 267 helper_->SendAcceleratedSurfacePostSubBuffer(params); |
| 267 | 268 |
| 268 DCHECK(!is_swap_buffers_pending_); | 269 DCHECK(!is_swap_buffers_pending_); |
| 269 is_swap_buffers_pending_ = true; | 270 is_swap_buffers_pending_ = true; |
| 270 return true; | 271 return true; |
| 271 } | 272 } |
| 272 | 273 |
| 273 std::string TextureImageTransportSurface::GetExtensions() { | 274 std::string TextureImageTransportSurface::GetExtensions() { |
| 274 std::string extensions = gfx::GLSurface::GetExtensions(); | 275 std::string extensions = gfx::GLSurface::GetExtensions(); |
| 275 extensions += extensions.empty() ? "" : " "; | 276 extensions += extensions.empty() ? "" : " "; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 461 |
| 461 #ifndef NDEBUG | 462 #ifndef NDEBUG |
| 462 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 463 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 463 if (status != GL_FRAMEBUFFER_COMPLETE) { | 464 if (status != GL_FRAMEBUFFER_COMPLETE) { |
| 464 DLOG(FATAL) << "Framebuffer incomplete: " << status; | 465 DLOG(FATAL) << "Framebuffer incomplete: " << status; |
| 465 } | 466 } |
| 466 #endif | 467 #endif |
| 467 } | 468 } |
| 468 | 469 |
| 469 } // namespace content | 470 } // namespace content |
| OLD | NEW |