Specifying Requirements
Buffer data flows from the producer to the consumer(s). The producer must query the NVIDIA drivers they use for buffer attribute lists that provide write capability, while consumers must query for buffer attributes that provide read capability. If the buffer memory is written or read directly with the CPU, attribute lists can be manually created, requesting CPU access.
A packet may consist of multiple buffer elements containing different types of data. The producer must obtain a buffer attribute list for each type of data it can generate, and consumers must obtain attribute lists for each type of data they require.
Once a producer knows all the elements it can provide, or a consumer knows all the
elements it requires, it can inform the stream by calling
NvSciStreamBlockElementAttrSet()
(operational after
NvSciStreamEventType_Connected
is queried) for each element. The
userType
parameter is an application-defined value to identify the
element, understood by both the producer and consumer. The userType
should be unique for each element. The bufAttrList
field contains a
handle for the element's attribute list. Ownership of this handle remains with the
caller, and it deletes it when it is no longer needed after the function returns.
NvSciStream creates a duplicate.
After specifying all of the elements, the application indicates it finished element setup
by calling NvSciStreamBlockSetupStatusSet()
with a value of
NvSciStreamSetup_ElementExport
. NvSciStream automatically
determines the indices and count.
Asynchronous elements data is not available to the consumer until the fences complete. This generally indicates data written using NVIDIA hardware. Synchronous elements data is available to be read as soon as the packet is acquired by the consumer, without waiting for a fence. This generally indicates data written directly with the CPU. Sync requirements setup steps determine whether an element is asynchronous or synchronous.
A typical use case is that a packet contains both asynchronous and synchronous elements: a packet containing a large primary data element accompanied by a smaller metadata element. The smaller element contains information to program the hardware for processing the primary element. Upon acquiring the packet, the CPU must read the metadata immediately so that instructions for the NVIDIA drivers can be issued. The primary data is read later once the fence has been reached.
NvSciError
NvSciStreamBlockElementAttrSet(
NvSciStreamBlock const block,
uint32_t const userType,
NvSciBufAttrList const bufAttrList
)