(EXT) [PATCH v3 8/9] media: dw100: Add i.MX8MP dw100 dewarper driver

Xavier Roumegue (OSS) xavier.roumegue at oss.nxp.com
Thu Mar 10 08:18:34 PST 2022


Hello Alexander,

On 3/10/22 08:21, Alexander Stein wrote:
> Hello Xavier,
> 
> thanks for trying to mainline this hardware support.
> 
> Am Dienstag, 8. März 2022, 21:10:37 CET schrieb Xavier Roumegue:
>> Add a V4L2 mem-to-mem driver for the Vivante DW100 Dewarp Processor IP
>> core found on i.MX8MP SoC.
>>
>> The processor core applies a programmable geometrical transformation on
>> input image to correct distorsion introduced by lenses.
>> The transformation function is exposed as a grid map with 16x16 pixel
>> macroblocks indexed using X, Y vertex coordinates.
>>
>> The dewarping map can be set from application through dedicated a v4l2
>> control. If not set or invalid, the driver computes an identity map
>> prior to start the processing engine.
>>
>> The driver supports scaling, cropping and pixel format conversion.
>>
>> Signed-off-by: Xavier Roumegue <xavier.roumegue at oss.nxp.com>
>> ---
>> [snip]
>> diff --git a/drivers/media/platform/dw100/dw100.c
>> b/drivers/media/platform/dw100/dw100.c new file mode 100644
>> index 000000000000..7e1fcdfe5b91
>> --- /dev/null
>> +++ b/drivers/media/platform/dw100/dw100.c
>> @@ -0,0 +1,1744 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * DW100 Hardware dewarper
>> + *
>> + * Copyright 2022 NXP
>> + * Author: Xavier Roumegue (xavier.roumegue at oss.nxp.com)
>> + *
>> + */
>> [snip]
>> +static const struct v4l2_ctrl_config ctrl_custom_lut = {
>> +	.id = V4L2_CID_DW100_MAPPING,
>> +	.name = "Look-Up Table",
>> +	.type = V4L2_CTRL_TYPE_U32,
>> +	.min = 0x00000000,
>> +	.max = 0xFFFFFFFF,
>> +	.step = 1,
>> +	.def = 0,
>> +	.dims = { DW100_MAX_LUT_NELEMS },
>> +	.flags = V4L2_CTRL_FLAG_DYNAMIC_ARRAY,
>> +};
> 
> I know right now there is only one control, but you are reserving 16 controls
> in PATCH 5/9. So for me it seems sensible to make this an array already, so
> that additional controls can be added here easily.
Good point, will implement it in the next series.
Note that 16 is likely too much. I might decrease it.

> 
>> [snip]
>> +	hdl = &ctx->hdl;
>> +	v4l2_ctrl_handler_init(hdl, 1);
>> +	v4l2_ctrl_new_custom(hdl, &ctrl_custom_lut, NULL);
> 
> IMHO this won't need any further changes if an array is already being used.
> I'm eager to try it once you can provide an example how to use it.

I will provide as part of the driver documentation a simple python 
script example how to generate a LUT.

Releasing examples through NXP github will take few days, but you can 
have a try without a user specified LUT, using the identiy map computed 
by the driver.

#! /usr/bin/env bash

SRC_FMT=NV12
SINK_FMT=NV16

SW=640
SH=480
DW=320
DH=240


gst-launch-1.0 \
     -v videotestsrc pattern=18  num-buffers=1000 !\
     video/x-raw,format=NV16,width=${SW},height=${SH} !\
     v4l2convert !\
     video/x-raw,format=NV12,width=${DW},height=${DH} !\
     waylandsink window-width=${DW} window-height=${DH}

Regards,
Xavier



More information about the linux-arm-kernel mailing list