Re: [PATCH 0/2] DCMI bridge support

From: Hans Verkuil
Date: Mon Apr 01 2019 - 09:30:14 EST


On 4/1/19 3:08 PM, Hugues FRUCHET wrote:
> Hi Hans,
>
> Here it is.
>
> SHA1 is aa371c995ec2ad70323db00c47b3132002b060b7:
>
> Author: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> 2019-02-08 16:21:23
> Committer: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> 2019-02-08 16:21:23
> Parent: 98d5622551eb6b9a0397464fb52378949f33c364 (v4l2-compliance:
> support m2m devices with -f)
> Child: 59f9840781aab464c1331dcdb82e63dd0544b5c6 (v4l2-compliance:
> remove duplicate MEDIA_IOC_DEVICE_INFO ioctl call)
> Branches: master, master2, remotes/origin/master
> Follows: v4l-utils-1.16.0
> Precedes:
>
> v4l2-compliance: -f bug fixes
>
>
> Result is below:
>
> root@stm32mp1:~# v4l2-compliance -m /dev/media0
> v4l2-compliance SHA: eb8e3b07c9249ff56091ae4bc3ae9b76779db4cd, 32 bits
>
> Compliance test for stm32-dcmi device /dev/media0:
>
> Media Driver Info:
> Driver name : stm32-dcmi
> Model : stm32-dcmi
> Serial :
> Bus info : platform:stm32-dcmi
> Media version : 5.0.0
> Hardware revision: 0x00000000 (0)
> Driver version : 5.0.0
>
> Required ioctls:
> test MEDIA_IOC_DEVICE_INFO: OK
>
> Allow for multiple opens:
> test second /dev/media0 open: OK
> test MEDIA_IOC_DEVICE_INFO: OK
> test for unlimited opens: OK
>
> Media Controller ioctls:
> test MEDIA_IOC_G_TOPOLOGY: OK
> Entities: 3 Interfaces: 2 Pads: 4 Links: 4
> test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK
> test MEDIA_IOC_SETUP_LINK: OK
>
> Total for stm32-dcmi device /dev/media0: 7, Succeeded: 7, Failed: 0,
> Warnings: 0
> --------------------------------------------------------------------------------
> Compliance test for stm32-dcmi device /dev/video0:
>
> Driver Info:
> Driver name : stm32-dcmi
> Card type : STM32 Camera Memory Interface
> Bus info : platform:dcmi
> Driver version : 5.0.0
> Capabilities : 0x85200001
> Video Capture
> Read/Write
> Streaming
> [ 2117.336477] stm32-dcmi 4c006000.dcmi:
> ================= START STATUS =================
> E[ 2117.344647] stm32-dcmi 4c006000.dcmi: White Balance, Automatic: true
> [ 2117.350990] stm32-dcmi 4c006000.dcmi: Blue Balance: 0 inactive
> x[ 2117.356853] stm32-dcmi 4c006000.dcmi: Red Balance: 0 inactive
> [ 2117.362645] stm32-dcmi 4c006000.dcmi: Auto Exposure: Auto Mode
> [ 2117.368438] stm32-dcmi 4c006000.dcmi: Exposure: 0 inactive volatile
> t[ 2117.374729] stm32-dcmi 4c006000.dcmi: Gain, Automatic: true
> [ 2117.380335] stm32-dcmi 4c006000.dcmi: Gain: 0 inactive volatile
> e[ 2117.386305] stm32-dcmi 4c006000.dcmi: Saturation: 64
> [ 2117.391275] stm32-dcmi 4c006000.dcmi: Hue: 0
> n[ 2117.395572] stm32-dcmi 4c006000.dcmi: Contrast: 0
> [ 2117.400305] stm32-dcmi 4c006000.dcmi: Test Pattern: Disabled
> d[ 2117.405988] stm32-dcmi 4c006000.dcmi: Horizontal Flip: false
> [ 2117.411721] stm32-dcmi 4c006000.dcmi: Vertical Flip: false
> [ 2117.417148] stm32-dcmi 4c006000.dcmi: Power Line Frequency: 50 Hz
> [ 2117.423265] stm32-dcmi 4c006000.dcmi: ================== END STATUS
> ==================
> ed Pix Format
> Device Capabilities
> Device Caps : 0x05200001
> Video Capture
> Read/Write
> Streaming
> Extended Pix Format
> Media Driver Info:
> Driver name : stm32-dcmi
> Model : stm32-dcmi
> Serial :
> Bus info : platform:stm32-dcmi
> Media version : 5.0.0
> Hardware revision: 0x00000000 (0)
> Driver version : 5.0.0
> Interface Info:
> ID : 0x03000003
> Type : V4L Video
> Entity Info:
> ID : 0x00000001 (1)
> Name : stm32_dcmi
> Function : V4L2 I/O
> Flags : default
> Pad 0x01000002 : 0: Sink
> Link 0x02000008: from remote pad 0x1000007 of entity 'mipid02
> 0-0014': Data, Enabled, Immutable
>
> Required ioctls:
> test MC information (see 'Media Driver Info' above): OK
> warn:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
> media bus_info 'platform:stm32-dcmi
> ' differs from V4L2 bus_info 'platform:dcmi'
> test VIDIOC_QUERYCAP: OK
>
> Allow for multiple opens:
> test second /dev/video0 open: OK
> warn:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
> media bus_info 'platform:stm32-dcmi
> ' differs from V4L2 bus_info 'platform:dcmi'
> test VIDIOC_QUERYCAP: OK
> test VIDIOC_G/S_PRIORITY: OK
> test for unlimited opens: OK
>
> Debug ioctls:
> test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
> test VIDIOC_LOG_STATUS: OK
>
> Input ioctls:
> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> test VIDIOC_G/S_FRE[ 2117.564770] mipid02 0-0014:
> ================= START STATUS =================
> Q[ 2117.572042] mipid02 0-0014: ================== END STATUS
> ==================
> UENCY: OK (Not Supported)
> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> test VIDIOC_ENUMAUDIO: OK (Not Supported)
> test VIDIOC_G/S/ENUMINPUT: OK
> test VIDIOC_G/S_AUDIO: OK (Not Supported)
> Inputs: 1 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> test VIDIOC_G/S_EDID: OK (Not Supported)
>
> Control ioctls (Input 0):
> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
> test VIDIOC_QUERYCTRL: OK
> test VIDIOC_G/S_CTRL: OK
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> Standard Controls: 17 Private Controls: 0
>
> Format ioctls (Input 0):
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> test VIDIOC_G/S_PARM: OK
> test VIDIOC_G_FBUF: OK (Not Supported)
> test VIDIOC_G_FMT: OK
> test VIDIOC_TRY_FMT: OK
> test VIDIOC_S_FMT: OK
> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> fail:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(1338):
> node->frmsizes_count[pixfmt] > 1
> test Cropping: FAIL
> test Composing: OK (Not Supported)
> test Scaling: OK (Not Supported)
>
> Codec ioctls (Input 0):
> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>
> Buffer ioctls (Input 0):
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> test VIDIOC_EXPBUF: OK
> test Requests: OK (Not Supported)
>
> Total for stm32-dcmi device /dev/video0: 45, Succeeded: 44, Failed: 1,
> Warnings: 2
> --------------------------------------------------------------------------------
> Compliance test for device /dev/v4l-subdev0:
>
>
> Required ioctls:
>
> Allow for multiple opens:
> test second /dev/v4l-subdev0 open: OK
> test for unlimited opens: OK
>
> Debug ioctls:
> test VIDIOC_LOG_STATUS: OK (Not Supported)
>
> Input ioctls:
> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> test VIDIOC_ENUMAUDIO: OK (Not Supported)
> test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDIO: OK (Not Supported)
> Inputs: 0 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> test VIDIOC_G/S_EDID: OK (Not Supported)
>
> Control ioctls:
> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
> test VIDIOC_QUERYCTRL: OK (Not Supported)
> test VIDIOC_G/S_CTRL: OK (Not Supported)
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> Standard Controls: 0 Private Controls: 0
>
> Format ioctls:
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
> test VIDIOC_G/S_PARM: OK (Not Supported)
> test VIDIOC_G_FBUF: OK (Not Supported)
> test VIDIOC_G_FMT: OK (Not Supported)
> test VIDIOC_TRY_FMT: OK (Not Supported)
> test VIDIOC_S_FMT: OK (Not Supported)
> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> test Cropping: OK (Not Supported)
> test Composing: OK (Not Supported)
> test Scaling: OK (Not Supported)
>
> Codec ioctls:
> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>
> Buffer ioctls:
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)
> test VIDIOC_EXPBUF: OK (Not Supported)
> test Requests: OK (Not Supported)
>
> Total for device /dev/v4l-subdev0: 40, Succeeded: 40, Failed: 0, Warnings: 0
>
> Grand Total for stm32-dcmi device /dev/media0: 92, Succeeded: 91,
> Failed: 1, Warnings: 2

