fdmem: always map dmabuf with PROT_WRITE
This is to enable zero copy inference on dmabufs. Gasket kernel driver
requires all user pointers passed to it to be writable in
even if it's not actually writing to the buffer. If we map a buffer
with GST_MAP_READ it'll be mmapped with PROT_READ and gasket will
error out with -EFAULT.
While a more correct solution is to fix the gasket driver the needed
linux/mm APIs aren't there in the current version of the kernel.
which is for a much later kernel version.
This change may look dangerous but what it really does is to make
dmabuf protection equal to buffers allocated by the system memory
allocator; i.e. even if you map a buffer with GST_MAP_READ only
you can, but should not, write to it.
3 files changed