shared memory between v4l2 user pointer buffer with OpenGl

Hi There,

I tried to use Opengl’s Pixel buffer object as user pointer memory for the V4l2 device, this might not be work, since there is no way to sync between buffer exporter( V4L2 ) and buffer importer( PBO ), and I confirmed this by passing userspace mapped PBO’s pointer to V4l2, when I set the device to stream, the kernel panic right away with syncing error, we actually using NVidia’s Tegra TX1 development kit, and we are not sure if DMABUF is supported or not on it’s lasted v4l2 driver(L4T R24.1), do anyone have the same situation or have experience with this. Thank you.

P.S.: Instead of memory copy the user pointer buffer to OPENGL’s texture, we are trying to avoid this by dumping video buffer directly in to PBO, so that GPU can use it to update the texture directly.


I figured out finally, so pixel buffer object should be kept mapping to userspace when queue it to v4l2 driver, and when the buffer is ready, it dequeue from V4l2 driver, it need unmap the buffer before giving GPU to render it, just a synchronous method which prevent CPU from conflicting with GPU.