The warnings should be fixed (both warnings refer to the same problem).

The fail was present before this patch series.

The core problem there is that if there are multiple possible framesizes,
then crop support is ambiguous: against which framesize do you crop?

I see that dcmi_try_fmt() has a heuristic for that. We really need to fix
this in the API, but this situation rarely occurs.

So for now I don't think there is a need to fix the fail.

Regards,

Hans

>
>
> BR,
> Hugues.
>
> On 4/1/19 1:10 PM, Hans Verkuil wrote:
>> Hi Hugues,
>>
>> On 4/1/19 11:31 AM, Hugues Fruchet wrote:
>>> This patch serie allows to connect non-parallel camera sensor to
>>> DCMI thanks to a bridge connected in between such as STMIPID02 [1].
>>>
>>> Media controller support is introduced first, then support of
>>> several sub-devices within pipeline with dynamic linking
>>> between them.
>>
>> Can you post the output of v4l2-compliance -m /dev/mediaX ?
>>
>> Thanks!
>>
>> Hans
>>
>>>
>>> [1] https://www.spinics.net/lists/devicetree/msg278002.html
>>>
>>> Hugues Fruchet (2):
>>> media: stm32-dcmi: add media controller support
>>> media: stm32-dcmi: add support of several sub-devices
>>>
>>> drivers/media/platform/Kconfig | 2 +-
>>> drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
>>> 2 files changed, 177 insertions(+), 38 deletions(-)
>>>