Lines 265-270
void VADisplayState::PreSandboxInitializ
Link Here
|
265 |
base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); |
265 |
base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); |
266 |
if (drm_file.IsValid()) |
266 |
if (drm_file.IsValid()) |
267 |
VADisplayState::Get()->SetDrmFd(drm_file.GetPlatformFile()); |
267 |
VADisplayState::Get()->SetDrmFd(drm_file.GetPlatformFile()); |
|
|
268 |
|
269 |
const char kNvidiaPath[] = "/dev/dri/nvidiactl"; |
270 |
base::File nvidia_file = base::File( |
271 |
base::FilePath::FromUTF8Unsafe(kNvidiaPath), |
272 |
base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE); |
268 |
} |
273 |
} |
269 |
|
274 |
|
270 |
VADisplayState::VADisplayState() |
275 |
VADisplayState::VADisplayState() |
Lines 292-300
bool VADisplayState::Initialize() {
Link Here
|
292 |
} |
297 |
} |
293 |
|
298 |
|
294 |
bool VADisplayState::InitializeOnce() { |
299 |
bool VADisplayState::InitializeOnce() { |
295 |
static_assert(VA_MAJOR_VERSION >= 1 && VA_MINOR_VERSION >= 1, |
|
|
296 |
"Requires VA-API >= 1.1.0"); |
297 |
|
298 |
switch (gl::GetGLImplementation()) { |
300 |
switch (gl::GetGLImplementation()) { |
299 |
case gl::kGLImplementationEGLGLES2: |
301 |
case gl::kGLImplementationEGLGLES2: |
300 |
va_display_ = vaGetDisplayDRM(drm_fd_.get()); |
302 |
va_display_ = vaGetDisplayDRM(drm_fd_.get()); |
Lines 302-311
bool VADisplayState::InitializeOnce() {
Link Here
|
302 |
case gl::kGLImplementationDesktopGL: |
304 |
case gl::kGLImplementationDesktopGL: |
303 |
#if defined(USE_X11) |
305 |
#if defined(USE_X11) |
304 |
va_display_ = vaGetDisplay(gfx::GetXDisplay()); |
306 |
va_display_ = vaGetDisplay(gfx::GetXDisplay()); |
305 |
#else |
307 |
if (vaDisplayIsValid(va_display_)) |
306 |
LOG(WARNING) << "VAAPI video acceleration not available without " |
308 |
break; |
307 |
"DesktopGL (GLX)."; |
|
|
308 |
#endif // USE_X11 |
309 |
#endif // USE_X11 |
|
|
310 |
va_display_ = vaGetDisplayDRM(drm_fd_.get()); |
309 |
break; |
311 |
break; |
310 |
// Cannot infer platform from GL, try all available displays |
312 |
// Cannot infer platform from GL, try all available displays |
311 |
case gl::kGLImplementationNone: |
313 |
case gl::kGLImplementationNone: |
Lines 338-345
bool VADisplayState::InitializeOnce() {
Link Here
|
338 |
int major_version, minor_version; |
340 |
int major_version, minor_version; |
339 |
VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version); |
341 |
VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version); |
340 |
if (va_res != VA_STATUS_SUCCESS) { |
342 |
if (va_res != VA_STATUS_SUCCESS) { |
341 |
LOG(ERROR) << "vaInitialize failed: " << vaErrorStr(va_res); |
343 |
LOG(ERROR) << "vaInitialize failed (ignore if using Wayland desktop environment): " << vaErrorStr(va_res); |
342 |
return false; |
344 |
va_display_ = vaGetDisplayDRM(drm_fd_.get()); |
|
|
345 |
if (!vaDisplayIsValid(va_display_)) { |
346 |
LOG(ERROR) << "Could not get a valid DRM VA display"; |
347 |
return false; |
348 |
} |
349 |
va_res = vaInitialize(va_display_, &major_version, &minor_version); |
350 |
if (va_res != VA_STATUS_SUCCESS) { |
351 |
LOG(ERROR) << "vaInitialize failed using DRM: " << vaErrorStr(va_res); |
352 |
return false; |
353 |
} else { |
354 |
LOG(WARNING) << "vaInitialize succeeded for DRM"; |
355 |
} |
343 |
} |
356 |
} |
344 |
|
357 |
|
345 |
va_initialized_ = true; |
358 |
va_initialized_ = true; |
Lines 347-353
bool VADisplayState::InitializeOnce() {
Link Here
|
347 |
va_vendor_string_ = vaQueryVendorString(va_display_); |
360 |
va_vendor_string_ = vaQueryVendorString(va_display_); |
348 |
DLOG_IF(WARNING, va_vendor_string_.empty()) |
361 |
DLOG_IF(WARNING, va_vendor_string_.empty()) |
349 |
<< "Vendor string empty or error reading."; |
362 |
<< "Vendor string empty or error reading."; |
350 |
DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " " |
363 |
VLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " " |
351 |
<< va_vendor_string_; |
364 |
<< va_vendor_string_; |
352 |
|
365 |
|
353 |
// The VAAPI version is determined from what is loaded on the system by |
366 |
// The VAAPI version is determined from what is loaded on the system by |
Lines 680-686
bool VASupportedProfiles::AreAttribsSupp
Link Here
|
680 |
if (attribs[i].type != required_attribs[i].type || |
693 |
if (attribs[i].type != required_attribs[i].type || |
681 |
(attribs[i].value & required_attribs[i].value) != |
694 |
(attribs[i].value & required_attribs[i].value) != |
682 |
required_attribs[i].value) { |
695 |
required_attribs[i].value) { |
683 |
DVLOG(1) << "Unsupported value " << required_attribs[i].value |
696 |
VLOG(1) << "Unsupported value " << required_attribs[i].value |
684 |
<< " for attribute type " << required_attribs[i].type; |
697 |
<< " for attribute type " << required_attribs[i].type; |
685 |
return false; |
698 |
return false; |
686 |
} |
699 |
} |