Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Commit 60fe41c

Browse files
zhangyichixJeevakaPrabu
authored andcommitted
Enable oneVPL dispatch on Android
Change the lib path for loading oneVPL runtime on Android Tracked-On: OAM-118498 Signed-off-by: zhangyichix <yichix.zhang@intel.com> Signed-off-by: Shaofeng Tang <shaofeng.tang@intel.com>
1 parent 884a440 commit 60fe41c

4 files changed

Lines changed: 65 additions & 6 deletions

File tree

libvpl/src/linux/mfxloader.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,33 @@
2727
namespace MFX {
2828

2929
#if defined(__x86_64__) || (INTPTR_MAX == INT64_MAX)
30+
#ifdef ANDROID
31+
#define LIBMFXSW "libmfxsw64.so"
32+
#define LIBMFXHW "libmfxhw64.so"
33+
34+
#define ONEVPLSW "libvplswref64.so"
35+
#define ONEVPLHW "libmfx-gen.so"
36+
#else
3037
#define LIBMFXSW "libmfxsw64.so.1"
3138
#define LIBMFXHW "libmfxhw64.so.1"
3239

3340
#define ONEVPLSW "libvplswref64.so.1"
3441
#define ONEVPLHW "libmfx-gen.so.1.2"
42+
#endif
3543
#elif defined(__i386__) || (INTPTR_MAX == INT32_MAX)
44+
#ifdef ANDROID
45+
#define LIBMFXSW "libmfxsw32.so"
46+
#define LIBMFXHW "libmfxhw32.so"
47+
48+
#define ONEVPLSW "libvplswref32.so"
49+
#define ONEVPLHW "libmfx-gen.so"
50+
#else
3651
#define LIBMFXSW "libmfxsw32.so.1"
3752
#define LIBMFXHW "libmfxhw32.so.1"
3853

3954
#define ONEVPLSW "libvplswref32.so.1"
4055
#define ONEVPLHW "libmfx-gen.so.1.2"
56+
#endif
4157
#else
4258
#error Unsupported architecture
4359
#endif

libvpl/src/mfx_dispatcher_vpl.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ typedef char CHAR_TYPE;
4848
#define MSDK_LIB_NAME L"libmfxhw64."
4949
#endif
5050
#define ONEVPL_PRIORITY_PATH_VAR L"ONEVPL_PRIORITY_PATH"
51-
#elif defined(__linux__)
52-
// Linux x64
53-
#define MSDK_LIB_NAME "libmfxhw64."
51+
#elif defined(__linux__) || defined ANDROID
52+
#if defined __i386
53+
// Linux or Android 32
54+
#define MSDK_LIB_NAME "libmfxhw32."
55+
#else
56+
// Linux x64
57+
#define MSDK_LIB_NAME "libmfxhw64."
58+
#endif
5459
#define ONEVPL_PRIORITY_PATH_VAR "ONEVPL_PRIORITY_PATH"
5560
#endif
5661

libvpl/src/mfx_dispatcher_vpl_loader.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ mfxU32 LoaderCtxVPL::ParseEnvSearchPaths(const CHAR_TYPE *envVarName,
129129
#else
130130
CHAR_TYPE *envVar = getenv(envVarName);
131131
if (!envVar)
132+
#ifdef ANDROID
133+
envVar = (CHAR_TYPE *)ONEVPL_SEARCH_PATH;
134+
#else
132135
return 0; // environment variable not defined
136+
#endif
133137

134138
// parse env variable into individual directories
135139
std::stringstream envPath((CHAR_TYPE *)envVar);
@@ -239,8 +243,12 @@ mfxStatus LoaderCtxVPL::SearchDirForLibs(STRING_TYPE searchDir,
239243
if (strstr(currFile->d_name, ".so")) {
240244
// library names must begin with "libvpl*" or "libmfx*"
241245
if ((strstr(currFile->d_name, "libvpl") != currFile->d_name) &&
246+
#ifdef ANDROID
247+
(strstr(currFile->d_name, "libmfx") != currFile->d_name))
248+
#else
242249
(strcmp(currFile->d_name, "libmfx-gen.so.1.2") != 0) &&
243250
(strcmp(currFile->d_name, "libmfxhw64.so.1") != 0))
251+
#endif
244252
continue;
245253

246254
// special case: do not include dispatcher itself (libmfx.so*, libvpl.so*) or tracer library
@@ -414,6 +422,15 @@ mfxU32 LoaderCtxVPL::GetSearchPathsSystemDefault(std::list<STRING_TYPE> &searchD
414422
searchDirs.clear();
415423

416424
#ifdef __linux__
425+
#ifdef ANDROID
426+
searchDirs.push_back("/usr/lib/x86_64-linux-gnu");
427+
428+
// Add other default paths
429+
searchDirs.push_back("/lib");
430+
searchDirs.push_back("/vendor/lib");
431+
searchDirs.push_back("/lib64");
432+
searchDirs.push_back("/vendor/lib64");
433+
#else
417434
// Add the standard path for libmfx1 install in Ubuntu
418435
searchDirs.push_back("/usr/lib/x86_64-linux-gnu");
419436

@@ -422,6 +439,7 @@ mfxU32 LoaderCtxVPL::GetSearchPathsSystemDefault(std::list<STRING_TYPE> &searchD
422439
searchDirs.push_back("/usr/lib");
423440
searchDirs.push_back("/lib64");
424441
searchDirs.push_back("/usr/lib64");
442+
#endif
425443
#endif
426444

427445
return (mfxU32)searchDirs.size();

libvpl/src/mfx_dispatcher_vpl_lowlatency.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@
1919
#define LIB_MSDK L"libmfxhw64.dll"
2020
#endif
2121
#elif defined(__linux__)
22-
// Linux x64
23-
#define LIB_ONEVPL "libmfx-gen.so.1.2"
24-
#define LIB_MSDK "libmfxhw64.so.1"
22+
#ifdef ANDROID
23+
#if defined __i386
24+
#define LIB_ONEVPL "libmfx-gen.so"
25+
#define LIB_MSDK "libmfxhw32.so"
26+
#else
27+
#define LIB_ONEVPL "libmfx-gen.so"
28+
#define LIB_MSDK "libmfxhw64.so"
29+
#endif
30+
#else
31+
// Linux x64
32+
#define LIB_ONEVPL "libmfx-gen.so.1.2"
33+
#define LIB_MSDK "libmfxhw64.so.1"
34+
#endif
2535
#endif
2636

2737
//Intel® Video Processing Library (Intel® VPL) low latency dispatcher
@@ -195,13 +205,23 @@ mfxStatus LoaderCtxVPL::LoadLibsFromMultipleDirs(LibType libType) {
195205
// clang-format off
196206

197207
// standard paths for RT installation on Linux
208+
#ifdef ANDROID
209+
std::vector<std::string> llSearchDir = {
210+
"/usr/lib/x86_64-linux-gnu",
211+
"/lib",
212+
"/vendor/lib",
213+
"/lib64",
214+
"/vendor/lib64",
215+
};
216+
#else
198217
std::vector<std::string> llSearchDir = {
199218
"/usr/lib/x86_64-linux-gnu",
200219
"/lib",
201220
"/usr/lib",
202221
"/lib64",
203222
"/usr/lib64",
204223
};
224+
#endif
205225

206226
// clang-format on
207227

0 commit comments

Comments
 (0)