OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/v4l2_slice_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
10 #include <poll.h> | 10 #include <poll.h> |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 return false; | 492 return false; |
493 } | 493 } |
494 | 494 |
495 // We need the context to be initialized to query extensions. | 495 // We need the context to be initialized to query extensions. |
496 if (!make_context_current_cb_.is_null()) { | 496 if (!make_context_current_cb_.is_null()) { |
497 if (!make_context_current_cb_.Run()) { | 497 if (!make_context_current_cb_.Run()) { |
498 LOG(ERROR) << "Initialize(): could not make context current"; | 498 LOG(ERROR) << "Initialize(): could not make context current"; |
499 return false; | 499 return false; |
500 } | 500 } |
501 | 501 |
502 if (!gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) { | 502 if (!gl::g_driver_egl.ext.b_EGL_KHR_fence_sync) { |
503 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync"; | 503 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync"; |
504 return false; | 504 return false; |
505 } | 505 } |
506 } else { | 506 } else { |
507 DVLOG(1) << "No GL callbacks provided, initializing without GL support"; | 507 DVLOG(1) << "No GL callbacks provided, initializing without GL support"; |
508 } | 508 } |
509 | 509 |
510 // Capabilities check. | 510 // Capabilities check. |
511 struct v4l2_capability caps; | 511 struct v4l2_capability caps; |
512 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; | 512 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 uint32_t fourcc) { | 1588 uint32_t fourcc) { |
1589 DVLOGF(3) << "index=" << buffer_index; | 1589 DVLOGF(3) << "index=" << buffer_index; |
1590 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 1590 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
1591 | 1591 |
1592 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { | 1592 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { |
1593 DLOG(ERROR) << "GL callbacks required for binding to EGLImages"; | 1593 DLOG(ERROR) << "GL callbacks required for binding to EGLImages"; |
1594 NOTIFY_ERROR(INVALID_ARGUMENT); | 1594 NOTIFY_ERROR(INVALID_ARGUMENT); |
1595 return; | 1595 return; |
1596 } | 1596 } |
1597 | 1597 |
1598 gfx::GLContext* gl_context = get_gl_context_cb_.Run(); | 1598 gl::GLContext* gl_context = get_gl_context_cb_.Run(); |
1599 if (!gl_context || !make_context_current_cb_.Run()) { | 1599 if (!gl_context || !make_context_current_cb_.Run()) { |
1600 DLOG(ERROR) << "No GL context"; | 1600 DLOG(ERROR) << "No GL context"; |
1601 NOTIFY_ERROR(PLATFORM_FAILURE); | 1601 NOTIFY_ERROR(PLATFORM_FAILURE); |
1602 return; | 1602 return; |
1603 } | 1603 } |
1604 | 1604 |
1605 gfx::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); | 1605 gl::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); |
1606 | 1606 |
1607 EGLImageKHR egl_image = | 1607 EGLImageKHR egl_image = |
1608 device_->CreateEGLImage(egl_display_, gl_context->GetHandle(), texture_id, | 1608 device_->CreateEGLImage(egl_display_, gl_context->GetHandle(), texture_id, |
1609 size, buffer_index, fourcc, *passed_dmabuf_fds); | 1609 size, buffer_index, fourcc, *passed_dmabuf_fds); |
1610 if (egl_image == EGL_NO_IMAGE_KHR) { | 1610 if (egl_image == EGL_NO_IMAGE_KHR) { |
1611 LOGF(ERROR) << "Could not create EGLImageKHR," | 1611 LOGF(ERROR) << "Could not create EGLImageKHR," |
1612 << " index=" << buffer_index << " texture_id=" << texture_id; | 1612 << " index=" << buffer_index << " texture_id=" << texture_id; |
1613 NOTIFY_ERROR(PLATFORM_FAILURE); | 1613 NOTIFY_ERROR(PLATFORM_FAILURE); |
1614 return; | 1614 return; |
1615 } | 1615 } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2801 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
2802 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2802 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
2803 if (!device) | 2803 if (!device) |
2804 return SupportedProfiles(); | 2804 return SupportedProfiles(); |
2805 | 2805 |
2806 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2806 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
2807 supported_input_fourccs_); | 2807 supported_input_fourccs_); |
2808 } | 2808 } |
2809 | 2809 |
2810 } // namespace media | 2810 } // namespace media |
OLD | NEW |