Hi Nicolas,
On Wed, May 15, 2024 at 01:43:58PM -0400, nicolas.dufresne@collabora.corp-partner.google.com wrote:
Le mardi 14 mai 2024 à 23:42 +0300, Laurent Pinchart a écrit :
You'll hit the same limitation as we hit in GStreamer, which is that KMS driver only offer allocation for render buffers and most of them are missing allocators for YUV buffers, even though they can import in these formats. (kms allocators, except dumb, which has other issues, are format aware).
My experience on Arm platforms is that the KMS drivers offer allocation for scanout buffers, not render buffers, and mostly using the dumb allocator API. If the KMS device can scan out YUV natively, YUV buffer allocation should be supported. Am I missing something here ?
There is two APIs, Dumb is the legacy allocation API, only used by display
Is it legacy only ? I understand the dumb buffers API to be officially supported, to allocate scanout buffers suitable for software rendering.
drivers indeed, and the API does not include a pixel format or a modifier. The allocation of YUV buffer has been made through a small hack,
bpp = number of bits per component (of luma plane if multiple planes) width = width height = height * X
Where X will vary, "3 / 2" is used for 420 subsampling, "2" for 422 and "3" for 444. It is far from idea, requires deep knowledge of each formats in the application
I'm not sure I see that as an issue, but our experiences and uses cases may vary :-)
and cannot allocate each planes seperatly.
For semi-planar or planar formats, unless I'm mistaken, you can either allocate a single buffer and use it with appropriate offsets when constructing your framebuffer (with DRM_IOCTL_MODE_ADDFB2), or allocate one buffer per plane.
The second is to use the driver specific allocation API. This is then abstracted by GBM. This allows allocating render buffers with notably modifiers and/or use cases. But no support for YUV formats or multi-planar formats.
GBM is the way to go for render buffers indeed. It has been designed with only graphics buffer management use cases in mind, so it's unfortunately not an option as a generic allocator, at least in its current form.