All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Longerbeam <steve_longerbeam@mentor.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Steve Longerbeam <slongerbeam@gmail.com>,
	<linux-media@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH 00/43] i.MX6 Video capture
Date: Sun, 15 Jun 2014 15:34:41 -0700	[thread overview]
Message-ID: <539E1F81.9040700@mentor.com> (raw)
In-Reply-To: <1402673843.3507.123.camel@paszta.hi.pengutronix.de>

On 06/13/2014 08:37 AM, Philipp Zabel wrote:
> Am Donnerstag, den 12.06.2014, 14:05 -0700 schrieb Steve Longerbeam:
>> Ok. Yes, we definitely need preview and MIPI CSI-2, and adding IC to the
>> capture path is nice too, since it allows userland to select arbitrary user
>> resolutions, pixel format color space, and also rotation controls.
> 
> No question about that. It's just that mostly everyone around here seems
> to want to capture at least 1080p, or 10-bit grayscale. I hope Freescale
> drops the 1024-pixel output limitation in their next SoC ...

yeah that would be nice.

> 
>> The
>> capture driver decides whether to include the IC in the capture pipeline
>> based on user format and rotation control. I.e. if user colorspace is
>> different from what the sensor can output, IC CSC is required. If user
>> resolution is different from the selected capture cropping rectangle,
>> IC resizer is required, and finally if user requests rotation, the IC
>> rotation unit is required. If none of those are true, the capture driver
>> decides to exclude the IC from the pipeline and send raw sensor frames
>> (well, after cropping anyway) directly to memory via the SMFC.
> 
> That is too much magic for my taste. Especially since whether or not you
> can use the IC not only depends on the current video format, but also on
> whether the other CSI or the MEM_VDIC_MEM path are using the IC at the
> moment.

Right. Our current capture driver just returns -EBUSY if the IC PRPENC task
is currently in use by the other CSI.

But I have come around, I agree with you now that, if we are to make the
capture driver a media device that is controlling an IC entity, that the
links to/from the IC need to be controlled by media controller API. I guess
I've been thinking too much in terms of "classical" V4L2.


> Since this can change dynamically, it throws a wrench into GStreamer's
> static capability negotiation, for example. I'd rather have userspace
> select which CSI should be routed through the IC with media-ctl and then
> reflect the possible conversions in the respective video_dev's
> capabilities.

yes, the capabilities will change dynamically depending on the current video
pipeline that has been setup.

> 
>> So in our driver, the decision to link the IC in a pipeline is made
>> internally by the driver and is not a decision exported to userland.
> 
> This is exactly the point I am worried about. You lose flexibility and
> need all sorts of clever conditional code in the driver. It'd be much
> cleaner to just let userspace control the mux.

the conditionals weren't actually that clever. But like I said, I was
thinking in terms of classic V4L2 where internal video blocks are used or
not depending on user requested format. I agree now that IC usage should
be part of media control.

