linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Bingbu Cao <bingbu.cao@linux.intel.com>,
	"Mani, Rajmohan" <rajmohan.mani@intel.com>,
	Tomasz Figa <tfiga@chromium.org>,
	"Zhi, Yong" <yong.zhi@intel.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	"Zheng, Jian Xu" <jian.xu.zheng@intel.com>,
	"Hu, Jerry W" <jerry.w.hu@intel.com>,
	"Toivonen, Tuukka" <tuukka.toivonen@intel.com>,
	"Qiu, Tian Shu" <tian.shu.qiu@intel.com>,
	"Cao, Bingbu" <bingbu.cao@intel.com>,
	libcamera-devel@lists.libcamera.org
Subject: Re: [PATCH v7 00/16] Intel IPU3 ImgU patchset
Date: Mon, 28 Jan 2019 11:09:06 +0100	[thread overview]
Message-ID: <20190128100906.lkly33nz63gp7grr@uno.localdomain> (raw)
In-Reply-To: <20190102202652.s4xha4vqhmt7qwsh@mara.localdomain>

[-- Attachment #1: Type: text/plain, Size: 11592 bytes --]

Hi Sakari, everyone..

On Wed, Jan 02, 2019 at 10:26:56PM +0200, Sakari Ailus wrote:
> Hi Laurent,
>
> On Wed, Jan 02, 2019 at 10:20:13AM +0200, Laurent Pinchart wrote:
> > Hello Bingbu,
> >
> > On Wednesday, 2 January 2019 04:38:33 EET Bingbu Cao wrote:
> > > On 12/26/2018 07:03 PM, Laurent Pinchart wrote:
> > > > On Monday, 17 December 2018 05:14:44 EET Bingbu Cao wrote:
> > > >> On 12/14/2018 06:24 AM, Laurent Pinchart wrote:
> > > >>> On Wednesday, 12 December 2018 06:55:53 EET Bingbu Cao wrote:
> > > >>>> On 12/11/2018 09:43 PM, Laurent Pinchart wrote:
> > > >>>>> On Tuesday, 11 December 2018 15:34:49 EET Laurent Pinchart wrote:
> > > >>>>>> On Wednesday, 5 December 2018 02:30:46 EET Mani, Rajmohan wrote:
> > > >>>>>>
> > > >>>>>> [snip]
> > > >>>>>>
> > > >>>>>>> I can see a couple of steps missing in the script below.
> > > >>>>>>> (https://lists.libcamera.org/pipermail/libcamera-devel/2018-November
> > > >>>>>>> /000040.html)
> > > >>>>>>>
> > > >>>>>>>    From patch 02 of this v7 series "doc-rst: Add Intel IPU3
> > > >>>>>>>    documentation", under section "Configuring ImgU V4L2 subdev for
> > > >>>>>>>    image processing"...
> > > >>>>>>>
> > > >>>>>>> 1. The pipe mode needs to be configured for the V4L2 subdev.
> > > >>>>>>>
> > > >>>>>>> Also the pipe mode of the corresponding V4L2 subdev should be set as
> > > >>>>>>> desired (e.g 0 for video mode or 1 for still mode) through the
> > > >>>>>>> control id 0x009819a1 as below.
> > > >>>>>>>
> > > >>>>>>> e.g v4l2n -d /dev/v4l-subdev7 --ctrl=0x009819A1=1
> > > >>>>>>
> > > >>>>>> I assume the control takes a valid default value ? It's better to set
> > > >>>>>> it explicitly anyway, so I'll do so.
> > > >>>>
> > > >>>> The video mode is set by default. If you want to set to still mode or
> > > >>>> change mode, you need set the subdev control.
> > > >>>>
> > > >>>>>>> 2. ImgU pipeline needs to be configured for image processing as
> > > >>>>>>> below.
> > > >>>>>>>
> > > >>>>>>> RAW bayer frames go through the following ISP pipeline HW blocks to
> > > >>>>>>> have the processed image output to the DDR memory.
> > > >>>>>>>
> > > >>>>>>> RAW bayer frame -> Input Feeder -> Bayer Down Scaling (BDS) ->
> > > >>>>>>> Geometric Distortion Correction (GDC) -> DDR
> > > >>>>>>>
> > > >>>>>>> The ImgU V4L2 subdev has to be configured with the supported
> > > >>>>>>> resolutions in all the above HW blocks, for a given input
> > > >>>>>>> resolution.
> > > >>>>>>>
> > > >>>>>>> For a given supported resolution for an input frame, the Input
> > > >>>>>>> Feeder, Bayer Down Scaling and GDC blocks should be configured with
> > > >>>>>>> the supported resolutions. This information can be obtained by
> > > >>>>>>> looking at the following IPU3 ISP configuration table for ov5670
> > > >>>>>>> sensor.
> > > >>>>>>>
> > > >>>>>>> https://chromium.googlesource.com/chromiumos/overlays/board-overlays
> > > >>>>>>> /+/master/baseboard-poppy/media-libs/cros-camera-hal-configs-poppy/
> > > >>>>>>> files/gcss/graph_settings_ov5670.xml
> > > >>>>>>>
> > > >>>>>>> For the ov5670 example, for an input frame with a resolution of
> > > >>>>>>> 2592x1944 (which is input to the ImgU subdev pad 0), the
> > > >>>>>>> corresponding resolutions for input feeder, BDS and GDC are
> > > >>>>>>> 2592x1944, 2592x1944 and 2560x1920 respectively.
> > > >>>>>>
> > > >>>>>> How is the GDC output resolution computed from the input resolution ?
> > > >>>>>> Does the GDC always consume 32 columns and 22 lines ?
> > > >>>>
> > > >>>> All the intermediate resolutions in the pipeline are determined by the
> > > >>>> actual use case, in other word determined by the IMGU input
> > > >>>> resolution(sensor output) and the final output and viewfinder
> > > >>>> resolution. BDS mainly do Bayer downscaling, it has limitation that the
> > > >>>> downscaling factor must be a value a integer multiple of 1/32.
> > > >>>> GDC output depends on the input and width should be x8 and height x4
> > > >>>> alignment.
> > > >>>
> > > >>> Thank you for the information. This will need to be captured in the
> > > >>> documentation, along with information related to how each block in the
> > > >>> hardware pipeline interacts with the image size. It should be possible
> > > >>> for a developer to compute the output and viewfinder resolutions based
> > > >>> on the parameters of the image processing algorithms just with the
> > > >>> information contained in the driver documentation.
> > > >>>
> > > >>>>>>> The following steps prepare the ImgU ISP pipeline for the image
> > > >>>>>>> processing.
> > > >>>>>>>
> > > >>>>>>> 1. The ImgU V4L2 subdev data format should be set by using the
> > > >>>>>>> VIDIOC_SUBDEV_S_FMT on pad 0, using the GDC width and height
> > > >>>>>>> obtained
> > > >>>>>>> above.
> > > >>>>>>
> > > >>>>>> If I understand things correctly, the GDC resolution is the pipeline
> > > >>>>>> output resolution. Why is it configured on pad 0 ?
> > > >>>>
> > > >>>> We see the GDC output resolution as the input of output system, the
> > > >>>> sink pad format is used for output and viewfinder resolutions.
> > > >>>
> > > >>> The ImgU subdev is supposed to represent the ImgU. Pad 0 should thus be
> > > >>> the ImgU input, the format configured there should correspond to the
> > > >>> format on the connected video node, and should thus be the sensor
> > > >>> format. You can then use the crop and compose rectangles on pad 0, along
> > > >>> with the format, crop and compose rectangles on the output and
> > > >>> viewfinder pads, to configure the device. This should be fixed in the
> > > >>> driver, and the documentation should then be updated accordingly.
> > > >>
> > > >> Hi, Laurent,
> > > >>
> > > >> Thanks for your review.
> > > >>
> > > >> I think it make sense for me that using Pad 0 as the ImgU input(IF).
> > > >> However, I prefer using the 2 source pads for output and viewfinder.
> > > >> It makes more sense because the output and viewfinder are independent
> > > >> output.
> > > >>
> > > >> The whole pipeline in ImgU looks like:
> > > >> IF --> BDS --> GDC ---> OUTPUT
> > > >>                   |-----> VF
> > > >>
> > > >> The BDS is used to do Bayer downscaling and GDC can do cropping.
> > > >
> > > > Does this mean that the main output and the viewfinder output share the
> > > > same scaler, and that the only difference in size between the two outputs
> > > > is solely due to cropping ?
> > >
> > > Laurent,
> > > No, output only can do crop and viewfinder support crop and scaling, they
> > > share same input.
> >
> > Then you can't support this with a single subdev for the ImgU, you need at
> > least two subdevs. I can offer more guidance, but I'll need more information
> > about the GDC.
>
> While the current documentation only defines the functionality of the
> compose target for sink pads, there are a few sensor drivers supporting it
> on source pads already. Some drivers such as the OMAP3 ISP also use the
> format on source pads to configure scaling.
>
> The current API certainly allows exposing the compose rectangle also on the
> source pads, but to make that generic we'd need to amend the API to tell in
> which order these steps take place. In the meantime the behaviour remains
> device specific.
>

My understanding is that what is currently missing is the support
for viewfinder's ability to scale, as the scaler should get
programmed by configuring a composing rectangle on a source pad which
is not supported by the V4L2 APIs at the moment. Is my understanding correct?

As the composing rectangle is set for both 'output' and 'viewfinder'
through the image format sizes configured on the first sink pad (*),
the viewfinder output is obtained by cropping-only to the image format
sizes configured on source pad number 3 (though SUBDEV_S_FMT not through
SUBDEV_S_SELECTION, as SUBDEV_S_SELECTION is only allowed on sink pad
0 in the driver: see "ipu3_subdev_set_selection()").

As you mentioned "device specific behaviour", what is the intended one
for the ipu3? I assumed the viewfinder scaling/cropping was configured
on the 'viewfinder' video device node, through the VIDIOC_S_SELECTION
ioctl, but looking at the code, that doesn't seem to be listed as
supported in "ipu3_v4l2_ioctl_ops".

How am I supposed to configure scaling on the viewfinder output? Would
adding support for crop/compose to the 'output' and 'viewfinder' video
devices be supported by the V4L2 APIs? That would work with the single
subdevice model that is currently implemented in this patches...

Thanks
   j

(*) and this should also be changed, as the image format sizes should
reflect what the imgu receives as input, and the crop() and compose()
rectangles should instead be used to configure BDS and GDC
respectively.

> >
> > > >> My understanding is that scaled size is configured on the CROP rectangle
> > > >> by COMPOSE selection target, the order seems like not aligned with the
> > > >> actual processing in ImgU if we set the crop/compose on sink pad.
> > > >>
> > > >> Is there some rules for the order of the configuration in the subdev API?
> > > >> Could I use crop selection based on the scaled size?
> > > >
> > > > Please see figure 4.6 in
> > > > https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-subdev.html.
> > > > Scaling is configured on the sink pad through the crop and compose
> > > > rectangles, while the source crop rectangle is used to perform cropping
> > > > on the output. If you have a single scaler in the hardware pipeline you
> > > > can thus configure it on the sink pad, with output and viewfinder
> > > > separate cropping configure on the source pad.
> > > >
> > > >>>>>>> 2. The ImgU V4L2 subdev cropping should be set by using the
> > > >>>>>>> VIDIOC_SUBDEV_S_SELECTION on pad 0, with V4L2_SEL_TGT_CROP as the
> > > >>>>>>> target, using the input feeder height and width.
> > > >>>>>>>
> > > >>>>>>> 3. The ImgU V4L2 subdev composing should be set by using the
> > > >>>>>>> VIDIOC_SUBDEV_S_SELECTION on pad 0, with V4L2_SEL_TGT_COMPOSE as the
> > > >>>>>>> target, using the BDS height and width.
> > > >>>>>>>
> > > >>>>>>> Once these 2 steps are done, the raw bayer frames can be input to
> > > >>>>>>> the ImgU V4L2 subdev for processing.
> > > >>>>>>
> > > >>>>>> Do I need to capture from both the output and viewfinder nodes ? How
> > > >>>>>> are they related to the IF -> BDS -> GDC pipeline, are they both fed
> > > >>>>>> from the GDC output ? If so, how does the viewfinder scaler fit in
> > > >>>>>> that picture ?
> > > >>>>
> > > >>>> The output capture should be set, the viewfinder can be disabled.
> > > >>>> The IF and BDS are seen as crop and compose of the imgu input video
> > > >>>> device. The GDC is seen as the subdev sink pad and OUTPUT/VF are source
> > > >>>> pads.
> > > >>>
> > > >>> The GDC is the last block in the pipeline according to the information
> > > >>> provided above. How can it be seen as the subdev sink pad ? That doesn't
> > > >>> make sense to me. I'm not asking for the MC graph to expose all internal
> > > >>> blocks of the ImgU, but if you want to retain a single subdev model, the
> > > >>> format on the sink pad needs to correspond to what is provided to the
> > > >>> ImgU. Please see figure 4.6 of
> > > >>> https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/dev-subdev.html for
> > > >>> more information regarding how you can use the sink crop, sink compose
> > > >>> and source crop rectangles.
> > > >
> > > > [snip]
> >
> > --
> > Regards,
> >
> > Laurent Pinchart
> >
> >
> >
>
> --
> Regards,
>
> Sakari Ailus
> sakari.ailus@linux.intel.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-01-28 10:08 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 22:22 [PATCH v7 00/16] Intel IPU3 ImgU patchset Yong Zhi
2018-10-29 22:22 ` [PATCH v7 01/16] v4l: Add Intel IPU3 meta buffer formats Yong Zhi
2018-11-02 12:59   ` Mauro Carvalho Chehab
2018-11-02 13:05     ` Mauro Carvalho Chehab
2018-11-29 19:16   ` Laurent Pinchart
2018-11-29 23:12     ` Zhi, Yong
2018-10-29 22:22 ` [PATCH v7 02/16] doc-rst: Add Intel IPU3 documentation Yong Zhi
2018-11-29 22:50   ` Laurent Pinchart
2018-12-13  9:38     ` Sakari Ailus
2018-12-13 10:41       ` Laurent Pinchart
2018-12-13 10:50         ` Sakari Ailus
2018-12-13  9:38     ` [PATCH 1/1] staging/ipu3-imgu: Address documentation comments Sakari Ailus
2018-10-29 22:22 ` [PATCH v7 03/16] v4l: Add Intel IPU3 meta data uAPI Yong Zhi
2018-11-02 13:02   ` Sakari Ailus
2018-11-16 22:37     ` Zhi, Yong
     [not found]       ` <20181129224548.qwbkau6suipt2veq@kekkonen.localdomain>
2018-11-29 23:06         ` Zhi, Yong
2018-11-29 23:06           ` Zhi, Yong
2018-12-01 20:57           ` Sakari Ailus
2018-12-01 20:57             ` Sakari Ailus
2018-11-02 13:49   ` Mauro Carvalho Chehab
2018-11-02 14:04     ` Tomasz Figa
2018-11-06 23:27       ` Mani, Rajmohan
2018-11-15 10:52         ` Hans Verkuil
2018-11-29  0:41           ` Mani, Rajmohan
2018-11-06 18:25     ` Zhi, Yong
2018-11-15 12:51   ` Hans Verkuil
2018-11-21 18:45     ` Zhi, Yong
2018-10-29 22:22 ` [PATCH v7 04/16] intel-ipu3: abi: Add register definitions and enum Yong Zhi
2018-10-29 22:22 ` [PATCH v7 05/16] intel-ipu3: abi: Add structs Yong Zhi
2018-11-05  8:27   ` Sakari Ailus
2018-11-05 19:05     ` Mani, Rajmohan
2018-11-06  8:04       ` Sakari Ailus
2018-11-06 23:31         ` Mani, Rajmohan
2018-10-29 22:23 ` [PATCH v7 06/16] intel-ipu3: mmu: Implement driver Yong Zhi
2018-11-05 11:55   ` Sakari Ailus
2018-11-06  5:50     ` Zhi, Yong
2018-11-06  5:56       ` Tomasz Figa
2018-10-29 22:23 ` [PATCH v7 07/16] intel-ipu3: Implement DMA mapping functions Yong Zhi
2018-10-29 22:23 ` [PATCH v7 08/16] intel-ipu3: css: Add dma buff pool utility functions Yong Zhi
2018-11-08 15:36   ` Sakari Ailus
2018-11-09 23:16     ` Zhi, Yong
2018-11-12  9:21       ` Sakari Ailus
2018-10-29 22:23 ` [PATCH v7 09/16] intel-ipu3: css: Add support for firmware management Yong Zhi
2018-11-28 22:22   ` Sakari Ailus
2018-10-29 22:23 ` [PATCH v7 11/16] intel-ipu3: css: Compute and program ccs Yong Zhi
2018-10-29 22:23 ` [PATCH v7 12/16] intel-ipu3: css: Initialize css hardware Yong Zhi
2018-11-09 12:06   ` Sakari Ailus
2018-10-29 22:23 ` [PATCH v7 13/16] intel-ipu3: Add css pipeline programming Yong Zhi
2018-10-29 22:23 ` [PATCH v7 14/16] intel-ipu3: Add v4l2 driver based on media framework Yong Zhi
2018-11-09 12:36   ` Sakari Ailus
2018-11-09 23:26     ` Zhi, Yong
2018-11-15 12:51   ` Hans Verkuil
2018-11-15 16:09     ` Zhi, Yong
2018-10-29 22:23 ` [PATCH v7 15/16] intel-ipu3: Add imgu top level pci device driver Yong Zhi
2018-11-09 12:54   ` Sakari Ailus
2018-11-12 22:16     ` Zhi, Yong
2018-10-29 22:23 ` [PATCH v7 16/16] intel-ipu3: Add dual pipe support Yong Zhi
2018-11-01 12:03 ` [PATCH v7 00/16] Intel IPU3 ImgU patchset Sakari Ailus
2018-11-07  4:16   ` Bing Bu Cao
2018-11-09  1:28     ` Zhi, Yong
2018-11-09 11:28       ` Sakari Ailus
2018-11-09 10:09     ` Sakari Ailus
2018-11-12  4:31       ` Bing Bu Cao
2018-11-13 10:31         ` Sakari Ailus
2018-11-13 11:04           ` Bing Bu Cao
2018-11-13 21:58             ` Sakari Ailus
2018-11-14  7:02               ` Bing Bu Cao
2018-11-29 23:09       ` Laurent Pinchart
2018-11-30 13:37         ` Sakari Ailus
2018-11-29 23:07     ` Laurent Pinchart
2018-12-03  9:51       ` Sakari Ailus
2018-12-03 12:34         ` Laurent Pinchart
2018-11-14  0:25 ` jacopo mondi
2018-11-14  7:40   ` Sakari Ailus
2018-11-18  0:12     ` jacopo mondi
2018-11-29 14:43 ` Laurent Pinchart
2018-11-29 19:51   ` Tomasz Figa
2018-11-29 22:54     ` Laurent Pinchart
2018-11-29 22:58       ` Mani, Rajmohan
2018-12-04 16:07       ` Mani, Rajmohan
2018-12-04 16:42         ` Laurent Pinchart
2018-12-04 16:53           ` Mani, Rajmohan
2018-12-05  0:30           ` Mani, Rajmohan
2018-12-11 13:34             ` Laurent Pinchart
2018-12-11 13:43               ` Laurent Pinchart
2018-12-11 14:20                 ` Laurent Pinchart
2018-12-16  7:26                   ` Laurent Pinchart
2018-12-20 22:25                     ` Laurent Pinchart
2018-12-21  3:04                       ` Tomasz Figa
2019-01-08  6:54                         ` Tomasz Figa
2019-01-09 16:40                           ` Jacopo Mondi
2019-01-09 17:00                             ` Mani, Rajmohan
2019-01-09 17:25                               ` Jacopo Mondi
2019-01-09 18:01                                 ` Mani, Rajmohan
2019-01-09 18:20                                   ` Jacopo Mondi
2019-01-09 18:36                                     ` Mani, Rajmohan
2019-01-10  8:19                                       ` Jacopo Mondi
2019-01-12  2:06                                         ` Mani, Rajmohan
2019-01-12  2:30                                     ` Mani, Rajmohan
2019-01-12 15:10                                       ` Laurent Pinchart
     [not found]                                         ` <6F87890CF0F5204F892DEA1EF0D77A599B323499@fmsmsx122.amr.corp.intel.com>
2019-01-21  5:41                                           ` Tomasz Figa
2019-01-21  8:07                                             ` Laurent Pinchart
2019-01-22 16:21                                               ` Mani, Rajmohan
     [not found]                   ` <6F87890CF0F5204F892DEA1EF0D77A599B31FAF4@fmsmsx122.amr.corp.intel.com>
2019-01-08 23:34                     ` Laurent Pinchart
2018-12-12  4:55                 ` Bingbu Cao
2018-12-13 22:24                   ` Laurent Pinchart
2018-12-14  2:53                     ` Bingbu Cao
2018-12-17  3:14                     ` Bingbu Cao
2018-12-26 11:03                       ` Laurent Pinchart
2019-01-02  2:38                         ` Bingbu Cao
2019-01-02  8:20                           ` Laurent Pinchart
2019-01-02 20:26                             ` Sakari Ailus
2019-01-28 10:09                               ` Jacopo Mondi [this message]
2019-01-29  8:56                                 ` Tomasz Figa
2019-02-01 10:04                                   ` Jacopo Mondi
2019-02-05  6:01                                     ` Tomasz Figa
2019-03-23 13:02                           ` Jacopo Mondi
2019-03-25  3:45                             ` Bingbu Cao
2019-03-25  4:06                               ` Laurent Pinchart
2019-03-25  8:11                                 ` Jacopo Mondi
2019-03-25 10:07                                   ` Bingbu Cao
2019-03-26 11:16                                     ` Jacopo Mondi
2019-04-08  6:35                                       ` Bingbu Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128100906.lkly33nz63gp7grr@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=hans.verkuil@cisco.com \
    --cc=jerry.w.hu@intel.com \
    --cc=jian.xu.zheng@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rajmohan.mani@intel.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.org \
    --cc=tian.shu.qiu@intel.com \
    --cc=tuukka.toivonen@intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).