Creating NvMedia Capture and Display Surfaces

An application must set certain additional flags when it creates NvMedia images and video surfaces and feeds them to the NvMedia API:
NvMediaICPFeedFrame (capture)
NvMediaIDPFlip (display)
NvMediaVideoOutputFlip (display)
These flags enable surface allocation out of appropriate physically contiguous memory reserves, which is a requirement for capture and display hardware engines. They need not be set if the application is not feeding created surfaces to any of the three API functions listed above.
Additional Flag for NvMediaICPFeedFrame
Image capture surfaces that are fed to the NvMediaICPFeedFrame() function must be created by calling NvMediaImageCreate() with additional attribute flag NVMEDIA_IMAGE_ATTRIBUTE_CAPTURE.
If this flag is not set when a surface is created, the result may be an iommu error like this when capture is started:
Cannot use non-contiguous buffer w/IOMMU disabled
Subsequently an error like this may occur:
NvRmPrivFlush: NvRmChannelSubmit failed (err = 196623, SyncPointIdx = XX, SyncPointValue = 0)
Additional Flag for NvMediaIDPFlip
Image capture surfaces that are fed to the NvMediaIDPFlip() function must be created with the additional attribute flag NVMEDIA_IMAGE_ATTRIBUTE_DISPLAY.
If this flag is not set when a surface is created, the result may be a warning message like this:
WARNING: Using blit fallback. Performance will be affected
Additional Flag for NvMediaVideoOutputFlip
Image capture surfaces that are fed to the NvMediaVideoOutputFlip() function must be created with the additional attribute flag NVMEDIA_SURFACE_CREATE_ATTRIBUTE_DISPLAY.
If this flag is not set when a surface is created, the may be a warning message like:
WARNING: Using blit fallback. Performance will be affected

Where Surfaces with Additional Flags Are Created

Surfaces created for capture using the NVMEDIA_IMAGE_ATTRIBUTE_CAPTURE flag are created in carveout memory, which is physically contiguous memory visible only to the current partition.
Surfaces created for display using the NVMEDIA_IMAGE_ATTRIBUTE_DISPLAY or NVMEDIA_SURFACE_CREATE_ATTRIBUTE_DISPLAY flag are created in the following locations:
If the display hardware/server is owned by the same partition as the application that creates the surfaces, in carveout memory.
If the display hardware/server is owned by another partition, in a shared memory pool reserve (a different reserve than carveout). This shared memory pool is accessible to the partition that owns the display hardware/server in addition to being physically contiguous.
Surfaces that have both “capture” and “display” flags set are created according to the rules that apply to surfaces created for display.

Insufficient Memory Fault

If an application requires more space for capture surfaces than is available, the application may fail with the message:
NvMediaImageAllocBuffer: Unable to create surface
To correct this problem you must increase the carveout size. For information about increasing the carveout size, see the Memory Carveouts chapter in the NVIDIA DRIVE OS 5.1 Linux PDK Development Guide.