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

Side by Side Diff: content/common/gpu/media/v4l2_video_decode_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
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 <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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // TODO(posciak): crbug.com/450898. 249 // TODO(posciak): crbug.com/450898.
250 #if defined(ARCH_CPU_ARMEL) 250 #if defined(ARCH_CPU_ARMEL)
251 if (!gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) { 251 if (!gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) {
252 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync"; 252 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync";
253 return false; 253 return false;
254 } 254 }
255 #endif 255 #endif
256 256
257 // Capabilities check. 257 // Capabilities check.
258 struct v4l2_capability caps; 258 struct v4l2_capability caps;
259 const __u32 kCapsRequired = 259 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
260 V4L2_CAP_VIDEO_CAPTURE_MPLANE |
261 V4L2_CAP_VIDEO_OUTPUT_MPLANE |
262 V4L2_CAP_STREAMING;
263 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); 260 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps);
264 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { 261 if ((caps.capabilities & kCapsRequired) != kCapsRequired) {
265 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP" 262 // This cap combination is deprecated, but some older drivers may still be
266 ", caps check failed: 0x" << std::hex << caps.capabilities; 263 // returning it.
267 return false; 264 const __u32 kCapsRequiredCompat = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
265 V4L2_CAP_VIDEO_OUTPUT_MPLANE |
266 V4L2_CAP_STREAMING;
267 if ((caps.capabilities & kCapsRequiredCompat) != kCapsRequiredCompat) {
268 LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP"
269 ", caps check failed: 0x" << std::hex << caps.capabilities;
270 return false;
271 }
268 } 272 }
269 273
270 if (!SetupFormats()) 274 if (!SetupFormats())
271 return false; 275 return false;
272 276
273 // Subscribe to the resolution change event. 277 // Subscribe to the resolution change event.
274 struct v4l2_event_subscription sub; 278 struct v4l2_event_subscription sub;
275 memset(&sub, 0, sizeof(sub)); 279 memset(&sub, 0, sizeof(sub));
276 sub.type = V4L2_EVENT_SOURCE_CHANGE; 280 sub.type = V4L2_EVENT_SOURCE_CHANGE;
277 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_SUBSCRIBE_EVENT, &sub); 281 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_SUBSCRIBE_EVENT, &sub);
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 2048
2045 void V4L2VideoDecodeAccelerator::PictureCleared() { 2049 void V4L2VideoDecodeAccelerator::PictureCleared() {
2046 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_; 2050 DVLOG(3) << "PictureCleared(). clearing count=" << picture_clearing_count_;
2047 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current()); 2051 DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
2048 DCHECK_GT(picture_clearing_count_, 0); 2052 DCHECK_GT(picture_clearing_count_, 0);
2049 picture_clearing_count_--; 2053 picture_clearing_count_--;
2050 SendPictureReady(); 2054 SendPictureReady();
2051 } 2055 }
2052 2056
2053 } // namespace content 2057 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698