Skip to content

media: vim2m: add multiplanar API support

Matthew Majewski linux-media lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3media: v4l2-common: Add RGBR format infodrivers/media/v4l2-core/v4l2-common.c+1 -00 replies
2/3media: vim2m: Simplify try_fmtdrivers/media/test-drivers/vim2m.c+12 -210 replies
3/3media: vim2m: Add parametized support for multiplanar APIdrivers/media/test-drivers/vim2m.c+267 -390 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] media: vim2m: add multiplanar API support

Hi everyone,

This patch series adds multiplane API support for the virtual M2M driver, along with some minor driver refactoring/improvements.

I followed the lead of the vivid driver and made multiplanar support selectable with a module parameter, and the default is to use the single planar api.

Although there are not yet any pixelformats in the driver that make use of multiple memory planes, adding support for these should be easier now with the API level changes taken care of.

v4l2-compliance reports the following with multiplane support disabled:

Total for vim2m device /dev/video0: 48, Succeeded: 48, Failed: 0, Warnings: 0

and the same with multiplane support enabled:

Total for vim2m device /dev/video0: 48, Succeeded: 48, Failed: 0, Warnings: 0

Patches need to be applied in increasing numerical order (Patch [3/3] depends on [1/3] and [2/3]).

Since the multi-plane changes had to touch a lot of the driver, I did a basic regression test with the following script which generates a test input image with vivid and an output image from vim2m for each supported format. I confirmed all outputs visually and verified they were identical to the outputs before the change. Testing was done on an x86_64 qemu image.

#!/bin/sh

# tested with HDMI vivid emulation
# modprobe vivid num_inputs=1 input_types=3

vim2m=/dev/video0
vivid=/dev/video1

width=640
height=480
out_width=320
out_height=240

capture_formats=$(v4l2-ctl -d $vim2m --list-formats | awk '/\]:/ {print $2}' | sed "s/'//g") output_formats=$(v4l2-ctl -d $vim2m --list-formats-out | awk '/\]:/ {print $2}' | sed "s/'//g")

# Turn off text mode so that images will be identical v4l2-ctl -d $vivid -c osd_text_mode=2

for ofmt in ${output_formats}; do

    # generate input image
    inname="${width}x${height}.${ofmt}"
    v4l2-ctl -d $vivid -v pixelformat=$ofmt,width=$width,height=$height,field=none \
             --stream-mmap --stream-count=1 --stream-to=$inname
    for cfmt in ${capture_formats}; do
        outname="${out_width}x${out_height}-out.${cfmt}"
        v4l2-ctl -d $vim2m -x pixelformat=$ofmt,width=$width,height=$height \
                 -v pixelformat=$cfmt,width=$out_width,height=$out_height \
                 --stream-from=$inname --stream-to=$outname --stream-mmap --stream-out-mmap \
                 --stream-count=1
    done
done

Matthew Majewski (3):
media: v4l2-common: Add RGBR format info
media: vim2m: Simplify try_fmt
media: vim2m: Add parametized support for multiplanar API

 drivers/media/test-drivers/vim2m.c    | 327 +++++++++++++++++++++-----
 drivers/media/v4l2-core/v4l2-common.c |   1 +
 2 files changed, 274 insertions(+), 54 deletions(-)
Signature · 1 line
2.25.1