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