| 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 <dlfcn.h> | 5 #include <dlfcn.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
| 9 #include <poll.h> | 9 #include <poll.h> |
| 10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP" | 376 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP" |
| 377 ", caps check failed: 0x" << std::hex << caps.capabilities; | 377 ", caps check failed: 0x" << std::hex << caps.capabilities; |
| 378 NOTIFY_ERROR(PLATFORM_FAILURE); | 378 NOTIFY_ERROR(PLATFORM_FAILURE); |
| 379 return false; | 379 return false; |
| 380 } | 380 } |
| 381 | 381 |
| 382 if (!CreateMfcInputBuffers()) | 382 if (!CreateMfcInputBuffers()) |
| 383 return false; | 383 return false; |
| 384 | 384 |
| 385 // MFC output format has to be setup before streaming starts. | 385 // MFC output format has to be setup before streaming starts. |
| 386 // TODO(hshi): set format back to tiled (V4L2_PIX_FMT_NV12MT_16X16) when we |
| 387 // fix the underlying driver/firmware issue. http://crbug.com/303300. |
| 386 struct v4l2_format format; | 388 struct v4l2_format format; |
| 387 memset(&format, 0, sizeof(format)); | 389 memset(&format, 0, sizeof(format)); |
| 388 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 390 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 389 format.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16; | 391 format.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; |
| 390 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format); | 392 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format); |
| 391 | 393 |
| 392 // Subscribe to the resolution change event. | 394 // Subscribe to the resolution change event. |
| 393 struct v4l2_event_subscription sub; | 395 struct v4l2_event_subscription sub; |
| 394 memset(&sub, 0, sizeof(sub)); | 396 memset(&sub, 0, sizeof(sub)); |
| 395 sub.type = V4L2_EVENT_RESOLUTION_CHANGE; | 397 sub.type = V4L2_EVENT_RESOLUTION_CHANGE; |
| 396 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_SUBSCRIBE_EVENT, &sub); | 398 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_SUBSCRIBE_EVENT, &sub); |
| 397 | 399 |
| 398 // Initialize format-specific bits. | 400 // Initialize format-specific bits. |
| 399 if (video_profile_ >= media::H264PROFILE_MIN && | 401 if (video_profile_ >= media::H264PROFILE_MIN && |
| (...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 | 2086 |
| 2085 bool ExynosVideoDecodeAccelerator::CreateBuffersForFormat( | 2087 bool ExynosVideoDecodeAccelerator::CreateBuffersForFormat( |
| 2086 const struct v4l2_format& format) { | 2088 const struct v4l2_format& format) { |
| 2087 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2089 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
| 2088 CHECK_EQ(format.fmt.pix_mp.num_planes, 2); | 2090 CHECK_EQ(format.fmt.pix_mp.num_planes, 2); |
| 2089 frame_buffer_size_.SetSize( | 2091 frame_buffer_size_.SetSize( |
| 2090 format.fmt.pix_mp.width, format.fmt.pix_mp.height); | 2092 format.fmt.pix_mp.width, format.fmt.pix_mp.height); |
| 2091 mfc_output_buffer_size_[0] = format.fmt.pix_mp.plane_fmt[0].sizeimage; | 2093 mfc_output_buffer_size_[0] = format.fmt.pix_mp.plane_fmt[0].sizeimage; |
| 2092 mfc_output_buffer_size_[1] = format.fmt.pix_mp.plane_fmt[1].sizeimage; | 2094 mfc_output_buffer_size_[1] = format.fmt.pix_mp.plane_fmt[1].sizeimage; |
| 2093 mfc_output_buffer_pixelformat_ = format.fmt.pix_mp.pixelformat; | 2095 mfc_output_buffer_pixelformat_ = format.fmt.pix_mp.pixelformat; |
| 2094 DCHECK_EQ(mfc_output_buffer_pixelformat_, V4L2_PIX_FMT_NV12MT_16X16); | 2096 DCHECK_EQ(mfc_output_buffer_pixelformat_, V4L2_PIX_FMT_NV12M); |
| 2095 DVLOG(3) << "CreateBuffersForFormat(): new resolution: " | 2097 DVLOG(3) << "CreateBuffersForFormat(): new resolution: " |
| 2096 << frame_buffer_size_.ToString(); | 2098 << frame_buffer_size_.ToString(); |
| 2097 | 2099 |
| 2098 if (!CreateMfcOutputBuffers() || !CreateGscInputBuffers() || | 2100 if (!CreateMfcOutputBuffers() || !CreateGscInputBuffers() || |
| 2099 !CreateGscOutputBuffers()) | 2101 !CreateGscOutputBuffers()) |
| 2100 return false; | 2102 return false; |
| 2101 | 2103 |
| 2102 return true; | 2104 return true; |
| 2103 } | 2105 } |
| 2104 | 2106 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2444 DestroyGscOutputBuffers(); | 2446 DestroyGscOutputBuffers(); |
| 2445 DestroyMfcOutputBuffers(); | 2447 DestroyMfcOutputBuffers(); |
| 2446 | 2448 |
| 2447 // Finish resolution change on decoder thread. | 2449 // Finish resolution change on decoder thread. |
| 2448 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 2450 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
| 2449 &ExynosVideoDecodeAccelerator::FinishResolutionChange, | 2451 &ExynosVideoDecodeAccelerator::FinishResolutionChange, |
| 2450 base::Unretained(this))); | 2452 base::Unretained(this))); |
| 2451 } | 2453 } |
| 2452 | 2454 |
| 2453 } // namespace content | 2455 } // namespace content |
| OLD | NEW |