Using NvSciSyncFence from NvMediaIDE to as a prefence to NvMedia2D

Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.10.0
DRIVE OS 6.0.8.1
DRIVE OS 6.0.6
DRIVE OS 6.0.5
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other

Target Operating System
Linux
QNX
other

Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-300)
DRIVE AGX Orin Developer Kit (940-63710-0010-200)
DRIVE AGX Orin Developer Kit (940-63710-0010-100)
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
other

SDK Manager Version
2.1.0
other

Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
other

Issue Description
Hey all, I believe that it is possible to use the EOF fence from NvMediaIDE as a pre-fence to NvMedia2D, but I am getting some errors in setting up the right NvSciSyncObj and some errors in getting the EOF from NvMediaIDE and/or inserting a pre-fence to NvMedia2D.

Steps Tried
What are the restrictions / steps in creating the NvSciSyncObj? If both engines run from the same process, do we only need 1x NvSciSyncObj shared between both engines? It seems to me that we can only register 1x NvSciSyncObj allocated with a particular engine attributes, and doing otherwise would throw a NVMEDIA_STATUS_BAD_PARAMETER (see below).

// Create attribute lists and fill it with engine attributes.
NvMediaIDEFillNvSciSyncAttrList(decoder, nvmedia_ide_attr_list, NVMEDIA_SIGNALER_WAITER));
NvMedia2DFillNvSciSyncAttrList(compositor, nvmedia_2d_attr_list, NVMEDIA_SIGNALER_WAITER));

// Reconcile above attributes list ==> Error here since both attributes are set.
NvSciSyncAttrListReconcile(unreconciled_attr_list, 2, &reconciled_attr_list, &conflict_list);

// Unable to proceed to allocate and register NvSciSyncObj.

If I were to use only the NvMediaIDE attributes to create the NvSciSyncObj and then try to insert the fence to NvMedia2D, I also get a NVMEDIA_STATUS_BAD_PARAMETER.

NvMediaIDEFillNvSciSyncAttrList(decoder, nvmedia_ide_attr_list, NVMEDIA_SIGNALER_WAITER));
NvSciSyncAttrListReconcile(unreconciled_attr_list, 1, &reconciled_attr_list, &conflict_list);
NvMediaIDERegisterNvSciSyncObj(decoder, NVMEDIA_EOF_PRESYNCOBJ, sync_obj);
NvMediaIDESetNvSciSyncObjforEOF(decoder, sync_obj);
NvMediaIDEGetEOFNvSciSyncFence(decoder, sync_obj, &fence);  // works.

NvMedia2DGetComposeParameters(compositor, &compositor_params);
NvMedia2DInsertPreNvSciSyncFence(compositor, compositor_params, &fence);  // errors out. 

Vice versa, if I were to allocate & register the NvSciSyncObj with NvMedia2D, I would instead fail at NvMediaIDESetNvSciSyncObjforEOF with the error NVMEDIA_STATUS_BAD_PARAMETER. And if I don’t set the NvSciSyncObjwith NvMediaIDE, I am unable to retrieve the EOF fence from the decoder either.

NvMedia2DEFillNvSciSyncAttrList(compositor, nvmedia_2d_attr_list, NVMEDIA_SIGNALER_WAITER));
NvSciSyncAttrListReconcile(unreconciled_attr_list, 1, &reconciled_attr_list, &conflict_list);
NvMedia2DRegisterNvSciSyncObj(compositor, NVMEDIA_EOF_PRESYNCOBJ, sync_obj);
// NvMediaIDERegisterNvSciSyncObj(decoder, NVMEDIA_EOF_PRESYNCOBJ, sync_obj); // not called since you can't register twice.
NvMediaIDESetNvSciSyncObjforEOF(decoder, sync_obj);  // fails here.
NvMediaIDEGetEOFNvSciSyncFence(decoder, sync_obj, &fence);  // fails here if i step registering & setting.

Question
Could you kindly share how to setup the NvSciSyncObj and pass the fence from engine to engine? I assume this would be possible due to the topic here: How to shorten the image process time.

Thanks in advance!
Sam

1 Like

Dear @samuel.ongzx ,
Do you share the same nvscibuf across IDE and 2D engines?

The reconciliation must be failing because both NvMediaXXXFillNvSciSyncAttrList APIs are setting NVMEDIA_SIGNALER_WAITER as permissions.
There must be only one signaler and others should have waiter perms(https://developer.nvidia.com/docs/drive/drive-os/6.0.10/public/drive-os-linux-sdk/api_reference/group__nvsci__sync.html#ggaf658186347b163ac92eedf461d27a926a10214610e0f7c3862832fb6b4ad4e56c)

1 Like

Thanks @SivaRamaKrishnaNV for the clarification, I got it sorted out.

For anybody looking for similar implementation:

  • IDE => 2D is one NvSciSyncObj, fill sync_obj with IDE signal attr and 2D waiter attr, register sync_obj with both IDE & 2D, set sync_obj as EOF sync_obj for IDE. And you can get EOF fence from IDE and insert a pre-fence to 2d.
  • For 2D => CPU / other engine, fill sync_obj with 2D waiter attr, and either CPU waiter attr or other engine waiter attr. And you can get EOF fence from 2d and pass on the fence.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.