Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/common/gpu/media/v4l2_video_encode_accelerator.cc

Issue 1554543002: v4l2 accelerators: use V4L2_CAP_VIDEO_M2M_MPLANE capability. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <fcntl.h> 5 #include <fcntl.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <poll.h> 7 #include <poll.h>
8 #include <sys/eventfd.h> 8 #include <sys/eventfd.h>
9 #include <sys/ioctl.h> 9 #include <sys/ioctl.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 visible_size_ = input_visible_size; 113 visible_size_ = input_visible_size;
114 114
115 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 115 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
116 client_ = client_ptr_factory_->GetWeakPtr(); 116 client_ = client_ptr_factory_->GetWeakPtr();
117 117
118 DCHECK(child_task_runner_->BelongsToCurrentThread()); 118 DCHECK(child_task_runner_->BelongsToCurrentThread());
119 DCHECK_EQ(encoder_state_, kUninitialized); 119 DCHECK_EQ(encoder_state_, kUninitialized);
120 120
121 struct v4l2_capability caps; 121 struct v4l2_capability caps;
122 memset(&caps, 0, sizeof(caps)); 122 memset(&caps, 0, sizeof(caps));
123 const __u32 kCapsRequired = V4L2_CAP_VIDEO_CAPTURE_MPLANE | 123 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
124 V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING;
125 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); 124 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps);
126 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { 125 if ((caps.capabilities & kCapsRequired) != kCapsRequired) {
127 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: " 126 // This cap combination is deprecated, but some older drivers may still be
128 "caps check failed: 0x" << std::hex << caps.capabilities; 127 // returning it.
129 return false; 128 const __u32 kCapsRequiredCompat = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
129 V4L2_CAP_VIDEO_OUTPUT_MPLANE |
130 V4L2_CAP_STREAMING;
131 if ((caps.capabilities & kCapsRequiredCompat) != kCapsRequiredCompat) {
132 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: "
133 "caps check failed: 0x" << std::hex << caps.capabilities;
134 return false;
135 }
130 } 136 }
131 137
132 if (!SetFormats(input_format, output_profile)) { 138 if (!SetFormats(input_format, output_profile)) {
133 LOG(ERROR) << "Failed setting up formats"; 139 LOG(ERROR) << "Failed setting up formats";
134 return false; 140 return false;
135 } 141 }
136 142
137 if (input_format != device_input_format_) { 143 if (input_format != device_input_format_) {
138 DVLOG(1) << "Input format not supported by the HW, will convert to " 144 DVLOG(1) << "Input format not supported by the HW, will convert to "
139 << media::VideoPixelFormatToString(device_input_format_); 145 << media::VideoPixelFormatToString(device_input_format_);
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 reqbufs.count = 0; 1163 reqbufs.count = 0;
1158 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1164 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1159 reqbufs.memory = V4L2_MEMORY_MMAP; 1165 reqbufs.memory = V4L2_MEMORY_MMAP;
1160 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1166 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1161 1167
1162 output_buffer_map_.clear(); 1168 output_buffer_map_.clear();
1163 free_output_buffers_.clear(); 1169 free_output_buffers_.clear();
1164 } 1170 }
1165 1171
1166 } // namespace content 1172 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698