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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/common/gpu/media/vaapi_wrapper.h" | 9 #include "content/common/gpu/media/vaapi_wrapper.h" |
10 | 10 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 false); | 401 false); |
402 return true; | 402 return true; |
403 } | 403 } |
404 | 404 |
405 // static | 405 // static |
406 bool VaapiWrapper::pre_sandbox_init_done_ = false; | 406 bool VaapiWrapper::pre_sandbox_init_done_ = false; |
407 | 407 |
408 // static | 408 // static |
409 void VaapiWrapper::PreSandboxInitialization() { | 409 void VaapiWrapper::PreSandboxInitialization() { |
410 DCHECK(!pre_sandbox_init_done_); | 410 DCHECK(!pre_sandbox_init_done_); |
411 vaapi_handle = dlopen("libva.so", RTLD_NOW); | 411 vaapi_handle = dlopen("libva.so.1", RTLD_NOW); |
412 vaapi_x11_handle = dlopen("libva-x11.so", RTLD_NOW); | 412 vaapi_x11_handle = dlopen("libva-x11.so.1", RTLD_NOW); |
413 pre_sandbox_init_done_ = vaapi_handle && vaapi_x11_handle; | 413 pre_sandbox_init_done_ = vaapi_handle && vaapi_x11_handle; |
414 } | 414 } |
415 | 415 |
416 // static | 416 // static |
417 bool VaapiWrapper::PostSandboxInitialization() { | 417 bool VaapiWrapper::PostSandboxInitialization() { |
418 if (!pre_sandbox_init_done_) | 418 if (!pre_sandbox_init_done_) |
419 return false; | 419 return false; |
420 #define VAAPI_DLSYM_OR_RETURN_ON_ERROR(name, handle) \ | 420 #define VAAPI_DLSYM_OR_RETURN_ON_ERROR(name, handle) \ |
421 do { \ | 421 do { \ |
422 VAAPI_##name = reinterpret_cast<Vaapi##name>(dlsym((handle), "va"#name)); \ | 422 VAAPI_##name = reinterpret_cast<Vaapi##name>(dlsym((handle), "va"#name)); \ |
(...skipping 13 matching lines...) Expand all Loading... |
436 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DestroyContext, vaapi_handle); | 436 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DestroyContext, vaapi_handle); |
437 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DestroySurfaces, vaapi_handle); | 437 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DestroySurfaces, vaapi_handle); |
438 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DisplayIsValid, vaapi_handle); | 438 VAAPI_DLSYM_OR_RETURN_ON_ERROR(DisplayIsValid, vaapi_handle); |
439 VAAPI_DLSYM_OR_RETURN_ON_ERROR(EndPicture, vaapi_handle); | 439 VAAPI_DLSYM_OR_RETURN_ON_ERROR(EndPicture, vaapi_handle); |
440 VAAPI_DLSYM_OR_RETURN_ON_ERROR(ErrorStr, vaapi_handle); | 440 VAAPI_DLSYM_OR_RETURN_ON_ERROR(ErrorStr, vaapi_handle); |
441 VAAPI_DLSYM_OR_RETURN_ON_ERROR(GetConfigAttributes, vaapi_handle); | 441 VAAPI_DLSYM_OR_RETURN_ON_ERROR(GetConfigAttributes, vaapi_handle); |
442 VAAPI_DLSYM_OR_RETURN_ON_ERROR(GetDisplay, vaapi_x11_handle); | 442 VAAPI_DLSYM_OR_RETURN_ON_ERROR(GetDisplay, vaapi_x11_handle); |
443 VAAPI_DLSYM_OR_RETURN_ON_ERROR(Initialize, vaapi_handle); | 443 VAAPI_DLSYM_OR_RETURN_ON_ERROR(Initialize, vaapi_handle); |
444 VAAPI_DLSYM_OR_RETURN_ON_ERROR(PutSurface, vaapi_x11_handle); | 444 VAAPI_DLSYM_OR_RETURN_ON_ERROR(PutSurface, vaapi_x11_handle); |
445 VAAPI_DLSYM_OR_RETURN_ON_ERROR(RenderPicture, vaapi_handle); | 445 VAAPI_DLSYM_OR_RETURN_ON_ERROR(RenderPicture, vaapi_handle); |
446 VAAPI_DLSYM_OR_RETURN_ON_ERROR(SyncSurface, vaapi_x11_handle); | 446 VAAPI_DLSYM_OR_RETURN_ON_ERROR(SyncSurface, vaapi_handle); |
447 VAAPI_DLSYM_OR_RETURN_ON_ERROR(Terminate, vaapi_handle); | 447 VAAPI_DLSYM_OR_RETURN_ON_ERROR(Terminate, vaapi_handle); |
448 #undef VAAPI_DLSYM | 448 #undef VAAPI_DLSYM |
449 | 449 |
450 return true; | 450 return true; |
451 } | 451 } |
452 | 452 |
453 } // namespace content | 453 } // namespace content |
OLD | NEW |