Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

How to Linux multithread to va-api hardware acceleration?

SeongHun_P_
Beginner
1,330 Views

 

Hello?

In a Linux environment, video transcoding is performed using multi-threading in an account with a video group.
The first thread is processing video transcoding 'va_getDriverName() failed with operation failed, driver_name = i965' when the second thread calls the CreateVAAPIDevice() function
However, when calling the CreateAVAPIDevice() function when executing the process with the root account, the iHD_drv_video.so library is called and processed normally

First thread..

libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0

Second thread..

libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 1
libva error: va_getDriverName() failed with operation failed,driver_name=i965
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

 


I want to run the program from a user other than the root account
Should a user in the video group call the CreateAVAPIDevice () function only once when the application is running?


Thanks in advance.

 


My Linux environment..

$ ll /opt/intel/mediasdk/lib64

drwxr-xr-x  2 root root       76  4월 28  2015 ./
drwxr-xr-x 10 root root     4096  5월 11 01:47 ../
-rwxr-xr-x  1 root root 25162960  2월 17  2015 iHD_drv_video.so*
-rwxr-xr-x  1 root root 10605896  2월 17  2015 libmfxhw64-p.so.1.14*
lrwxrwxrwx  1 root root       20  4월 28  2015 libmfxhw64.so -> libmfxhw64-p.so.1.14*


$ id
uid=201(k3) gid=200(informix) groups=200(informix),39(video)

$ ll /dev/dri

drwxr-xr-x  2 root root       100  5월 28 02:40 ./
drwxr-xr-x 19 root root      3220  5월 28 02:40 ../
crw-rw-rw-  1 root video 226,   0  5월 28 02:40 card0
crw-rw-rw-  1 root video 226,  64  5월 28 02:40 controlD64
crw-rw-rw-  1 root video 226, 128  5월 28 02:40 renderD128


$ vainfo
error: can't connect to X server!
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.35 (libva 1.3.1)
vainfo: Driver version: 16.4.32088-ubit
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : <unknown entrypoint>
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
      VAProfileMPEG4Main              : VAEntrypointVLD
      VAProfileH264Baseline           : VAEntrypointEncSlice
      VAProfileH264Baseline           : <unknown entrypoint>
      VAProfileH264Baseline           : <unknown entrypoint>
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : <unknown entrypoint>
      VAProfileH264Main               : <unknown entrypoint>
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : <unknown entrypoint>
      VAProfileH264High               : <unknown entrypoint>
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: <unknown entrypoint>
      VAProfileH264ConstrainedBaseline: <unknown entrypoint>
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : <unknown entrypoint>

$ env

LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
LIBVA_DRIVER_NAME=iHD
MFX_HOME=/opt/intel/mediasdk

 

 

0 Kudos
16 Replies
SeongHun_P_
Beginner
1,330 Views

First Thread..

libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0

Second Thread..

libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 1
libva error: va_getDriverName() failed with operation failed,driver_name=i965
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

0 Kudos
SeongHun_P_
Beginner
1,330 Views

environment..

LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64

LIBVA_DRIVER_NAME=iHD

MFX_HOME=/opt/intel/mediasdk

 

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

Hi,

It looks like your environment is messed up, could you send me your configuration? I mean the processor, the Linux distribution and the version of Media Server Studio.

But it looks like you are running the command under root which is not recommended, there should be only one case they you run the commands under root or sudo, when you try to install some binaries.

My suggestion is to have a new OS installation and re-do the installation. Here is the getting started guide you can follow:

https://software.intel.com/en-us/articles/how-to-setup-media-server-studio-on-secondary-os-of-linux

Please note in this article, there are just a few cases you should do sudo, for example, copy to /opt/intel... or "make install"

Mark Liu

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Thank you for your reply.
My environmental information.

$ uname -a
Linux 3.10.0-123.9.3.32088.MSSr3.el7.x86_64 #1 SMP Tue Apr 28 06:56:44 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)

$ MSDK version 
SDK2015ProductionEvaluation16.4.1

$ grep ^'model name' /proc/cpuinfo
model name      : Intel(R) Xeon(R) CPU E3-1286 v3 @ 3.70GHz

