| 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 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/command_line.h" | |
| 13 #include "base/logging.h" | 12 #include "base/logging.h" |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "base/numerics/safe_conversions.h" | 14 #include "base/numerics/safe_conversions.h" |
| 16 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 18 // Auto-generated for dlopen libva libraries | 17 // Auto-generated for dlopen libva libraries |
| 19 #include "content/common/gpu/media/va_stubs.h" | 18 #include "content/common/gpu/media/va_stubs.h" |
| 20 #include "content/common/gpu/media/vaapi_picture.h" | 19 #include "content/common/gpu/media/vaapi_picture.h" |
| 21 #include "content/public/common/content_switches.h" | |
| 22 #include "third_party/libyuv/include/libyuv.h" | 20 #include "third_party/libyuv/include/libyuv.h" |
| 23 #include "ui/gl/gl_bindings.h" | 21 #include "ui/gl/gl_bindings.h" |
| 24 #if defined(USE_X11) | 22 #if defined(USE_X11) |
| 25 #include "ui/gfx/x/x11_types.h" | 23 #include "ui/gfx/x/x11_types.h" |
| 26 #elif defined(USE_OZONE) | 24 #elif defined(USE_OZONE) |
| 27 #include "third_party/libva/va/drm/va_drm.h" | 25 #include "third_party/libva/va/drm/va_drm.h" |
| 28 #include "third_party/libva/va/va_drmcommon.h" | 26 #include "third_party/libva/va/va_drmcommon.h" |
| 29 #include "ui/ozone/public/ozone_platform.h" | 27 #include "ui/ozone/public/ozone_platform.h" |
| 30 #include "ui/ozone/public/surface_factory_ozone.h" | 28 #include "ui/ozone/public/surface_factory_ozone.h" |
| 31 #endif // USE_X11 | 29 #endif // USE_X11 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 VAProfile va_profile = ProfileToVAProfile(profile, mode); | 205 VAProfile va_profile = ProfileToVAProfile(profile, mode); |
| 208 scoped_refptr<VaapiWrapper> vaapi_wrapper = | 206 scoped_refptr<VaapiWrapper> vaapi_wrapper = |
| 209 Create(mode, va_profile, report_error_to_uma_cb); | 207 Create(mode, va_profile, report_error_to_uma_cb); |
| 210 return vaapi_wrapper; | 208 return vaapi_wrapper; |
| 211 } | 209 } |
| 212 | 210 |
| 213 // static | 211 // static |
| 214 media::VideoEncodeAccelerator::SupportedProfiles | 212 media::VideoEncodeAccelerator::SupportedProfiles |
| 215 VaapiWrapper::GetSupportedEncodeProfiles() { | 213 VaapiWrapper::GetSupportedEncodeProfiles() { |
| 216 media::VideoEncodeAccelerator::SupportedProfiles profiles; | 214 media::VideoEncodeAccelerator::SupportedProfiles profiles; |
| 217 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 218 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) | |
| 219 return profiles; | |
| 220 | |
| 221 std::vector<ProfileInfo> encode_profile_infos = | 215 std::vector<ProfileInfo> encode_profile_infos = |
| 222 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kEncode); | 216 profile_infos_.Get().GetSupportedProfileInfosForCodecMode(kEncode); |
| 223 | 217 |
| 224 for (size_t i = 0; i < arraysize(kProfileMap); ++i) { | 218 for (size_t i = 0; i < arraysize(kProfileMap); ++i) { |
| 225 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kEncode); | 219 VAProfile va_profile = ProfileToVAProfile(kProfileMap[i].profile, kEncode); |
| 226 if (va_profile == VAProfileNone) | 220 if (va_profile == VAProfileNone) |
| 227 continue; | 221 continue; |
| 228 for (const auto& profile_info : encode_profile_infos) { | 222 for (const auto& profile_info : encode_profile_infos) { |
| 229 if (profile_info.va_profile == va_profile) { | 223 if (profile_info.va_profile == va_profile) { |
| 230 media::VideoEncodeAccelerator::SupportedProfile profile; | 224 media::VideoEncodeAccelerator::SupportedProfile profile; |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 drm_fd_.reset(HANDLE_EINTR(dup(fd))); | 1263 drm_fd_.reset(HANDLE_EINTR(dup(fd))); |
| 1270 } | 1264 } |
| 1271 #endif // USE_OZONE | 1265 #endif // USE_OZONE |
| 1272 | 1266 |
| 1273 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { | 1267 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { |
| 1274 return (major_version_ < major) || | 1268 return (major_version_ < major) || |
| 1275 (major_version_ == major && minor_version_ < minor); | 1269 (major_version_ == major && minor_version_ < minor); |
| 1276 } | 1270 } |
| 1277 | 1271 |
| 1278 } // namespace content | 1272 } // namespace content |
| OLD | NEW |