NVIDIA VPI error when wrapping CUDA memory

I’m trying to use the NVIDIA VPI library to wrap some CUDA memory with the vpiImageCreateCudaMemWrapper function. However, when the wrapped image has a stride that is not multiple of 256 it gives the following warning/error (where 512 is replaced with the next multiple of the 256 for the current width, in my case I’m using 320):

sValidateSurfacePitch: Pitch must be greater than or equal to 512 and must be a multiple of 256
NvMediaEglValidateLocalTVMROutputSurface: Pitch validation failed
NvMediaEglFillLocalImageSurface: NvMediaEglValidateLocalTVMROutputSurface failed
NvMediaEglStreamConsumerAcquireCommon: Acquire: EGLExports.stream2.consumer.publicStateGet failed (4)
[WARN ] 2020-11-20 09:41:21 src/private/mem/img/Mapping_CUDAPitch_NvMediaImage.cpp:149 (cudaEGLStreamProducerReturnFrame:cudaErrorUnknown)
[NvMediaEglStreamConsumerAcquireImage:967] Consumer acquire failed: 7

Besides this warning, the program still works fine, and the image processing looks good.

My question is if this is still a valid error, a performance issue, or if it could lead to some undefined behavior I’m not aware of, since the function documentation does not say anything about it.


The error comes from EGL driver.
Please make sure the pitch to be the multiple of 256 and >= 512.