OLD | NEW |
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 profile.max_framerate_numerator = kMaxEncoderFramerate; | 192 profile.max_framerate_numerator = kMaxEncoderFramerate; |
193 profile.max_framerate_denominator = 1; | 193 profile.max_framerate_denominator = 1; |
194 profiles.push_back(profile); | 194 profiles.push_back(profile); |
195 break; | 195 break; |
196 } | 196 } |
197 } | 197 } |
198 } | 198 } |
199 return profiles; | 199 return profiles; |
200 } | 200 } |
201 | 201 |
| 202 // static |
| 203 std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 204 VaapiWrapper::GetSupportedDecodeProfiles() { |
| 205 std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
| 206 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 207 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
| 208 return profiles; |
| 209 |
| 210 std::vector<ProfileInfo> decode_profile_infos = |
| 211 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kDecode); |
| 212 |
| 213 for (size_t i = 0; i < arraysize(kProfileMap); ++i) { |
| 214 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kDecode); |
| 215 if (va_profile == VAProfileNone) |
| 216 continue; |
| 217 for (const auto& profile_info : decode_profile_infos) { |
| 218 if (profile_info.va_profile == va_profile) { |
| 219 media::VideoDecodeAccelerator::SupportedProfile profile; |
| 220 profile.profile = kProfileMap[i].profile; |
| 221 profile.max_resolution = profile_info.max_resolution; |
| 222 profile.min_resolution.SetSize(16, 16); |
| 223 profiles.push_back(profile); |
| 224 break; |
| 225 } |
| 226 } |
| 227 } |
| 228 return profiles; |
| 229 } |
| 230 |
202 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() { | 231 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() { |
203 base::AutoLock auto_lock(va_lock_); | 232 base::AutoLock auto_lock(va_lock_); |
204 VADisplayAttribute item = {VADisplayAttribRenderMode, | 233 VADisplayAttribute item = {VADisplayAttribRenderMode, |
205 1, // At least support '_LOCAL_OVERLAY'. | 234 1, // At least support '_LOCAL_OVERLAY'. |
206 -1, // The maximum possible support 'ALL'. | 235 -1, // The maximum possible support 'ALL'. |
207 VA_RENDER_MODE_LOCAL_GPU, | 236 VA_RENDER_MODE_LOCAL_GPU, |
208 VA_DISPLAY_ATTRIB_SETTABLE}; | 237 VA_DISPLAY_ATTRIB_SETTABLE}; |
209 | 238 |
210 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1); | 239 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1); |
211 if (va_res != VA_STATUS_SUCCESS) | 240 if (va_res != VA_STATUS_SUCCESS) |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported( | 1091 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported( |
1063 CodecMode mode, VAProfile va_profile) { | 1092 CodecMode mode, VAProfile va_profile) { |
1064 for (const auto& profile : supported_profiles_[mode]) { | 1093 for (const auto& profile : supported_profiles_[mode]) { |
1065 if (profile.va_profile == va_profile) | 1094 if (profile.va_profile == va_profile) |
1066 return true; | 1095 return true; |
1067 } | 1096 } |
1068 return false; | 1097 return false; |
1069 } | 1098 } |
1070 | 1099 |
1071 } // namespace content | 1100 } // namespace content |
OLD | NEW |