Our transcoding application supports MFX on Windows platforms. Now, we are trying to support it on Linux.
2018R1 on CentOS 7.4 Gold installation. Intel i5-6600 cpu.
When we write a simple C++ application like
main()
{
mfxStatus sts;
mfxIMPL impl;
mfxVersion ver;
mfxSession m_mfxSession;
impl = MFX_IMPL_HARDWARE_ANY;
ver.Minor = 25;
ver.Major = 1;
sts = MFXInit( impl , &ver , &m_mfxSession );
if ( sts == MFX_ERR_NONE )
{
printf( ....
}
else
{
printf( ....
}
return( -1 );
}
MFXInit returns 0 (success) and we get the following output from mfx_dispatch.cpp
[user@localhost test]$ ./main.o
INFO: MFXInitEx (impl=MFX_IMPL_HARDWARE_ANY, pVer=1.25, ExternalThreads=0 session=0x7ffe6675d2b8
INFO: invoking LoadLibrary(/opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.25)
LoadSelectedDll loaded module /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.25. hModule=0x247d540
INFO: MFXInitEx(MFX_IMPL_HARDWARE,ver=1.25,ExtThreads=0,session=0x247d0c0)
At last...
loadStatus=0
INFO: invoking LoadLibrary(libmfxhw64.so)
LoadSelectedDll loaded module libmfxhw64.so. hModule=0x247d540
INFO: MFXInitEx(MFX_IMPL_HARDWARE,ver=1.25,ExtThreads=0,session=0x2481fa0)
At last...
loadStatus=0
MFX_VIDEO_ENCODER::__Initialize() successful. Accelerator type: hardware/vaapi, Intel SDK version 1.25
When we put the same code to the very beginning of the main() of our big transcoding application and call MFXInit(), it returns -3:
INFO: MFXInitEx (impl=MFX_IMPL_HARDWARE_ANY, pVer=1.25, ExternalThreads=0 session=0x7ffb44000e50
INFO: invoking LoadLibrary(/opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.25)
LoadSelectedDll loaded module /opt/intel/mediasdk/lib64/libmfxhw64-p.so.1.25. hModule=0x7ffb44025db0
INFO: MFXInitEx(MFX_IMPL_HARDWARE,ver=1.25,ExtThreads=0,session=0x7ffb44025930)
library can't be load. MFXInitEx returned -3
loadStatus=-3
INFO: invoking LoadLibrary(libmfxhw64.so)
LoadSelectedDll loaded module libmfxhw64.so. hModule=0x7ffb440268e0
INFO: MFXInitEx(MFX_IMPL_HARDWARE,ver=1.25,ExtThreads=0,session=0x7ffb44025930)
library can't be load. MFXInitEx returned -3
loadStatus=-3
LD_LIBRARY_PATH is defined as
./:/opt/intel/mediasdk/lib64
As far as we traced the mfx_dispatch code, the SO is loaded, all function addresses are read but the actualTable[eMFXInitEx] function from the loaded SO happens to return -3.
mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const msdk_disp_char *pPath, eMfxImplType reqImplType,
mfxIMPL reqImpl, mfxIMPL reqImplInterface, mfxInitParam &par)
{
......
// Call old-style MFXInit init for older libraries and audio library
bool callOldInit = (impl & MFX_IMPL_AUDIO) || !actualTable[eMFXInitEx]; // if true call eMFXInit, if false - eMFXInitEx
int tableIndex = (callOldInit) ? eMFXInit : eMFXInitEx;
mfxFunctionPointer pFunc = actualTable[tableIndex];
{
if (callOldInit)
{
DISPATCHER_LOG_BLOCK(("Calling MFXInit(%s,ver=%u.%u,session=%p) from DLL\n"
, DispatcherLog_GetMFXImplString(impl | implInterface).c_str()
, apiVersion.Major
, apiVersion.Minor
, &session));
mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxIMPL, mfxVersion *, mfxSession *)) pFunc) (impl | implInterface, &version, &session);
}
else
{
DISPATCHER_LOG_BLOCK(("MFXInitEx(%s,ver=%u.%u,ExtThreads=%d,session=%p)\n"
, DispatcherLog_GetMFXImplString(impl | implInterface).c_str()
, apiVersion.Major
, apiVersion.Minor
, par.ExternalThreads
, &session));
mfxInitParam initPar = par;
// adjusting user parameters
initPar.Implementation = impl | implInterface;
initPar.Version = version;
====>> mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxInitParam, mfxSession *)) pFunc) (initPar, &session);
}
}
......
}
Prebuilt sample transcoding application in the MediaSDK runs good.
Any ideas?