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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 DLOGF(ERROR) << "Could not allocate enough output buffers"; | 1622 DLOGF(ERROR) << "Could not allocate enough output buffers"; |
1623 NOTIFY_ERROR(PLATFORM_FAILURE); | 1623 NOTIFY_ERROR(PLATFORM_FAILURE); |
1624 return; | 1624 return; |
1625 } | 1625 } |
1626 | 1626 |
1627 DCHECK(free_output_buffers_.empty()); | 1627 DCHECK(free_output_buffers_.empty()); |
1628 DCHECK(output_buffer_map_.empty()); | 1628 DCHECK(output_buffer_map_.empty()); |
1629 output_buffer_map_.resize(buffers.size()); | 1629 output_buffer_map_.resize(buffers.size()); |
1630 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { | 1630 for (size_t i = 0; i < output_buffer_map_.size(); ++i) { |
1631 DCHECK(buffers[i].size() == coded_size_); | 1631 DCHECK(buffers[i].size() == coded_size_); |
1632 DCHECK_EQ(1u, buffers[i].service_texture_ids().size()); | |
1633 | 1632 |
1634 OutputRecord& output_record = output_buffer_map_[i]; | 1633 OutputRecord& output_record = output_buffer_map_[i]; |
1635 DCHECK(!output_record.at_device); | 1634 DCHECK(!output_record.at_device); |
1636 DCHECK(!output_record.at_client); | 1635 DCHECK(!output_record.at_client); |
1637 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); | 1636 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); |
1638 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); | 1637 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); |
1639 DCHECK_EQ(output_record.picture_id, -1); | 1638 DCHECK_EQ(output_record.picture_id, -1); |
1640 DCHECK(output_record.dmabuf_fds.empty()); | 1639 DCHECK(output_record.dmabuf_fds.empty()); |
1641 DCHECK_EQ(output_record.cleared, false); | 1640 DCHECK_EQ(output_record.cleared, false); |
1642 | 1641 |
1643 output_record.picture_id = buffers[i].id(); | 1642 output_record.picture_id = buffers[i].id(); |
1644 output_record.texture_id = buffers[i].service_texture_ids()[0]; | 1643 output_record.texture_id = buffers[i].service_texture_ids().empty() |
| 1644 ? 0 |
| 1645 : buffers[i].service_texture_ids()[0]; |
| 1646 |
1645 // This will remain true until ImportBufferForPicture is called, either by | 1647 // This will remain true until ImportBufferForPicture is called, either by |
1646 // the client, or by ourselves, if we are allocating. | 1648 // the client, or by ourselves, if we are allocating. |
1647 output_record.at_client = true; | 1649 output_record.at_client = true; |
1648 if (output_mode_ == Config::OutputMode::ALLOCATE) { | 1650 if (output_mode_ == Config::OutputMode::ALLOCATE) { |
1649 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( | 1651 std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( |
1650 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | 1652 i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
1651 if (dmabuf_fds.empty()) { | 1653 if (dmabuf_fds.empty()) { |
1652 NOTIFY_ERROR(PLATFORM_FAILURE); | 1654 NOTIFY_ERROR(PLATFORM_FAILURE); |
1653 return; | 1655 return; |
1654 } | 1656 } |
(...skipping 20 matching lines...) Expand all Loading... |
1675 | 1677 |
1676 void V4L2SliceVideoDecodeAccelerator::CreateEGLImageFor( | 1678 void V4L2SliceVideoDecodeAccelerator::CreateEGLImageFor( |
1677 size_t buffer_index, | 1679 size_t buffer_index, |
1678 int32_t picture_buffer_id, | 1680 int32_t picture_buffer_id, |
1679 std::unique_ptr<std::vector<base::ScopedFD>> passed_dmabuf_fds, | 1681 std::unique_ptr<std::vector<base::ScopedFD>> passed_dmabuf_fds, |
1680 GLuint texture_id, | 1682 GLuint texture_id, |
1681 const gfx::Size& size, | 1683 const gfx::Size& size, |
1682 uint32_t fourcc) { | 1684 uint32_t fourcc) { |
1683 DVLOGF(3) << "index=" << buffer_index; | 1685 DVLOGF(3) << "index=" << buffer_index; |
1684 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 1686 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 1687 DCHECK_NE(texture_id, 0u); |
1685 | 1688 |
1686 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { | 1689 if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { |
1687 DLOGF(ERROR) << "GL callbacks required for binding to EGLImages"; | 1690 DLOGF(ERROR) << "GL callbacks required for binding to EGLImages"; |
1688 NOTIFY_ERROR(INVALID_ARGUMENT); | 1691 NOTIFY_ERROR(INVALID_ARGUMENT); |
1689 return; | 1692 return; |
1690 } | 1693 } |
1691 | 1694 |
1692 gl::GLContext* gl_context = get_gl_context_cb_.Run(); | 1695 gl::GLContext* gl_context = get_gl_context_cb_.Run(); |
1693 if (!gl_context || !make_context_current_cb_.Run()) { | 1696 if (!gl_context || !make_context_current_cb_.Run()) { |
1694 DLOGF(ERROR) << "No GL context"; | 1697 DLOGF(ERROR) << "No GL context"; |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 3275 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
3273 scoped_refptr<V4L2Device> device = V4L2Device::Create(); | 3276 scoped_refptr<V4L2Device> device = V4L2Device::Create(); |
3274 if (!device) | 3277 if (!device) |
3275 return SupportedProfiles(); | 3278 return SupportedProfiles(); |
3276 | 3279 |
3277 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 3280 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
3278 supported_input_fourccs_); | 3281 supported_input_fourccs_); |
3279 } | 3282 } |
3280 | 3283 |
3281 } // namespace media | 3284 } // namespace media |
OLD | NEW |