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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP" | 391 DLOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP" |
392 ", caps check failed: 0x" << std::hex << caps.capabilities; | 392 ", caps check failed: 0x" << std::hex << caps.capabilities; |
393 NOTIFY_ERROR(PLATFORM_FAILURE); | 393 NOTIFY_ERROR(PLATFORM_FAILURE); |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 if (!CreateMfcInputBuffers()) | 397 if (!CreateMfcInputBuffers()) |
398 return false; | 398 return false; |
399 | 399 |
400 // MFC output format has to be setup before streaming starts. | 400 // MFC output format has to be setup before streaming starts. |
401 // TODO(hshi): set format back to tiled (V4L2_PIX_FMT_NV12MT_16X16) when we | |
402 // fix the underlying driver/firmware issue. http://crbug.com/303300. | |
403 struct v4l2_format format; | 401 struct v4l2_format format; |
404 memset(&format, 0, sizeof(format)); | 402 memset(&format, 0, sizeof(format)); |
405 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 403 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
406 format.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; | 404 format.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16; |
Ami GONE FROM CHROMIUM
2013/10/28 15:03:41
Does this improve perf?
(why is NV12MT_16x16 bett
sheu
2013/10/28 17:24:49
MT16x16 is a tiled format, and NV12M is plain line
| |
407 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format); | 405 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_S_FMT, &format); |
408 | 406 |
409 // Subscribe to the resolution change event. | 407 // Subscribe to the resolution change event. |
410 struct v4l2_event_subscription sub; | 408 struct v4l2_event_subscription sub; |
411 memset(&sub, 0, sizeof(sub)); | 409 memset(&sub, 0, sizeof(sub)); |
412 sub.type = V4L2_EVENT_RESOLUTION_CHANGE; | 410 sub.type = V4L2_EVENT_RESOLUTION_CHANGE; |
413 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_SUBSCRIBE_EVENT, &sub); | 411 IOCTL_OR_ERROR_RETURN_FALSE(mfc_fd_, VIDIOC_SUBSCRIBE_EVENT, &sub); |
414 | 412 |
415 // Initialize format-specific bits. | 413 // Initialize format-specific bits. |
416 if (video_profile_ >= media::H264PROFILE_MIN && | 414 if (video_profile_ >= media::H264PROFILE_MIN && |
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2106 | 2104 |
2107 bool ExynosVideoDecodeAccelerator::CreateBuffersForFormat( | 2105 bool ExynosVideoDecodeAccelerator::CreateBuffersForFormat( |
2108 const struct v4l2_format& format) { | 2106 const struct v4l2_format& format) { |
2109 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2107 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
2110 CHECK_EQ(format.fmt.pix_mp.num_planes, 2); | 2108 CHECK_EQ(format.fmt.pix_mp.num_planes, 2); |
2111 frame_buffer_size_.SetSize( | 2109 frame_buffer_size_.SetSize( |
2112 format.fmt.pix_mp.width, format.fmt.pix_mp.height); | 2110 format.fmt.pix_mp.width, format.fmt.pix_mp.height); |
2113 mfc_output_buffer_size_[0] = format.fmt.pix_mp.plane_fmt[0].sizeimage; | 2111 mfc_output_buffer_size_[0] = format.fmt.pix_mp.plane_fmt[0].sizeimage; |
2114 mfc_output_buffer_size_[1] = format.fmt.pix_mp.plane_fmt[1].sizeimage; | 2112 mfc_output_buffer_size_[1] = format.fmt.pix_mp.plane_fmt[1].sizeimage; |
2115 mfc_output_buffer_pixelformat_ = format.fmt.pix_mp.pixelformat; | 2113 mfc_output_buffer_pixelformat_ = format.fmt.pix_mp.pixelformat; |
2116 DCHECK_EQ(mfc_output_buffer_pixelformat_, V4L2_PIX_FMT_NV12M); | 2114 DCHECK_EQ(mfc_output_buffer_pixelformat_, V4L2_PIX_FMT_NV12MT_16X16); |
2117 DVLOG(3) << "CreateBuffersForFormat(): new resolution: " | 2115 DVLOG(3) << "CreateBuffersForFormat(): new resolution: " |
2118 << frame_buffer_size_.ToString(); | 2116 << frame_buffer_size_.ToString(); |
2119 | 2117 |
2120 if (!CreateMfcOutputBuffers() || !CreateGscInputBuffers() || | 2118 if (!CreateMfcOutputBuffers() || !CreateGscInputBuffers() || |
2121 !CreateGscOutputBuffers()) | 2119 !CreateGscOutputBuffers()) |
2122 return false; | 2120 return false; |
2123 | 2121 |
2124 return true; | 2122 return true; |
2125 } | 2123 } |
2126 | 2124 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2515 | 2513 |
2516 void ExynosVideoDecodeAccelerator::PictureCleared() { | 2514 void ExynosVideoDecodeAccelerator::PictureCleared() { |
2517 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; | 2515 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; |
2518 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); | 2516 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); |
2519 DCHECK_GT(picture_clearing_count_, 0); | 2517 DCHECK_GT(picture_clearing_count_, 0); |
2520 picture_clearing_count_--; | 2518 picture_clearing_count_--; |
2521 SendPictureReady(); | 2519 SendPictureReady(); |
2522 } | 2520 } |
2523 | 2521 |
2524 } // namespace content | 2522 } // namespace content |
OLD | NEW |