> 
>> My plan was to add media device framework support, but only after basic
>> video capture is in place. Our driver is full featured in terms of basic
>> capture support, and it works on all three reference platforms. But I
>> agree it needs to convert subdev's to media entities and allow some of
>> them to be linked via the media controller API.
> 
> Alright, so we agree that using the media controller API internally is a
> good idea ...
> 
>> But only some linkages make sense to me. As I explain above, if the IC were
>> to be made a media entity, I think it's linkage should be made internally
>> by the capture driver, and this should not be controllable by userspace.
> 
> ... but we disagree on whether to export the control to userspace. For
> more complicated pipelines in front of the CSIs we'll need media-ctl
> anyway, so using that same API for the internal components, makes sense.
> It also allows userspace to get a clear and stable picture of the
> available features for any given multiplexer setting.
> 
>> Heh, we have a mem2mem driver as well, and it also uses IC post-processor
>> task. It uses banding and striping to support resized output frames larger
>> than 1024x1024. It also makes use of IC rotation and CSC.
> 
> Of course :)
> 
>> But again this is not converted to a media entity. And again, if IC were to
>> be made a standalone media entity, then the mem2mem device would _always_
>> require the IC post-processor be linked to it, since the essential feature
>> of mem2mem is to make use of IC post-processor task for CSC, resize, and
>> rotation operations.
> 
> Since the three IC tasks are transparently time-multiplexed, the IC
> media entity representation could have input and output pads for each of
> them.
> The preprocessing (encoding, viewfinder) tasks share an input pad that
> would be connected to either CSI0, CSI1, or VDI output pad. These links
> should control the IC mux. The encoding task output pad would represent
> IDMAC channel 20/CB0 or channel 48/CB8, depending on whether the rotator
> is active. Since rotation requires tight integration between IC and
> IDMAC, I don't think the IRT should be represented as a separate media
> entity.
> The viewfinder task output pad would correspond to channel 21/CB1 or
> channel 49/CB9, and maybe in the future control whether to send that
> data off to the DMFC or to memory.

right. Currently we don't attempt to use the direct IC-PRPVF --> DMFC
path. Viewfinder code looks much like PRPENC (like you or Sascha pointed out
earlier), it just transfers scaled/CSC/rotated frames to a framebuffer addr
in memory provided by s_fbuf.

> The postprocessing input and output pads would go straight to memory and
> are not configurable, so I see no need to describe IC-PP as media
> entity.

er, now I'm being your own best advocate! :) If IC-PP I/O is going to be
described by pads, then I think IC-PP would have to be described as a media
entity.

For mem2mem device, the sink and source links to IC-PP would have to marked
as immutable (always enabled).


> 
> I'm not quite sure about the VDIC, but I guess that also should be
> configurable from userspace as one input to IC. For the deinterlacer to
> work, IC_INPUT needs to be set, so while this is active there is no way
> to route CSI0/1 through the IC directly.
>

sounds right. But there's too much to think about already.

Btw we have tried to implement direct CSI --> VDIC --> IC path without
success. Freescale's BSP does not use the VDIC in this way, but rather as
mem --> VDIC --> mem, i.e. a kind of post-processing after capture. I'm a
bit vague about this since I haven't looked at VDIC yet in much detail.


