Skip to content

Commit 1504d89

Browse files
switch to libva 2.x
- support for libva 1.x has been dropped Change-Id: Ie5361b98cdd36144c9cd2a413c5fc2871655f333
1 parent c911e24 commit 1504d89

File tree

5 files changed

+65
-6
lines changed

5 files changed

+65
-6
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,12 @@ endif()
291291

292292
if(UNIX)
293293
find_package(PkgConfig)
294-
pkg_check_modules(LIBVA QUIET libva)
294+
pkg_check_modules(LIBVA libva>=1.0.0)
295295
if(LIBVA_FOUND)
296-
add_definitions(-DLIBVA)
297-
message(STATUS "Using libva")
296+
include(CheckLibraryExists)
297+
CHECK_LIBRARY_EXISTS(va vaGetLibFunc ${LIBVA_LIBDIR} HAVE_VAGETLIBFUNC)
298+
add_definitions(-DLIBVA ${LIBVA_CFLAGS})
299+
message(STATUS "Using libva ")
298300
endif()
299301
endif()
300302

manifests/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ components:
3131
branch: infra
3232
clean_on_sync: true
3333
dest_dir: infra
34-
revision: 0c42fcf3e4791d66736bc9901646686d776b6a90
34+
revision: 52149a69da21a9b07558e2d6c4b79385ceeedcea
3535
type: git
3636
internal:
3737
branch: master

runtime/os_interface/linux/options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -27,7 +27,7 @@ namespace Os {
2727
// Compiler library names
2828
const char *frontEndDllName = "libigdfcl.so";
2929
const char *igcDllName = "libigdccl.so";
30-
const char *libvaDllName = "libva.so.1";
30+
const char *libvaDllName = "libva.so.2";
3131
#endif //__linux__
3232
const char *sysFsPciPath = "/sys/bus/pci/devices/";
3333
const char *tbxLibName = "libtbxAccess.so";

unit_tests/linux/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ set(IGDRCL_SRCS_linux_dll_tests
3131
${IGDRCL_SOURCE_DIR}/runtime/os_interface/debug_settings_manager.cpp
3232
${IGDRCL_SOURCE_DIR}/runtime/dll/linux/drm_neo_create.cpp
3333
)
34+
35+
if(LIBVA_FOUND)
36+
list(APPEND IGDRCL_SRCS_linux_dll_tests ${CMAKE_CURRENT_SOURCE_DIR}/va_tests.cpp)
37+
endif(LIBVA_FOUND)
38+
3439
macro(macro_for_each_platform)
3540
list(APPEND IGDRCL_SRCS_linux_dll_tests ${IGDRCL_SOURCE_DIR}/runtime/${GEN_TYPE_LOWER}/hw_info_${PLATFORM_IT_LOWER}.cpp)
3641
endmacro()

unit_tests/linux/va_tests.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2018, Intel Corporation
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included
12+
* in all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
#include "test.h"
24+
#include "runtime/sharings/va/va_sharing_functions.h"
25+
#include "unit_tests/helpers/variable_backup.h"
26+
27+
using namespace OCLRT;
28+
29+
TEST(VaTests, whenLibvaSo2IsNotInstalledThenFail) {
30+
VariableBackup<decltype(VASharingFunctions::fdlopen)> dlopenBackup(&VASharingFunctions::fdlopen);
31+
VariableBackup<decltype(VASharingFunctions::fdlclose)> dlcloseBackup(&VASharingFunctions::fdlclose);
32+
VariableBackup<decltype(VASharingFunctions::fdlsym)> dlsymBackup(&VASharingFunctions::fdlsym);
33+
34+
VASharingFunctions::fdlopen = [&](const char *filename, int flag) -> void * {
35+
if (!strncmp(filename, "libva.so.2", 10)) {
36+
return (void *)0xdeadbeef;
37+
} else
38+
return 0;
39+
};
40+
VASharingFunctions::fdlclose = [&](void *handle) -> int {
41+
return 0;
42+
};
43+
44+
VASharingFunctions::fdlsym = [&](void *handle, const char *symbol) -> void * {
45+
return nullptr;
46+
};
47+
48+
VADisplay vaDisplay = nullptr;
49+
VASharingFunctions va(vaDisplay);
50+
51+
EXPECT_EQ(true, va.isVaLibraryAvailable());
52+
}

0 commit comments

Comments
 (0)