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

Side by Side Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2958213002: V4L2 VDA/VEA: Use VIDIOC_G/S_SELECTION for accelerators (Closed)
Patch Set: Created 3 years, 5 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 "media/gpu/v4l2_video_decode_accelerator.h" 5 #include "media/gpu/v4l2_video_decode_accelerator.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <linux/videodev2.h> 10 #include <linux/videodev2.h>
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 << ", EGLImage size: " << egl_image_size_.ToString() 2103 << ", EGLImage size: " << egl_image_size_.ToString()
2104 << ", EGLImage plane count: " << egl_image_planes_count_; 2104 << ", EGLImage plane count: " << egl_image_planes_count_;
2105 2105
2106 return CreateOutputBuffers(); 2106 return CreateOutputBuffers();
2107 } 2107 }
2108 2108
2109 gfx::Size V4L2VideoDecodeAccelerator::GetVisibleSize( 2109 gfx::Size V4L2VideoDecodeAccelerator::GetVisibleSize(
2110 const gfx::Size& coded_size) { 2110 const gfx::Size& coded_size) {
2111 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); 2111 DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
2112 2112
2113 struct v4l2_crop crop_arg; 2113 struct v4l2_rect* ioctl_rect = NULL;
wuchengli 2017/06/29 07:55:22 s/ioctl_rect/visible_rect/. It's more readable.
2114 memset(&crop_arg, 0, sizeof(crop_arg)); 2114 struct v4l2_selection selection_arg;
2115 crop_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 2115 memset(&selection_arg, 0, sizeof(selection_arg));
2116 selection_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2117 selection_arg.target = V4L2_SEL_TGT_COMPOSE;
2116 2118
2117 if (device_->Ioctl(VIDIOC_G_CROP, &crop_arg) != 0) { 2119 if (device_->Ioctl(VIDIOC_G_SELECTION, &selection_arg) == 0) {
2118 PLOGF(ERROR) << "ioctl() VIDIOC_G_CROP failed"; 2120 ioctl_rect = &selection_arg.r;
2119 return coded_size;
2120 } 2121 }
wuchengli 2017/06/29 07:55:22 if (device_->Ioctl(VIDIOC_G_SELECTION, &selection_
2121 2122
2122 gfx::Rect rect(crop_arg.c.left, crop_arg.c.top, crop_arg.c.width, 2123 if (ioctl_rect == NULL) {
2123 crop_arg.c.height); 2124 VLOGF(2) << "Fallback to VIDIOC_G_CROP";
2125 struct v4l2_crop crop_arg;
2126 memset(&crop_arg, 0, sizeof(crop_arg));
2127 crop_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
2128
2129 if (device_->Ioctl(VIDIOC_G_CROP, &crop_arg) != 0) {
2130 PLOGF(ERROR) << "ioctl() VIDIOC_G_CROP failed";
2131 return coded_size;
2132 }
2133 ioctl_rect = &crop_arg.c;
2134 }
2135
2136 gfx::Rect rect(ioctl_rect->left, ioctl_rect->top, ioctl_rect->width,
2137 ioctl_rect->height);
2124 VLOGF(2) << "visible rectangle is " << rect.ToString(); 2138 VLOGF(2) << "visible rectangle is " << rect.ToString();
2125 if (!gfx::Rect(coded_size).Contains(rect)) { 2139 if (!gfx::Rect(coded_size).Contains(rect)) {
2126 DLOGF(ERROR) << "visible rectangle " << rect.ToString() 2140 DLOGF(ERROR) << "visible rectangle " << rect.ToString()
2127 << " is not inside coded size " << coded_size.ToString(); 2141 << " is not inside coded size " << coded_size.ToString();
2128 return coded_size; 2142 return coded_size;
2129 } 2143 }
2130 if (rect.IsEmpty()) { 2144 if (rect.IsEmpty()) {
2131 DLOGF(ERROR) << "visible size is empty"; 2145 DLOGF(ERROR) << "visible size is empty";
2132 return coded_size; 2146 return coded_size;
2133 } 2147 }
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 StartResolutionChange(); 2654 StartResolutionChange();
2641 } 2655 }
2642 } 2656 }
2643 2657
2644 void V4L2VideoDecodeAccelerator::ImageProcessorError() { 2658 void V4L2VideoDecodeAccelerator::ImageProcessorError() {
2645 LOGF(ERROR) << "Image processor error"; 2659 LOGF(ERROR) << "Image processor error";
2646 NOTIFY_ERROR(PLATFORM_FAILURE); 2660 NOTIFY_ERROR(PLATFORM_FAILURE);
2647 } 2661 }
2648 2662
2649 } // namespace media 2663 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/gpu/v4l2_video_encode_accelerator.cc » ('j') | media/gpu/v4l2_video_encode_accelerator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698