Skip to content

v4l2codecs: decoder: Reorder caps to prefer DMA_DRM ones

Robert Mader requested to merge rmader/gstreamer:issue3464 into main

Certain V4L2 fourccs don't (yet) have DRM counter parts, in which case we can't create DMA_DRM caps for them. This is usually the case for specific tilings, which are represented as modifiers for DMA formats.

While using these tilings is generally preferable - because of e.g. lower memory usage - it can result in additional conversion steps when interacting with DMA based APIs such as GL, Vulkan or KMS. In such cases using a DMA compatible format usually ends up being the better option.

Before the addition of DMA_DRM caps, this was what playbin3 ended up requesting in various cases - e.g. prefering NV12 over NV12_4L4 - but the addition of DMA_DRM caps seems to confuse the selection logic.

As a simple and quite robust solution, assume that peers supporting DMA_DRM caps always prefer these and reorder the caps accordingly.

In the future we plan to have a translation layer for cases where there is a matching fourcc+modifier pair for a V4L2 fourcc, ensuring optimal results.

Tested on iMX8MQ and RK3399 with good results.

Closes #3464 (closed)

Edited by Robert Mader

Merge request reports