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

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: Remove fallback in slice VDA and image processor Created 4 years, 12 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
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 const __u32 kCapsRequiredCompat = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
128 "caps check failed: 0x" << std::hex << caps.capabilities; 127 V4L2_CAP_VIDEO_OUTPUT_MPLANE |
129 return false; 128 V4L2_CAP_STREAMING;
129 if ((caps.capabilities & kCapsRequiredCompat) != kCapsRequiredCompat) {
130 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: "
131 "caps check failed: 0x" << std::hex << caps.capabilities;
132 return false;
133 }
130 } 134 }
131 135
132 if (!SetFormats(input_format, output_profile)) { 136 if (!SetFormats(input_format, output_profile)) {
133 LOG(ERROR) << "Failed setting up formats"; 137 LOG(ERROR) << "Failed setting up formats";
134 return false; 138 return false;
135 } 139 }
136 140
137 if (input_format != device_input_format_) { 141 if (input_format != device_input_format_) {
138 DVLOG(1) << "Input format not supported by the HW, will convert to " 142 DVLOG(1) << "Input format not supported by the HW, will convert to "
139 << media::VideoPixelFormatToString(device_input_format_); 143 << media::VideoPixelFormatToString(device_input_format_);
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 reqbufs.count = 0; 1161 reqbufs.count = 0;
1158 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1162 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1159 reqbufs.memory = V4L2_MEMORY_MMAP; 1163 reqbufs.memory = V4L2_MEMORY_MMAP;
1160 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1164 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1161 1165
1162 output_buffer_map_.clear(); 1166 output_buffer_map_.clear();
1163 free_output_buffers_.clear(); 1167 free_output_buffers_.clear();
1164 } 1168 }
1165 1169
1166 } // namespace content 1170 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698