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 "media/gpu/vaapi_wrapper.h" | 5 #include "media/gpu/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" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 }; | 122 }; |
123 | 123 |
124 // A map between VideoCodecProfile and VAProfile. | 124 // A map between VideoCodecProfile and VAProfile. |
125 static const ProfileMap kProfileMap[] = { | 125 static const ProfileMap kProfileMap[] = { |
126 {H264PROFILE_BASELINE, VAProfileH264Baseline}, | 126 {H264PROFILE_BASELINE, VAProfileH264Baseline}, |
127 {H264PROFILE_MAIN, VAProfileH264Main}, | 127 {H264PROFILE_MAIN, VAProfileH264Main}, |
128 // TODO(posciak): See if we can/want support other variants of | 128 // TODO(posciak): See if we can/want support other variants of |
129 // H264PROFILE_HIGH*. | 129 // H264PROFILE_HIGH*. |
130 {H264PROFILE_HIGH, VAProfileH264High}, | 130 {H264PROFILE_HIGH, VAProfileH264High}, |
131 {VP8PROFILE_ANY, VAProfileVP8Version0_3}, | 131 {VP8PROFILE_ANY, VAProfileVP8Version0_3}, |
132 // TODO(servolk): Need to add VP9 profiles 1,2,3 here after rolling | |
133 // third_party/libva to 1.7. crbug.com/598118 | |
134 {VP9PROFILE_PROFILE0, VAProfileVP9Profile0}, | 132 {VP9PROFILE_PROFILE0, VAProfileVP9Profile0}, |
| 133 {VP9PROFILE_PROFILE1, VAProfileVP9Profile1}, |
| 134 {VP9PROFILE_PROFILE2, VAProfileVP9Profile2}, |
| 135 {VP9PROFILE_PROFILE3, VAProfileVP9Profile3}, |
135 }; | 136 }; |
136 | 137 |
137 static std::vector<VAConfigAttrib> GetRequiredAttribs( | 138 static std::vector<VAConfigAttrib> GetRequiredAttribs( |
138 VaapiWrapper::CodecMode mode) { | 139 VaapiWrapper::CodecMode mode) { |
139 std::vector<VAConfigAttrib> required_attribs; | 140 std::vector<VAConfigAttrib> required_attribs; |
140 required_attribs.insert( | 141 required_attribs.insert( |
141 required_attribs.end(), kCommonVAConfigAttribs, | 142 required_attribs.end(), kCommonVAConfigAttribs, |
142 kCommonVAConfigAttribs + arraysize(kCommonVAConfigAttribs)); | 143 kCommonVAConfigAttribs + arraysize(kCommonVAConfigAttribs)); |
143 if (mode == VaapiWrapper::kEncode) { | 144 if (mode == VaapiWrapper::kEncode) { |
144 required_attribs.insert( | 145 required_attribs.insert( |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 vaInitialize(va_display_, &major_version_, &minor_version_); | 1218 vaInitialize(va_display_, &major_version_, &minor_version_); |
1218 if (va_res != VA_STATUS_SUCCESS) { | 1219 if (va_res != VA_STATUS_SUCCESS) { |
1219 LOG(WARNING) << "vaInitialize failed: " << vaErrorStr(va_res); | 1220 LOG(WARNING) << "vaInitialize failed: " << vaErrorStr(va_res); |
1220 return false; | 1221 return false; |
1221 } | 1222 } |
1222 | 1223 |
1223 va_initialized_ = true; | 1224 va_initialized_ = true; |
1224 DVLOG(1) << "VAAPI version: " << major_version_ << "." << minor_version_; | 1225 DVLOG(1) << "VAAPI version: " << major_version_ << "." << minor_version_; |
1225 } | 1226 } |
1226 | 1227 |
1227 if (VAAPIVersionLessThan(0, 34)) { | 1228 if (VAAPIVersionLessThan(0, 39)) { |
1228 LOG(ERROR) << "VAAPI version < 0.34 is not supported."; | 1229 LOG(ERROR) << "VAAPI version < 0.39 is not supported."; |
1229 return false; | 1230 return false; |
1230 } | 1231 } |
1231 return true; | 1232 return true; |
1232 } | 1233 } |
1233 | 1234 |
1234 void VaapiWrapper::VADisplayState::Deinitialize(VAStatus* status) { | 1235 void VaapiWrapper::VADisplayState::Deinitialize(VAStatus* status) { |
1235 va_lock_.AssertAcquired(); | 1236 va_lock_.AssertAcquired(); |
1236 if (--refcount_ > 0) | 1237 if (--refcount_ > 0) |
1237 return; | 1238 return; |
1238 | 1239 |
(...skipping 14 matching lines...) Expand all Loading... |
1253 drm_fd_.reset(HANDLE_EINTR(dup(fd))); | 1254 drm_fd_.reset(HANDLE_EINTR(dup(fd))); |
1254 } | 1255 } |
1255 #endif // USE_OZONE | 1256 #endif // USE_OZONE |
1256 | 1257 |
1257 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { | 1258 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { |
1258 return (major_version_ < major) || | 1259 return (major_version_ < major) || |
1259 (major_version_ == major && minor_version_ < minor); | 1260 (major_version_ == major && minor_version_ < minor); |
1260 } | 1261 } |
1261 | 1262 |
1262 } // namespace media | 1263 } // namespace media |
OLD | NEW |