$ lspci -vnn | grep VGA -A 12
00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3 Processor Integrated Graphics Controller [8086:041a] (rev 06) (prog-if 00 [VGA controller])
        Subsystem: Super Micro Computer Inc Device [15d9:0805]
        Flags: bus master, fast devsel, latency 0, IRQ 64
        Memory at f7400000 (64-bit, non-prefetchable) [size=4M]
        Memory at e0000000 (64-bit, prefetchable) [size=256M]
        I/O ports at f000 [size=64]
        Expansion ROM at <unassigned> [disabled]
        Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [d0] Power Management version 2
        Capabilities: [a4] PCI Advanced Features
        Kernel driver in use: i915

00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)

 

One more question.

In a multithreaded environment, you create only one CreateAVAPIDevice() object,

Are there performance differences when creating and processing objects per thread?

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

Hello,

From the environment you posted, your system looks very old.

Is this the first time you install Media Server Studio or you are trying to fix an old system?

The symptom looks different from the system we used recently. If this is the first time you install the system, you might refer to the following article to install MSS on CentOS 7.1:

https://software.intel.com/en-us/articles/how-to-setup-and-deploy-media-server-studio-on-centos-71

From the hardware point of view, it seems have the graphic support required by MSS.

For your question, could you be more specific? I guess you are asking about running multi-thread transcoding and you are observed the difference of FPS number among different threads.

Mark Liu

 

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Thank you for your reply.

I trying to fix an existing system

 

For example, if call the CreateVAAPIDevice() function twice in one thread, the root account will load the iHD_drv_video.so library every time,

and the video group account will look for the i965_drv_video.so library on the second call.

Currently, the i965_drv_video.so library is not installed on my system.

I want to load only the iHD_drv_video.so library when I call the CreateVAAPIDevice() function in my video group account,
just like when running under the root account.

 

Thank you.

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

Thanks, I understand better now.

It looks like your environment variables get wrong, VAAPI should only look for iHD driver but not i965. You need to figure out why. Also you should not run under root, you need to run as normal user and fix the problem.

Mark

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Thank you for your reply.

What environment variables settings are wrong?

It is a server installed in 2015.

Try a clean installation again?

 

Thank you..

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

I don't know since the release is very old, I even don't have it.

But my point is, the libVA function(for example, va_getDriverName) should not load both iHD and i965 driver, you need to make sure it only load iHD driver.

Mark

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Thank you for your reply.

 

I will test again after clean installaion.

 

Thank you for you help.

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

Your "vainfo" command looks correct, it picked up the iHD driver; the first thread in the mulit-thread transcode seems also right but the second thread was wrong since it pick up i965, does the second thread has a wrong environment?

I never had this problem, I guess this might be caused by running under root, so this is why I was suggesting to avoid using root.

Mark

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Thank you for your reply.

For example, calling the CreateVAAPIDevice() function twice in the first thread will find the i965 driver.
However, when run from the root account, every time the CreateAVVAPIDevice() function is called, it looks for the iHD driver.

Thank you..

0 Kudos
SeongHun_P_
Beginner
1,330 Views
Please ask for additional answers.
 
 
My system installed 'SDK2015ProductionEvaluation16.4.1.tar.gz'
 
 
 
An error occurs because the kernel version differs from the SDK version
 
 
I'm using Intel Xeon E3-1286 v3 3.70Ghz CPU
 
i'd look at the SDK 2017 R2 Release Note.
 
4th Generation Core™ and earlier processors are not supported
by Media Server Studio 2017 R2.
 
 
If you purchase version 2016 and install it as above guide, will installation be normal?
 
 
Thank you for you help.
0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

Your processor is very old so our release doesn't support, we support N and N-1 generation processors, N means the processor generation when the Media package is released.

So either you use an old release to do a clean installation or you need to find a 5 or 6 generation processor.

Mark Liu

0 Kudos
SeongHun_P_
Beginner
1,330 Views

Please ask for additional answers.

Where can I find SDK 2015 or 2016 version installation guid on CentOS

Thank you for you help.

0 Kudos
Mark_L_Intel1
Moderator
1,330 Views

I apologize for late response.

I think I have told you we don't support the old version any more, and I don't know where I can find it.

Mark

0 Kudos
Reply