Usage of NvMediaImageLock with NvSciBuf

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
other

Target Operating System
Linux
QNX
other

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.7.0.8846
other

Host Machine Version
native Ubuntu 18.04
other

Hi, now I’m trying to get data from HW accelerator with NvSciBuf.

In this thread, the test code use NvMediaImageLock befor Getbits and NvMediaImageUnlock after Getbits.
But, NvMediaImageLock/Unlock is too slow, so I don’t want to use this.
Must I use NvMediaImageLock/Unlock with NvSciBuf?
If I don’t use ImageLock before getbits, is there any problems?

Thanks.

Dear @Yuhei.A.Kamei,

If I don’t use ImageLock before getbits, is there any problems?

Locking is prerequisite before using NvMediaImageGetBits. Please check thttps://docs.nvidia.com/drive/drive-os-5.2.6.0L/drive-os/DRIVE_OS_Linux_SDK_NGC_Development_Guide/baggage/group__image__get__put__bits.html#ga06ac77c643d9268347360efbfbc7113a

Thanks for your reply @SivaRamaKrishnaNV

Locking is prerequisite before using NvMediaImageGetBits.

I understand this.
In the case of using Scibuf and getting the data by NvSciBufObjGetCpuPtr and memcpy, should I use NvMediaImageLock too?

And in below document, there is the sentence that “NvMediaImageLock is for diagnostics purposes only. They are not for use in production code.”
In production code, how do I get the data from HW accelerator?

1 Like

Dear @Yuhei.A.Kamei,
how do I get the data from HW accelerator?

I notice in the thread you pointed you planned to use CPU imge buffer as input to pipeline. Could you confirm your application pipeline/pseudo code(pipeline which show how you plan to use NvSciBufs,NvmediaImage for our understanding.

Now I want to use SIPL for capturing and developing images.
But NvMadiaImageLock is too rate(about 30ms) and Nvidia’s document say that NvMediaImageLock should not use in production code, so I don’t want to use this.
Now I try to get images from ISP by NvSciBufObjGetCpuPtr in CNvSIPLConsumer.
Things I want you to tell are these 2 points.

  1. Must I call NvMediaImageLock before calling NvSciBufObjGetCpuPtr?
  2. In production code, how do I get image data from ISP without NvMediaImageLock?

May we know how you want to use the data?

We want to get the captured and developed data from ISP (in SIPL pipeline)
In 30FPS

Is it for production purposes?
Have you referred to “-f” option of nvsipl_camera?

Hi, thank you for your reply.
I already referred to -f option.
And I send the data getting by NvMediaImageGetBits to our recognition application in our production code.
This process was implemented with reference to -f option of nvsipl_camera.

Did you mean your recognition application needs CPU access to images from SIPL? Is such a whole use case or pipeline for production?

In that case, NvMediaImageLock() is not needed, but you need to wait on the ISP post-fence to make sure ISP has finished writing the image before reading the NvSciBuf. You need to call GetEOFNvSciSyncFence() and then wait on the returned fence with NvSciSyncFenceWait().

BTW, NvSciBufObjGetCPUPtr() works only for pitch-linear surfaces.