[libcamera-devel,00/14] Add dw100 dewarper support to simple/rkisp1 pipeline
mbox series

Message ID 20220908184850.1874303-1-xavier.roumegue@oss.nxp.com
Headers show
Series
  • Add dw100 dewarper support to simple/rkisp1 pipeline
Related show

Message

Xavier Roumegue Sept. 8, 2022, 6:48 p.m. UTC
Hello,

This patch set adds support for i.MX8MP DW100 dewarper in simple/rkisp1 pipeline
handler. The dw100 can be used as generic size and format converter, and/or as
dewarper engine in case a configuration file with vertices mappings is exposed
to the pipeline through an environment variable.

An abstract base class converter interface is created based on the existing
converter implementation in the simple pipeline handler.

The v4l2 m2m converter implementation found in simple pipeline is derived from
this base class and can be used in any pipelines. The application can load
a configuration file to apply any runtime settings on derived class implementing
those methods.

The dw100 converter is derived from this v4l2 m2m converter class offering the
capability to load and apply vertices remapping on its incoming streams.

An example script to generate dw100 remapping configuration file can be found
on NXPmicro github site [1].

For example, to generate mappings file applying a hflip/vflip transformations on
streams:

./bin/generate-dw100-map-blob.py \
	--hflip \
	--vflip \
	--sourceResolution 1920 1080 \
	--destinationResolution 1920 1080 \
	--yaml \
	--outputFile map-dw100

./bin/generate-dw100-map-blob.py \
	--hflip \
	--vflip \
	--sourceResolution 640 480 \
	--destinationResolution 640 480 \
	--yaml \
	--outputFile map-dw100

bin/create-all-dw100-mapping-yaml.py \
	map-dw100-1920x1080_1920x1080.yaml \
	map-dw100-640x480_640x480.yaml \
	--outputFile map-dw100

A map-dw100.yaml configuration file is created with those previous mappings.

This configuration file can be instructed to be loaded by the pipeline thanks to
the environment variables below.

export LIBCAMERA_RKISP1_CONVERTER_FILE=map-dw100.yaml
export LIBCAMERA_SIMPLE_CONVERTER_FILE=map-dw100.yaml

I tested this patch set on i.MX8MP on both pipelines. As i.MXP8MP supports only
one path (main path only, no self path), dual path configuration with active
converters on both streams in rkisp1 pipeline has not been tested.

Regards,
 Xavier

[1] - https://github.com/NXPmicro/vtec-cv/tree/main/bin

Xavier Roumegue (14):
  libcamera: v4l2_device: Add support for V4L2_CTRL_TYPE_U32
  libcamera: v4l2_device: Overload open() to duplicate File descriptor
  libcamera: v4l2_videodevice: Move FD duplication in V4L2Device::Open
  libcamera: Declare generic size and format converter interface
  libcamera: converter: Add queueBuffer() helper
  libcamera: converter: Add v4l2 m2m converter implementation
  include: linux: Update headers for dw100/dynamic array support
  libcamera: yaml_parser: Increase sentinel to 100k
  libcamera: converter: Introduce dw100 converter
  libcamera: pipeline: simple: converter: Use generic converter
    interface
  libcamera: pipeline: simple: Add dw100 converter to mxc-isi
    configuration
  libcamera: pipeline: simple: Load a converter configuration file (if
    any)
  libcamera: pipeline: rkisp1: Factorize errors handling path on start()
  libcamera: pipeline: rkisp1: Add converter support

 include/libcamera/internal/converter.h        | 107 +++++
 include/libcamera/internal/converter_dw100.h  |  25 ++
 .../libcamera/internal/converter_v4l2_m2m.h   |  88 +++--
 include/libcamera/internal/meson.build        |   3 +
 include/libcamera/internal/v4l2_device.h      |   2 +
 include/linux/dw100.h                         |  14 +
 include/linux/v4l2-controls.h                 |   6 +
 include/linux/videodev2.h                     |   2 +
 src/libcamera/converter.cpp                   | 102 +++++
 src/libcamera/converter_dw100.cpp             |  32 ++
 .../converter.cpp => converter_v4l2_m2m.cpp}  | 205 +++++++---
 src/libcamera/meson.build                     |   3 +
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 171 ++++----
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 374 +++++++++++++++++-
 src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  54 ++-
 src/libcamera/pipeline/simple/meson.build     |   1 -
 src/libcamera/pipeline/simple/simple.cpp      |  16 +-
 src/libcamera/v4l2_device.cpp                 |  35 ++
 src/libcamera/v4l2_videodevice.cpp            |  12 +-
 src/libcamera/yaml_parser.cpp                 |   4 +-
 20 files changed, 1060 insertions(+), 196 deletions(-)
 create mode 100644 include/libcamera/internal/converter.h
 create mode 100644 include/libcamera/internal/converter_dw100.h
 rename src/libcamera/pipeline/simple/converter.h => include/libcamera/internal/converter_v4l2_m2m.h (64%)
 create mode 100644 include/linux/dw100.h
 create mode 100644 src/libcamera/converter.cpp
 create mode 100644 src/libcamera/converter_dw100.cpp
 rename src/libcamera/{pipeline/simple/converter.cpp => converter_v4l2_m2m.cpp} (59%)