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

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

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove CONTENT_EXPORT for gpu_video_accelerator_util Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/common/gpu/media/vaapi_wrapper.h" 5 #include "content/common/gpu/media/vaapi_wrapper.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 CodecMode mode, 160 CodecMode mode,
161 media::VideoCodecProfile profile, 161 media::VideoCodecProfile profile,
162 const base::Closure& report_error_to_uma_cb) { 162 const base::Closure& report_error_to_uma_cb) {
163 VAProfile va_profile = ProfileToVAProfile(profile, mode); 163 VAProfile va_profile = ProfileToVAProfile(profile, mode);
164 scoped_ptr<VaapiWrapper> vaapi_wrapper = 164 scoped_ptr<VaapiWrapper> vaapi_wrapper =
165 Create(mode, va_profile, report_error_to_uma_cb); 165 Create(mode, va_profile, report_error_to_uma_cb);
166 return vaapi_wrapper.Pass(); 166 return vaapi_wrapper.Pass();
167 } 167 }
168 168
169 // static 169 // static
170 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 170 media::VideoEncodeAccelerator::SupportedProfiles
171 VaapiWrapper::GetSupportedEncodeProfiles() { 171 VaapiWrapper::GetSupportedEncodeProfiles() {
172 std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles; 172 media::VideoEncodeAccelerator::SupportedProfiles profiles;
173 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 173 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
174 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) 174 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode))
175 return profiles; 175 return profiles;
176 176
177 std::vector<ProfileInfo> encode_profile_infos = 177 std::vector<ProfileInfo> encode_profile_infos =
178 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kEncode); 178 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kEncode);
179 179
180 for (size_t i = 0; i < arraysize(kProfileMap); ++i) { 180 for (size_t i = 0; i < arraysize(kProfileMap); ++i) {
181 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kEncode); 181 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kEncode);
182 if (va_profile == VAProfileNone) 182 if (va_profile == VAProfileNone)
183 continue; 183 continue;
184 for (const auto& profile_info : encode_profile_infos) { 184 for (const auto& profile_info : encode_profile_infos) {
185 if (profile_info.va_profile == va_profile) { 185 if (profile_info.va_profile == va_profile) {
186 media::VideoEncodeAccelerator::SupportedProfile profile; 186 media::VideoEncodeAccelerator::SupportedProfile profile;
187 profile.profile = kProfileMap[i].profile; 187 profile.profile = kProfileMap[i].profile;
188 profile.max_resolution = profile_info.max_resolution; 188 profile.max_resolution = profile_info.max_resolution;
189 profile.max_framerate_numerator = kMaxEncoderFramerate; 189 profile.max_framerate_numerator = kMaxEncoderFramerate;
190 profile.max_framerate_denominator = 1; 190 profile.max_framerate_denominator = 1;
191 profiles.push_back(profile); 191 profiles.push_back(profile);
192 break; 192 break;
193 } 193 }
194 } 194 }
195 } 195 }
196 return profiles; 196 return profiles;
197 } 197 }
198 198
199 // static
200 media::VideoDecodeAccelerator::SupportedProfiles
201 VaapiWrapper::GetSupportedDecodeProfiles() {
202 media::VideoDecodeAccelerator::SupportedProfiles profiles;
203 std::vector<ProfileInfo> decode_profile_infos =
204 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kDecode);
205
206 for (size_t i = 0; i < arraysize(kProfileMap); ++i) {
207 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kDecode);
208 if (va_profile == VAProfileNone)
209 continue;
210 for (const auto& profile_info : decode_profile_infos) {
211 if (profile_info.va_profile == va_profile) {
212 media::VideoDecodeAccelerator::SupportedProfile profile;
213 profile.profile = kProfileMap[i].profile;
214 profile.max_resolution = profile_info.max_resolution;
215 profile.min_resolution.SetSize(16, 16);
216 profiles.push_back(profile);
217 break;
218 }
219 }
220 }
221 return profiles;
222 }
223
199 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() { 224 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() {
200 base::AutoLock auto_lock(va_lock_); 225 base::AutoLock auto_lock(va_lock_);
201 VADisplayAttribute item = {VADisplayAttribRenderMode, 226 VADisplayAttribute item = {VADisplayAttribRenderMode,
202 1, // At least support '_LOCAL_OVERLAY'. 227 1, // At least support '_LOCAL_OVERLAY'.
203 -1, // The maximum possible support 'ALL'. 228 -1, // The maximum possible support 'ALL'.
204 VA_RENDER_MODE_LOCAL_GPU, 229 VA_RENDER_MODE_LOCAL_GPU,
205 VA_DISPLAY_ATTRIB_SETTABLE}; 230 VA_DISPLAY_ATTRIB_SETTABLE};
206 231
207 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1); 232 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1);
208 if (va_res != VA_STATUS_SUCCESS) 233 if (va_res != VA_STATUS_SUCCESS)
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported( 1079 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported(
1055 CodecMode mode, VAProfile va_profile) { 1080 CodecMode mode, VAProfile va_profile) {
1056 for (const auto& profile : supported_profiles_[mode]) { 1081 for (const auto& profile : supported_profiles_[mode]) {
1057 if (profile.va_profile == va_profile) 1082 if (profile.va_profile == va_profile)
1058 return true; 1083 return true;
1059 } 1084 }
1060 return false; 1085 return false;
1061 } 1086 }
1062 1087
1063 } // namespace content 1088 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698