Chromium Code Reviews| 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/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 io_message_loop_)); | 334 io_message_loop_)); |
| 335 } | 335 } |
| 336 #endif | 336 #endif |
| 337 return decoder.Pass(); | 337 return decoder.Pass(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 scoped_ptr<media::VideoDecodeAccelerator> | 340 scoped_ptr<media::VideoDecodeAccelerator> |
| 341 GpuVideoDecodeAccelerator::CreateVaapiVDA() { | 341 GpuVideoDecodeAccelerator::CreateVaapiVDA() { |
| 342 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 342 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
| 343 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 343 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 344 decoder.reset(new VaapiVideoDecodeAccelerator(make_context_current_)); | 344 gpu::gles2::GLES2Decoder* command_decoder = stub_->decoder(); |
| 345 gpu::gles2::TextureManager* texture_manager = | |
| 346 command_decoder->GetContextGroup()->texture_manager(); | |
| 347 decoder.reset( | |
| 348 new VaapiVideoDecodeAccelerator(make_context_current_, texture_manager)); | |
| 345 #endif | 349 #endif |
| 346 return decoder.Pass(); | 350 return decoder.Pass(); |
| 347 } | 351 } |
| 348 | 352 |
| 349 scoped_ptr<media::VideoDecodeAccelerator> | 353 scoped_ptr<media::VideoDecodeAccelerator> |
| 350 GpuVideoDecodeAccelerator::CreateVTVDA() { | 354 GpuVideoDecodeAccelerator::CreateVTVDA() { |
| 351 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 355 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
| 352 #if defined(OS_MACOSX) | 356 #if defined(OS_MACOSX) |
| 353 decoder.reset(new VTVideoDecodeAccelerator( | 357 decoder.reset(new VTVideoDecodeAccelerator( |
| 354 static_cast<CGLContextObj>(stub_->decoder()->GetGLContext()->GetHandle()), | 358 static_cast<CGLContextObj>(stub_->decoder()->GetGLContext()->GetHandle()), |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 | 466 |
| 463 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 | 467 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 |
| 464 GLenum format = | 468 GLenum format = |
| 465 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); | 469 video_decode_accelerator_.get()->GetSurfaceInternalFormat(); |
| 466 if (format != GL_RGBA) { | 470 if (format != GL_RGBA) { |
| 467 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, | 471 texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, |
| 468 width, height, 1, 0, format, 0, false); | 472 width, height, 1, 0, format, 0, false); |
| 469 } | 473 } |
| 470 } | 474 } |
| 471 uint32 service_texture_id; | 475 uint32 service_texture_id; |
| 472 if (!command_decoder->GetServiceTextureId( | 476 if (!command_decoder->GetServiceTextureId( |
|
piman
2015/01/21 23:58:22
Unrelated to your patch, but this is not needed an
achaulk
2015/01/22 18:13:47
Done.
| |
| 473 texture_ids[i], &service_texture_id)) { | 477 texture_ids[i], &service_texture_id)) { |
| 474 DLOG(ERROR) << "Failed to translate texture!"; | 478 DLOG(ERROR) << "Failed to translate texture!"; |
| 475 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 479 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 476 return; | 480 return; |
| 477 } | 481 } |
| 478 buffers.push_back(media::PictureBuffer( | 482 buffers.push_back(media::PictureBuffer(buffer_ids[i], texture_dimensions_, |
| 479 buffer_ids[i], texture_dimensions_, service_texture_id)); | 483 service_texture_id, texture_ids[i])); |
|
Pawel Osciak
2015/01/21 13:07:07
Could you please explain the difference between se
achaulk
2015/01/21 17:10:03
texture_id[] is the client-side (browser) texture
piman
2015/01/21 23:58:22
If you have the TextureRef, you can get the servic
achaulk
2015/01/22 18:13:47
Yes, but if I pass only the client ID instead, all
| |
| 480 textures.push_back(texture_ref); | 484 textures.push_back(texture_ref); |
| 481 } | 485 } |
| 482 video_decode_accelerator_->AssignPictureBuffers(buffers); | 486 video_decode_accelerator_->AssignPictureBuffers(buffers); |
| 483 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); | 487 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); |
| 484 for (uint32 i = 0; i < buffer_ids.size(); ++i) | 488 for (uint32 i = 0; i < buffer_ids.size(); ++i) |
| 485 uncleared_textures_[buffer_ids[i]] = textures[i]; | 489 uncleared_textures_[buffer_ids[i]] = textures[i]; |
| 486 } | 490 } |
| 487 | 491 |
| 488 void GpuVideoDecodeAccelerator::OnReusePictureBuffer( | 492 void GpuVideoDecodeAccelerator::OnReusePictureBuffer( |
| 489 int32 picture_buffer_id) { | 493 int32 picture_buffer_id) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 return stub_->channel()->Send(message); | 582 return stub_->channel()->Send(message); |
| 579 } | 583 } |
| 580 | 584 |
| 581 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 585 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 582 bool succeeded) { | 586 bool succeeded) { |
| 583 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 587 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 584 Send(message); | 588 Send(message); |
| 585 } | 589 } |
| 586 | 590 |
| 587 } // namespace content | 591 } // namespace content |
| OLD | NEW |