Is NvMedia2DBlitEx thread safe?

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
DRIVE OS Linux 5.2.6 and DriveWorks 4.0
[√] DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version

Target Operating System
[√] Linux

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
[√] NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)

SDK Manager Version

Host Machine Version
[√] native Ubuntu 18.04

Is it safe to call NvMedia2DBlitEx in different thread at the same time?

Dear @liuq1,
No. NvMedia APIs are not thread safe.

Thanks. I would like to seek further advice:
(1)We have run 4 cameras and will also have 4 SIPL worker threads. This means that it is not safe for me to call NvMedia2DBlitEx separately in four SIPL threads, is it?

(2)For example, if I have two SIPL threads A and B, I need to perform 2d conversion operations separately. I need to ensure that thread A completes the 2D conversion work before calling thread B’s 2D conversion function.

(2)After calling NvMedia2DBlitEx and returning, it does not mean that the 2D conversion has been completed, does it?


Dear @liuq1,

  1. You may call NvMedia2DBlitEx. but you need to make only one thread actively uses NvMedia2DBlitEx as it is not thread safe
  2. Yes
  3. Yes. Please see NVIDIA DRIVE OS Linux SDK API Reference: Image 2D Processing Synchronization | NVIDIA Docs helps

Thanks @SivaRamaKrishnaNV .
I read the docs and have one question:
If i call NvMedia2DBlitEx and the function return, i use NvMediaImageLock to try to read the NvMediaImage. Does the NvMediaImageLock would wait the NvMedia2DBlitEx finish?


Is there anyone help answer this question, thanks.

Dear @liuq1,
Yes. NvMediaImageLock will wait.