| 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 "ppapi/proxy/video_decoder_resource.h" | 5 #include "ppapi/proxy/video_decoder_resource.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 10 #include "gpu/command_buffer/common/mailbox.h" |
| 10 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
| 11 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
| 12 #include "ppapi/c/ppb_opengles2.h" | 13 #include "ppapi/c/ppb_opengles2.h" |
| 14 #include "ppapi/proxy/enter_proxy.h" |
| 13 #include "ppapi/proxy/plugin_dispatcher.h" | 15 #include "ppapi/proxy/plugin_dispatcher.h" |
| 14 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 15 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" | 17 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
| 16 #include "ppapi/proxy/serialized_handle.h" | 18 #include "ppapi/proxy/serialized_handle.h" |
| 17 #include "ppapi/proxy/video_decoder_constants.h" | 19 #include "ppapi/proxy/video_decoder_constants.h" |
| 18 #include "ppapi/shared_impl/ppapi_globals.h" | 20 #include "ppapi/shared_impl/ppapi_globals.h" |
| 19 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 21 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 20 #include "ppapi/shared_impl/proxy_lock.h" | 22 #include "ppapi/shared_impl/proxy_lock.h" |
| 21 #include "ppapi/shared_impl/resource_tracker.h" | 23 #include "ppapi/shared_impl/resource_tracker.h" |
| 22 #include "ppapi/thunk/enter.h" | 24 #include "ppapi/thunk/enter.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 327 } |
| 326 | 328 |
| 327 void VideoDecoderResource::SetForTest() { | 329 void VideoDecoderResource::SetForTest() { |
| 328 testing_ = true; | 330 testing_ = true; |
| 329 } | 331 } |
| 330 | 332 |
| 331 void VideoDecoderResource::OnPluginMsgRequestTextures( | 333 void VideoDecoderResource::OnPluginMsgRequestTextures( |
| 332 const ResourceMessageReplyParams& params, | 334 const ResourceMessageReplyParams& params, |
| 333 uint32_t num_textures, | 335 uint32_t num_textures, |
| 334 const PP_Size& size, | 336 const PP_Size& size, |
| 335 uint32_t texture_target) { | 337 uint32_t texture_target, |
| 338 const std::vector<gpu::Mailbox>& mailboxes) { |
| 336 DCHECK(num_textures); | 339 DCHECK(num_textures); |
| 340 DCHECK(!mailboxes.size() || mailboxes.size() == num_textures); |
| 337 std::vector<uint32_t> texture_ids(num_textures); | 341 std::vector<uint32_t> texture_ids(num_textures); |
| 338 if (gles2_impl_) { | 342 if (gles2_impl_) { |
| 339 gles2_impl_->GenTextures(num_textures, &texture_ids.front()); | 343 gles2_impl_->GenTextures(num_textures, &texture_ids.front()); |
| 340 for (uint32_t i = 0; i < num_textures; ++i) { | 344 for (uint32_t i = 0; i < num_textures; ++i) { |
| 341 gles2_impl_->ActiveTexture(GL_TEXTURE0); | 345 gles2_impl_->ActiveTexture(GL_TEXTURE0); |
| 342 gles2_impl_->BindTexture(texture_target, texture_ids[i]); | 346 gles2_impl_->BindTexture(texture_target, texture_ids[i]); |
| 343 gles2_impl_->TexParameteri( | 347 gles2_impl_->TexParameteri( |
| 344 texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 348 texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 345 gles2_impl_->TexParameteri( | 349 gles2_impl_->TexParameteri( |
| 346 texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 350 texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 347 gles2_impl_->TexParameterf( | 351 gles2_impl_->TexParameterf( |
| 348 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 352 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 349 gles2_impl_->TexParameterf( | 353 gles2_impl_->TexParameterf( |
| 350 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 354 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 351 | 355 |
| 352 if (texture_target == GL_TEXTURE_2D) { | 356 if (texture_target == GL_TEXTURE_2D) { |
| 353 gles2_impl_->TexImage2D(texture_target, | 357 gles2_impl_->TexImage2D(texture_target, |
| 354 0, | 358 0, |
| 355 GL_RGBA, | 359 GL_RGBA, |
| 356 size.width, | 360 size.width, |
| 357 size.height, | 361 size.height, |
| 358 0, | 362 0, |
| 359 GL_RGBA, | 363 GL_RGBA, |
| 360 GL_UNSIGNED_BYTE, | 364 GL_UNSIGNED_BYTE, |
| 361 NULL); | 365 NULL); |
| 362 } | 366 } |
| 367 if (!mailboxes.empty()) |
| 368 gles2_impl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxes[i].name); |
| 363 | 369 |
| 364 textures_.insert( | 370 textures_.insert( |
| 365 std::make_pair(texture_ids[i], Texture(texture_target, size))); | 371 std::make_pair(texture_ids[i], Texture(texture_target, size))); |
| 366 } | 372 } |
| 367 gles2_impl_->Flush(); | 373 gles2_impl_->Flush(); |
| 368 } else { | 374 } else { |
| 369 DCHECK(testing_); | 375 DCHECK(testing_); |
| 370 // Create some fake texture ids so we can test picture handling. | 376 // Create some fake texture ids so we can test picture handling. |
| 371 for (uint32_t i = 0; i < num_textures; ++i) { | 377 for (uint32_t i = 0; i < num_textures; ++i) { |
| 372 texture_ids[i] = i + 1; | 378 texture_ids[i] = i + 1; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 pp_picture->texture_target = it->second.texture_target; | 503 pp_picture->texture_target = it->second.texture_target; |
| 498 pp_picture->texture_size = it->second.size; | 504 pp_picture->texture_size = it->second.size; |
| 499 } else { | 505 } else { |
| 500 NOTREACHED(); | 506 NOTREACHED(); |
| 501 } | 507 } |
| 502 received_pictures_.pop(); | 508 received_pictures_.pop(); |
| 503 } | 509 } |
| 504 | 510 |
| 505 } // namespace proxy | 511 } // namespace proxy |
| 506 } // namespace ppapi | 512 } // namespace ppapi |
| OLD | NEW |