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