From 1504d89571f6863c368fce32ec49adf53dd6acfd Mon Sep 17 00:00:00 2001 From: Jacek Danecki Date: Wed, 28 Mar 2018 18:30:37 +0200 Subject: [PATCH] switch to libva 2.x - support for libva 1.x has been dropped Change-Id: Ie5361b98cdd36144c9cd2a413c5fc2871655f333 --- CMakeLists.txt | 8 ++-- manifests/manifest.yml | 2 +- runtime/os_interface/linux/options.cpp | 4 +- unit_tests/linux/CMakeLists.txt | 5 +++ unit_tests/linux/va_tests.cpp | 52 ++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 unit_tests/linux/va_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e2bdb5cf3e..4ec841cff3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -291,10 +291,12 @@ endif() if(UNIX) find_package(PkgConfig) - pkg_check_modules(LIBVA QUIET libva) + pkg_check_modules(LIBVA libva>=1.0.0) if(LIBVA_FOUND) - add_definitions(-DLIBVA) - message(STATUS "Using libva") + include(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(va vaGetLibFunc ${LIBVA_LIBDIR} HAVE_VAGETLIBFUNC) + add_definitions(-DLIBVA ${LIBVA_CFLAGS}) + message(STATUS "Using libva ") endif() endif() diff --git a/manifests/manifest.yml b/manifests/manifest.yml index bdacb79bac..c11927e716 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -31,7 +31,7 @@ components: branch: infra clean_on_sync: true dest_dir: infra - revision: 0c42fcf3e4791d66736bc9901646686d776b6a90 + revision: 52149a69da21a9b07558e2d6c4b79385ceeedcea type: git internal: branch: master diff --git a/runtime/os_interface/linux/options.cpp b/runtime/os_interface/linux/options.cpp index a1d43a835d..cde2451b3a 100644 --- a/runtime/os_interface/linux/options.cpp +++ b/runtime/os_interface/linux/options.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,7 +27,7 @@ namespace Os { // Compiler library names const char *frontEndDllName = "libigdfcl.so"; const char *igcDllName = "libigdccl.so"; -const char *libvaDllName = "libva.so.1"; +const char *libvaDllName = "libva.so.2"; #endif //__linux__ const char *sysFsPciPath = "/sys/bus/pci/devices/"; const char *tbxLibName = "libtbxAccess.so"; diff --git a/unit_tests/linux/CMakeLists.txt b/unit_tests/linux/CMakeLists.txt index 2361387050..d7ab327ab4 100644 --- a/unit_tests/linux/CMakeLists.txt +++ b/unit_tests/linux/CMakeLists.txt @@ -31,6 +31,11 @@ set(IGDRCL_SRCS_linux_dll_tests ${IGDRCL_SOURCE_DIR}/runtime/os_interface/debug_settings_manager.cpp ${IGDRCL_SOURCE_DIR}/runtime/dll/linux/drm_neo_create.cpp ) + +if(LIBVA_FOUND) + list(APPEND IGDRCL_SRCS_linux_dll_tests ${CMAKE_CURRENT_SOURCE_DIR}/va_tests.cpp) +endif(LIBVA_FOUND) + macro(macro_for_each_platform) list(APPEND IGDRCL_SRCS_linux_dll_tests ${IGDRCL_SOURCE_DIR}/runtime/${GEN_TYPE_LOWER}/hw_info_${PLATFORM_IT_LOWER}.cpp) endmacro() diff --git a/unit_tests/linux/va_tests.cpp b/unit_tests/linux/va_tests.cpp new file mode 100644 index 0000000000..7c154f5857 --- /dev/null +++ b/unit_tests/linux/va_tests.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "test.h" +#include "runtime/sharings/va/va_sharing_functions.h" +#include "unit_tests/helpers/variable_backup.h" + +using namespace OCLRT; + +TEST(VaTests, whenLibvaSo2IsNotInstalledThenFail) { + VariableBackup dlopenBackup(&VASharingFunctions::fdlopen); + VariableBackup dlcloseBackup(&VASharingFunctions::fdlclose); + VariableBackup dlsymBackup(&VASharingFunctions::fdlsym); + + VASharingFunctions::fdlopen = [&](const char *filename, int flag) -> void * { + if (!strncmp(filename, "libva.so.2", 10)) { + return (void *)0xdeadbeef; + } else + return 0; + }; + VASharingFunctions::fdlclose = [&](void *handle) -> int { + return 0; + }; + + VASharingFunctions::fdlsym = [&](void *handle, const char *symbol) -> void * { + return nullptr; + }; + + VADisplay vaDisplay = nullptr; + VASharingFunctions va(vaDisplay); + + EXPECT_EQ(true, va.isVaLibraryAvailable()); +}