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

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

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to GetSupportedProfile Created 5 years, 9 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 DestroyInputBuffers(); 200 DestroyInputBuffers();
201 DestroyOutputBuffers(); 201 DestroyOutputBuffers();
202 202
203 // These maps have members that should be manually destroyed, e.g. file 203 // These maps have members that should be manually destroyed, e.g. file
204 // descriptors, mmap() segments, etc. 204 // descriptors, mmap() segments, etc.
205 DCHECK(input_buffer_map_.empty()); 205 DCHECK(input_buffer_map_.empty());
206 DCHECK(output_buffer_map_.empty()); 206 DCHECK(output_buffer_map_.empty());
207 } 207 }
208 208
209 // static
210 std::vector<media::VideoDecodeAccelerator::SupportedProfile>
211 V4L2VideoDecodeAccelerator::GetSupportedProfiles() {
212 std::vector<SupportedProfile> profiles;
213 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
214 if (!device)
215 return profiles;
216
217 SupportedProfile profile;
218 profile.support_query_profile = true;
219 profile.min_resolution.SetSize(16, 16);
220 // NOTE: additional autodetection logic may require updating input buffer size
221 // selection.
222 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
223 switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode))
224 profile.max_resolution.SetSize(4096, 2160);
225 else
226 profile.max_resolution.SetSize(1920, 1088);
227
228 v4l2_fmtdesc fmtdesc;
229 memset(&fmtdesc, 0, sizeof(fmtdesc));
230 fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
231 for (; device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0; ++fmtdesc.index) {
232 switch (fmtdesc.pixelformat) {
233 case V4L2_PIX_FMT_H264:
234 profile.profile = media::H264PROFILE_MAIN;
235 profiles.push_back(profile);
236 break;
237 case V4L2_PIX_FMT_VP8:
wuchengli 2015/03/16 02:53:20 Need VP9.
henryhsu 2015/03/16 08:31:17 Done.
238 profile.profile = media::VP8PROFILE_ANY;
239 profiles.push_back(profile);
240 break;
241 }
242 }
243
244 return profiles;
245 }
246
209 bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, 247 bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
210 Client* client) { 248 Client* client) {
211 DVLOG(3) << "Initialize()"; 249 DVLOG(3) << "Initialize()";
212 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); 250 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
213 DCHECK_EQ(decoder_state_, kUninitialized); 251 DCHECK_EQ(decoder_state_, kUninitialized);
214 252
215 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); 253 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
216 client_ = client_ptr_factory_->GetWeakPtr(); 254 client_ = client_ptr_factory_->GetWeakPtr();
217 255
218 switch (profile) { 256 switch (profile) {
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 gfx::Size new_coded_size(base::checked_cast<int>(format.fmt.pix_mp.width), 2050 gfx::Size new_coded_size(base::checked_cast<int>(format.fmt.pix_mp.width),
2013 base::checked_cast<int>(format.fmt.pix_mp.height)); 2051 base::checked_cast<int>(format.fmt.pix_mp.height));
2014 if (coded_size_ != new_coded_size) { 2052 if (coded_size_ != new_coded_size) {
2015 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected"; 2053 DVLOG(3) << "IsResolutionChangeNecessary(): Resolution change detected";
2016 return true; 2054 return true;
2017 } 2055 }
2018 return false; 2056 return false;
2019 } 2057 }
2020 2058
2021 } // namespace content 2059 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698