[RFC]: shmem fd for non-DMA buffer sharing cross drivers

From: Hsia-Jun Li
Date: Tue Aug 22 2023 - 07:14:53 EST


Hello

I would like to introduce a usage of SHMEM slimier to DMA-buf, the major purpose of that is sharing metadata or just a pure container for cross drivers.

We need to exchange some sort of metadata between drivers, likes dynamic HDR data between video4linux2 and DRM. Or the graphics frame buffer is too complex to be described with plain plane's DMA-buf fd.
An issue between DRM and V4L2 is that DRM could only support 4 planes while it is 8 for V4L2. It would be pretty hard for DRM to expend its interface to support that 4 more planes which would lead to revision of many standard likes Vulkan, EGL.

Also, there is no reason to consume a device's memory for the content that device can't read it, or wasting an entry of IOMMU for such data.
Usually, such a metadata would be the value should be written to a hardware's registers, a 4KiB page would be 1024 items of 32 bits registers.

Still, I have some problems with SHMEM:
1. I don't want thhe userspace modify the context of the SHMEM allocated by the kernel, is there a way to do so?
2. Should I create a helper function for installing the SHMEM file as a fd?

--
Hsia-Jun(Randy) Li