| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 201 VaapiWrapper::GetSupportedDecodeProfiles() { |
| 202 std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
| 203 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 204 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
| 205 return profiles; |
| 206 |
| 207 std::vector<ProfileInfo> decode_profile_infos = |
| 208 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kDecode); |
| 209 |
| 210 for (size_t i = 0; i < arraysize(kProfileMap); ++i) { |
| 211 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kDecode); |
| 212 if (va_profile == VAProfileNone) |
| 213 continue; |
| 214 for (const auto& profile_info : decode_profile_infos) { |
| 215 if (profile_info.va_profile == va_profile) { |
| 216 media::VideoDecodeAccelerator::SupportedProfile profile; |
| 217 profile.profile = kProfileMap[i].profile; |
| 218 profile.max_resolution = profile_info.max_resolution; |
| 219 profile.min_resolution.SetSize(16, 16); |
| 220 profiles.push_back(profile); |
| 221 break; |
| 222 } |
| 223 } |
| 224 } |
| 225 return profiles; |
| 226 } |
| 227 |
| 199 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() { | 228 void VaapiWrapper::TryToSetVADisplayAttributeToLocalGPU() { |
| 200 base::AutoLock auto_lock(va_lock_); | 229 base::AutoLock auto_lock(va_lock_); |
| 201 VADisplayAttribute item = {VADisplayAttribRenderMode, | 230 VADisplayAttribute item = {VADisplayAttribRenderMode, |
| 202 1, // At least support '_LOCAL_OVERLAY'. | 231 1, // At least support '_LOCAL_OVERLAY'. |
| 203 -1, // The maximum possible support 'ALL'. | 232 -1, // The maximum possible support 'ALL'. |
| 204 VA_RENDER_MODE_LOCAL_GPU, | 233 VA_RENDER_MODE_LOCAL_GPU, |
| 205 VA_DISPLAY_ATTRIB_SETTABLE}; | 234 VA_DISPLAY_ATTRIB_SETTABLE}; |
| 206 | 235 |
| 207 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1); | 236 VAStatus va_res = vaSetDisplayAttributes(va_display_, &item, 1); |
| 208 if (va_res != VA_STATUS_SUCCESS) | 237 if (va_res != VA_STATUS_SUCCESS) |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported( | 1083 bool VaapiWrapper::LazyProfileInfos::IsProfileSupported( |
| 1055 CodecMode mode, VAProfile va_profile) { | 1084 CodecMode mode, VAProfile va_profile) { |
| 1056 for (const auto& profile : supported_profiles_[mode]) { | 1085 for (const auto& profile : supported_profiles_[mode]) { |
| 1057 if (profile.va_profile == va_profile) | 1086 if (profile.va_profile == va_profile) |
| 1058 return true; | 1087 return true; |
| 1059 } | 1088 } |
| 1060 return false; | 1089 return false; |
| 1061 } | 1090 } |
| 1062 | 1091 |
| 1063 } // namespace content | 1092 } // namespace content |
| OLD | NEW |