OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/gpu/dxva_picture_buffer_win.h" | 5 #include "media/gpu/dxva_picture_buffer_win.h" |
6 | 6 |
7 #include "media/gpu/dxva_video_decode_accelerator_win.h" | 7 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
8 #include "third_party/angle/include/EGL/egl.h" | 8 #include "third_party/angle/include/EGL/egl.h" |
9 #include "third_party/angle/include/EGL/eglext.h" | 9 #include "third_party/angle/include/EGL/eglext.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE, subresource, EGL_NONE, | 523 EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE, subresource, EGL_NONE, |
524 }; | 524 }; |
525 | 525 |
526 EGLBoolean result = eglStreamPostD3DTextureNV12ANGLE( | 526 EGLBoolean result = eglStreamPostD3DTextureNV12ANGLE( |
527 egl_display, stream_, static_cast<void*>(dx11_decoding_texture_.Get()), | 527 egl_display, stream_, static_cast<void*>(dx11_decoding_texture_.Get()), |
528 frame_attributes); | 528 frame_attributes); |
529 RETURN_ON_FAILURE(result, "Could not post texture", false); | 529 RETURN_ON_FAILURE(result, "Could not post texture", false); |
530 result = eglStreamConsumerAcquireKHR(egl_display, stream_); | 530 result = eglStreamConsumerAcquireKHR(egl_display, stream_); |
531 RETURN_ON_FAILURE(result, "Could not post acquire stream", false); | 531 RETURN_ON_FAILURE(result, "Could not post acquire stream", false); |
532 gl::GLImageDXGI* gl_image_dxgi = | 532 gl::GLImageDXGI* gl_image_dxgi = |
533 static_cast<gl::GLImageDXGI*>(gl_image_.get()); | 533 gl::GLImageDXGI::FromGLImage(gl_image_.get()); |
534 DCHECK(gl_image_dxgi); | 534 DCHECK(gl_image_dxgi); |
535 | 535 |
536 gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); | 536 gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); |
537 return true; | 537 return true; |
538 } | 538 } |
539 | 539 |
540 bool EGLStreamPictureBuffer::AllowOverlay() const { | 540 bool EGLStreamPictureBuffer::AllowOverlay() const { |
541 return true; | 541 return true; |
542 } | 542 } |
543 | 543 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 RETURN_ON_HR_FAILURE(hr, "Failed to get texture from output sample", false); | 639 RETURN_ON_HR_FAILURE(hr, "Failed to get texture from output sample", false); |
640 UINT subresource; | 640 UINT subresource; |
641 dxgi_buffer->GetSubresourceIndex(&subresource); | 641 dxgi_buffer->GetSubresourceIndex(&subresource); |
642 if (!decoder->InitializeID3D11VideoProcessor(size().width(), size().height(), | 642 if (!decoder->InitializeID3D11VideoProcessor(size().width(), size().height(), |
643 color_space_)) | 643 color_space_)) |
644 return false; | 644 return false; |
645 | 645 |
646 DCHECK(decoder->d3d11_processor_); | 646 DCHECK(decoder->d3d11_processor_); |
647 DCHECK(decoder->enumerator_); | 647 DCHECK(decoder->enumerator_); |
648 | 648 |
649 gl::CopyingGLImageDXGI* gl_image_dxgi = | 649 gl::GLImageDXGI* gl_image_dxgi = |
650 static_cast<gl::CopyingGLImageDXGI*>(gl_image_.get()); | 650 gl::GLImageDXGI::FromGLImage(gl_image_.get()); |
651 DCHECK(gl_image_dxgi); | 651 DCHECK(gl_image_dxgi); |
652 | 652 |
653 gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); | 653 gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); |
654 return gl_image_dxgi->InitializeVideoProcessor(decoder->d3d11_processor_, | 654 return static_cast<gl::CopyingGLImageDXGI*>(gl_image_dxgi) |
655 decoder->enumerator_); | 655 ->InitializeVideoProcessor(decoder->d3d11_processor_, |
| 656 decoder->enumerator_); |
656 } | 657 } |
657 | 658 |
658 bool EGLStreamDelayedCopyPictureBuffer::AllowOverlay() const { | 659 bool EGLStreamDelayedCopyPictureBuffer::AllowOverlay() const { |
659 return true; | 660 return true; |
660 } | 661 } |
661 | 662 |
662 bool EGLStreamDelayedCopyPictureBuffer::CanBindSamples() const { | 663 bool EGLStreamDelayedCopyPictureBuffer::CanBindSamples() const { |
663 return true; | 664 return true; |
664 } | 665 } |
665 | 666 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 | 795 |
795 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); | 796 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); |
796 | 797 |
797 EGLBoolean result = eglStreamPostD3DTextureNV12ANGLE( | 798 EGLBoolean result = eglStreamPostD3DTextureNV12ANGLE( |
798 egl_display, stream_, static_cast<void*>(angle_copy_texture_.Get()), | 799 egl_display, stream_, static_cast<void*>(angle_copy_texture_.Get()), |
799 frame_attributes); | 800 frame_attributes); |
800 RETURN_ON_FAILURE(result, "Could not post stream", false); | 801 RETURN_ON_FAILURE(result, "Could not post stream", false); |
801 result = eglStreamConsumerAcquireKHR(egl_display, stream_); | 802 result = eglStreamConsumerAcquireKHR(egl_display, stream_); |
802 RETURN_ON_FAILURE(result, "Could not post acquire stream", false); | 803 RETURN_ON_FAILURE(result, "Could not post acquire stream", false); |
803 gl::GLImageDXGI* gl_image_dxgi = | 804 gl::GLImageDXGI* gl_image_dxgi = |
804 static_cast<gl::GLImageDXGI*>(gl_image_.get()); | 805 gl::GLImageDXGI::FromGLImage(gl_image_.get()); |
805 DCHECK(gl_image_dxgi); | 806 DCHECK(gl_image_dxgi); |
806 | 807 |
807 gl_image_dxgi->SetTexture(angle_copy_texture_, 0); | 808 gl_image_dxgi->SetTexture(angle_copy_texture_, 0); |
808 | 809 |
809 return true; | 810 return true; |
810 } | 811 } |
811 | 812 |
812 bool EGLStreamCopyPictureBuffer::ReusePictureBuffer() { | 813 bool EGLStreamCopyPictureBuffer::ReusePictureBuffer() { |
813 DCHECK_NE(UNUSED, state_); | 814 DCHECK_NE(UNUSED, state_); |
814 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); | 815 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); |
(...skipping 13 matching lines...) Expand all Loading... |
828 | 829 |
829 bool EGLStreamCopyPictureBuffer::AllowOverlay() const { | 830 bool EGLStreamCopyPictureBuffer::AllowOverlay() const { |
830 return true; | 831 return true; |
831 } | 832 } |
832 | 833 |
833 bool EGLStreamCopyPictureBuffer::CanBindSamples() const { | 834 bool EGLStreamCopyPictureBuffer::CanBindSamples() const { |
834 return false; | 835 return false; |
835 } | 836 } |
836 | 837 |
837 } // namespace media | 838 } // namespace media |
OLD | NEW |