> [...]
>>> No conflict here, there are different multiplexers to talk about.
>>>
>>> First, there are two external multiplexers controlled by IOMUXC (on
>>> i.MX6, these don't exist on i.MX5): MIPI_IPU1/2_MUX on i.MX6Q and
>>> IPU_CSI0/1_MUX. They are not part of the IPU.
> [...]
>> right, this is one place where subdev linking makes sense to me. I.e.
>> linking sensors to CSI ports.
>>
>> But you don't mean to allow userspace to make this link arbitrarily,
>> correct? You mean the driver uses the mediactrl framework to implement
>> the links defined in the device tree. Maybe that's where I was confused.
> 
> No, this is exactly what I mean. In my opinion, using media-ctl to throw
> the switches is much better than letting the driver decide depending on
> the old S_INPUT API. Especially since this gives userspace a unified API
> when there are input multiplexers (or any other subdevices configurable
> on the pad level) external to the SoC.
> Also, pad format configuration of the CSI subdev exported to userspace
> may be useful to control the compander in the CSI.
> 
> [...]
>>> From an organizational standpoint, with all the other register access
>>> code in gpu/ipu-v3, having the ipu-csi code in there too looks nice and
>>> as expected.
>>> On the other hand, this should really be only used by one
>>> v4l2_subdev driver. When I look at it this way, I see a driver that is
>>> split in two parts, wasting exported symbol space for no very good
>>> reason.
>>
>> I agree about making CSI a subdev, but I also think we can keep all of the
>> register access in IPU core as well. The CSI subdev would be a wrapper
>> around the ipu-csi APIs. I agree it's more use of symbol space, but we
>> might be able to simplify the ipu-csi API.
> 
> So be it. In any case, this decision could be changed later with little
> effort and without any externally visible changes, if deemed necessary,
> as long as the CSI v4l2_subdev driver is the only consumer of this API.
> 
>>> The IC I'd like to describe as a v4l2_subdev. But I'd also like to use
>>> the IC from the DRM driver. So the IC core code has to stay in
>>> gpu/ipu-v3. I'd just like to pool all V4L2 code that uses this into a IC
>>> v4l2_subdev driver if possible. The only use we have for the IC
>>> currently is
>>
>> is mem2mem? And you would like to see an IC pads linked with mem2mem
>> pads. Well, something like this:
>>
>> input frame from userspace ---> m2m ---> IC-PP ---> m2m ---> to userspace
> 
> As long as there is no internal video bus switch somewhere, the
> usefulness of this is debatable. You see we also implemented this by
> directly calling the IPU IC API, and I'm fine with this.

well, as I said above I think if we are going to make the IC a media entity
we might as well make mem2mem a media device and include IC-PP as an entity
with immutable links to it.

Steve

> 
> [...]
>> Ok, in summary I'm aligned with everything you said. Only that I am still
>> pondering about which media entity links make sense, and who should be
>> allowed to make those links.
> 
> At least the decision whether to route the CSI0/1 into the IC
> preprocessing input should be handled by userspace, as this changes the
> capabilities of the corresponding video_dev.
> 
>> So how should we proceed? I would argue to use our capture driver as a base,
>> since it is fully functional and fairly full-featured. It's just missing the
>> media framework.
> 
> Initially, I don't care as much about a full featureset as I do about
> getting the userspace API and device tree bindings right, since those
> won't be easy to change later.
> Pending rework into CSI/IC subdevices and agreement on the userspace
> facing API, I think your patchset can be a good base.
> 
> regards
> Philipp
> 



      reply	other threads:[~2014-06-15 22:34 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07 21:56 [PATCH 00/43] i.MX6 Video capture Steve Longerbeam
2014-06-07 21:56 ` [PATCH 01/43] imx-drm: ipu-v3: Move imx-ipu-v3.h to include/linux/platform_data/ Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 02/43] ARM: dts: imx6qdl: Add ipu aliases Steve Longerbeam
2014-06-11 11:21   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 03/43] imx-drm: ipu-v3: Add ipu_get_num() Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 04/43] imx-drm: ipu-v3: Add solo/dual-lite IPU device type Steve Longerbeam
2014-06-11  5:37   ` Sascha Hauer
2014-06-11 11:38   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 05/43] imx-drm: ipu-v3: Map IOMUXC registers Steve Longerbeam
2014-06-11 13:11   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 06/43] imx-drm: ipu-v3: Add functions to set CSI/IC source muxes Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 07/43] imx-drm: ipu-v3: Rename and add IDMAC channels Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 08/43] imx-drm: ipu-v3: Add units required for video capture Steve Longerbeam
2014-06-11  6:18   ` Sascha Hauer
2014-06-11 14:09   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 09/43] imx-drm: ipu-v3: Add ipu_mbus_code_to_colorspace() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 10/43] imx-drm: ipu-v3: Add rotation mode conversion utilities Steve Longerbeam
2014-06-07 21:56 ` [PATCH 11/43] imx-drm: ipu-v3: Add helper function checking if pixfmt is planar Steve Longerbeam
2014-06-07 21:56 ` [PATCH 12/43] imx-drm: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h Steve Longerbeam
2014-06-07 21:56 ` [PATCH 13/43] imx-drm: ipu-v3: Add ipu_idmac_buffer_is_ready() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 14/43] imx-drm: ipu-v3: Add ipu_idmac_clear_buffer() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 15/43] imx-drm: ipu-v3: Add ipu_idmac_current_buffer() Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 16/43] imx-drm: ipu-v3: Add __ipu_idmac_reset_current_buffer() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 17/43] imx-drm: ipu-v3: Add ipu_stride_to_bytes() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 18/43] imx-drm: ipu-v3: Add ipu_idmac_enable_watermark() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 19/43] imx-drm: ipu-v3: Add ipu_idmac_lock_enable() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 20/43] imx-drm: ipu-v3: Add idmac channel linking support Steve Longerbeam
2014-06-07 21:56 ` [PATCH 21/43] imx-drm: ipu-v3: Add ipu_bits_per_pixel() Steve Longerbeam
2014-06-11 11:23   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 22/43] imx-drm: ipu-v3: Add ipu-cpmem unit Steve Longerbeam
2014-06-11 11:23   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 23/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_block_mode() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 24/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_axi_id() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 25/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_rotation() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 26/43] imx-drm: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 27/43] imx-drm: ipu-v3: Add more planar formats support Steve Longerbeam
2014-06-07 21:56 ` [PATCH 28/43] imx-drm: ipu-cpmem: Add ipu_cpmem_dump() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 29/43] imx-drm: ipu-v3: Add ipu_dump() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 30/43] ARM: dts: imx6: add pin groups for imx6q/dl for IPU1 CSI0 Steve Longerbeam
2014-06-11  5:56   ` Sascha Hauer
2014-06-07 21:56 ` [PATCH 31/43] ARM: dts: imx6qdl: Flesh out MIPI CSI2 receiver node Steve Longerbeam
2014-06-11 11:38   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 32/43] ARM: dts: imx: sabrelite: add video capture ports and endpoints Steve Longerbeam
2014-06-11 11:38   ` Philipp Zabel
2014-06-12 17:13     ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 33/43] ARM: dts: imx6-sabresd: " Steve Longerbeam
2014-06-07 21:56 ` [PATCH 34/43] ARM: dts: imx6-sabreauto: " Steve Longerbeam
2014-06-07 21:56 ` [PATCH 35/43] ARM: dts: imx6qdl: Add simple-bus to ipu compatibility Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 36/43] gpio: pca953x: Add reset-gpios property Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 37/43] ARM: imx6q: clk: Add video 27m clock Steve Longerbeam
2014-06-07 21:56 ` [PATCH 38/43] media: imx6: Add device tree binding documentation Steve Longerbeam
2014-06-07 21:56 ` [PATCH 39/43] media: Add new camera interface driver for i.MX6 Steve Longerbeam
2014-06-11 15:27   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 40/43] media: imx6: Add support for MIPI CSI-2 OV5640 Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 41/43] media: imx6: Add support for Parallel OV5642 Steve Longerbeam
2014-06-07 21:56 ` [PATCH 42/43] media: imx6: Add support for ADV7180 Video Decoder Steve Longerbeam
2015-01-17 19:54   ` Fabio Estevam
2014-06-07 21:56 ` [PATCH 43/43] ARM: imx_v6_v7_defconfig: Enable video4linux drivers Steve Longerbeam
2014-06-08  8:36 ` [PATCH 00/43] i.MX6 Video capture Hans Verkuil
2014-06-08  8:39   ` Hans Verkuil
2014-06-09 16:42   ` Steve Longerbeam
2014-06-10 15:11     ` Hans Verkuil
2014-06-11  0:54       ` Steve Longerbeam
2014-06-11  7:01         ` Hans Verkuil
2014-06-11 11:21 ` Philipp Zabel
2014-06-12  1:04   ` Steve Longerbeam
2014-06-12 16:50     ` Philipp Zabel
2014-06-12 21:05       ` Steve Longerbeam
2014-06-12 21:35         ` Troy Kisky
2014-06-13 15:37         ` Philipp Zabel
2014-06-15 22:34           ` Steve Longerbeam [this message]

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=539E1F81.9040700@mentor.com \
    --to=steve_longerbeam@mentor.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=p.zabel@pengutronix.de \
    --cc=slongerbeam@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.