linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Todor Tomov <ttomov@mm-sol.com>
Cc: hans.verkuil@cisco.com, linux-media@vger.kernel.org,
	Todor Tomov <todor.tomov@linaro.org>,
	mchehab@kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 16/23] camss: vfe: Support for frame padding
Date: Thu, 13 Sep 2018 18:04:31 +0300	[thread overview]
Message-ID: <20180913150431.e5auwpqkostav5qz@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <90fecd27-3255-fbec-a73f-598cc66a3b31@mm-sol.com>

Hi Todor,

Apologies for the late reply.

On Mon, Sep 03, 2018 at 06:38:20PM +0300, Todor Tomov wrote:
> Hi Sakari and all,
> 
> I'm sorry to up this thread from an year ago but I'm currently thinking
> about a problem which is related to this so I decided to ask here.
> 
> On 20.07.2017 18:17, Sakari Ailus wrote:
> > Hi Todor,
> > 
> > On Mon, Jul 17, 2017 at 01:33:42PM +0300, Todor Tomov wrote:
> >> Add support for horizontal and vertical frame padding.
> >>
> >> Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
> >> ---
> >>  drivers/media/platform/qcom/camss-8x16/camss-vfe.c | 86 +++++++++++++++++-----
> >>  .../media/platform/qcom/camss-8x16/camss-video.c   | 69 ++++++++++++-----
> >>  .../media/platform/qcom/camss-8x16/camss-video.h   |  2 +
> >>  3 files changed, 121 insertions(+), 36 deletions(-)
> >>
> 
> ...
> 
> >> diff --git a/drivers/media/platform/qcom/camss-8x16/camss-video.c b/drivers/media/platform/qcom/camss-8x16/camss-video.c
> >> index c5ebf5c..5a2bf18 100644
> >> --- a/drivers/media/platform/qcom/camss-8x16/camss-video.c
> >> +++ b/drivers/media/platform/qcom/camss-8x16/camss-video.c
> 
> ...
> 
> >> @@ -542,28 +537,68 @@ static int video_g_fmt(struct file *file, void *fh, struct v4l2_format *f)
> >>  	return 0;
> >>  }
> >>  
> >> -static int video_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
> >> +static int video_try_fmt(struct file *file, void *fh, struct v4l2_format *f)
> >>  {
> >>  	struct camss_video *video = video_drvdata(file);
> >> +	struct v4l2_plane_pix_format *p;
> >> +	u32 bytesperline[3] = { 0 };
> >> +	u32 sizeimage[3] = { 0 };
> >> +	u32 lines;
> >>  	int ret;
> >> +	int i;
> >>  
> >> -	if (vb2_is_busy(&video->vb2_q))
> >> -		return -EBUSY;
> >> +	if (video->line_based)
> >> +		for (i = 0; i < f->fmt.pix_mp.num_planes && i < 3; i++) {
> >> +			p = &f->fmt.pix_mp.plane_fmt[i];
> >> +			bytesperline[i] = clamp_t(u32, p->bytesperline,
> >> +						  1, 65528);
> >> +			sizeimage[i] = clamp_t(u32, p->sizeimage,
> >> +					       bytesperline[i],
> >> +					       bytesperline[i] * 4096);
> >> +		}
> >>  
> >>  	ret = video_get_subdev_format(video, f);
> >>  	if (ret < 0)
> >>  		return ret;
> > 
> > If you take the width and height from the sub-device format, then for the
> > user to figure out how big a buffer is needed for a particular format it
> > takes to change the sub-device format.
> > 
> > I wouldn't do this but keep the image dimensions on the video node
> > independent of what's configured on the sub-device.
> 
> So the question is whether the video device node should:
> a) keep its format and framesize always in sync with what is set on the
>    subdev node with active link to it. This means all s_fmt and enum_fmt
>    will return only the value which is in sink with the subdev node;
> b) allow to set all possible allowed formats and framesizes. This however
>    allows the userspace to try to start the streaming with format and
>    framesizes not in sync (on video and subdev node) in which case the
>    start streaming will fail.
> 
> Currently the driver is implemented as in b) and I hit this problem (in b))
> when I try to use it from opencv. I wonder how this can be overcome, the
> userspace cannot be blamed that it tried to start streaming for format
> and framesize which were allowed to be set.
> 
> Are there any new insights on this lately - what can be done to avoid
> the problems in a) and b)?

I'd like to refer to Linux camera user space that hasn't yet materialised,
yet there are plans to implemnt that. One of the aims are to support
regular V4L2 applications on complex devices.

<URL:https://linuxtv.org/news.php?entry=2018-07-13.mchehab>

There's unfortunately nothing more concrete than that I could refer to at
the moment.

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi

  reply	other threads:[~2018-09-13 15:04 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 10:33 [PATCH v3 00/23] Qualcomm 8x16 Camera Subsystem driver Todor Tomov
2017-07-17 10:33 ` [PATCH v3 01/23] [media] media: Make parameter of media_entity_remote_pad() const Todor Tomov
2017-07-17 10:33 ` [PATCH v3 02/23] [media] v4l2-mediabus: Add helper functions Todor Tomov
2017-07-17 10:33 ` [PATCH v3 03/23] v4l: Add packed Bayer raw12 pixel formats Todor Tomov
2017-07-17 10:33 ` [PATCH v3 04/23] dt-bindings: media: Binding document for Qualcomm Camera subsystem driver Todor Tomov
2017-07-20 10:13   ` Sakari Ailus
2017-08-04 11:54     ` Todor Tomov
2017-08-05  8:19       ` Sakari Ailus
2017-07-20 10:15   ` Sakari Ailus
2017-07-24 16:43   ` Rob Herring
2017-07-17 10:33 ` [PATCH v3 05/23] MAINTAINERS: Add " Todor Tomov
2017-07-17 10:33 ` [PATCH v3 06/23] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document Todor Tomov
2017-07-17 10:33 ` [PATCH v3 07/23] media: camss: Add CSIPHY files Todor Tomov
2017-07-20 12:15   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 08/23] media: camss: Add CSID files Todor Tomov
2017-07-20 14:13   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 09/23] media: camss: Add ISPIF files Todor Tomov
2017-07-20 14:51   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 10/23] media: camss: Add VFE files Todor Tomov
2017-07-20 14:59   ` Sakari Ailus
2017-07-25 14:02     ` Todor Tomov
2017-08-04 18:02       ` Sakari Ailus
2017-08-07  6:49         ` Todor Tomov
2017-07-17 10:33 ` [PATCH v3 11/23] media: camss: Add files which handle the video device nodes Todor Tomov
2017-07-17 10:33 ` [PATCH v3 12/23] media: camms: Add core files Todor Tomov
2017-07-19 10:44   ` Hans Verkuil
2017-07-17 10:33 ` [PATCH v3 13/23] media: camss: Enable building Todor Tomov
2017-07-19 13:17   ` kbuild test robot
2017-07-17 10:33 ` [PATCH v3 14/23] camss: vfe: Format conversion support using PIX interface Todor Tomov
2017-07-20 15:11   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 15/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface Todor Tomov
2017-07-20 15:13   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 16/23] camss: vfe: Support for frame padding Todor Tomov
2017-07-20 15:17   ` Sakari Ailus
2018-09-03 15:38     ` Todor Tomov
2018-09-13 15:04       ` Sakari Ailus [this message]
2017-07-17 10:33 ` [PATCH v3 17/23] camss: vfe: Add interface for scaling Todor Tomov
2017-07-20 15:20   ` Sakari Ailus
2017-07-25 15:36     ` Todor Tomov
2017-08-04 17:59       ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 18/23] camss: vfe: Configure scaler module in VFE Todor Tomov
2017-07-17 10:33 ` [PATCH v3 19/23] camss: vfe: Add interface for cropping Todor Tomov
2017-07-17 10:33 ` [PATCH v3 20/23] camss: vfe: Configure crop module in VFE Todor Tomov
2017-07-17 10:33 ` [PATCH v3 21/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop Todor Tomov
2017-07-17 10:33 ` [PATCH v3 22/23] camss: Use optimal clock frequency rates Todor Tomov
2017-07-19 15:59   ` kbuild test robot
2017-07-21  7:55     ` Todor Tomov
2017-07-20 15:23   ` Sakari Ailus
2017-07-17 10:33 ` [PATCH v3 23/23] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Media graph Todor Tomov
2017-07-19 10:54 ` [PATCH v3 00/23] Qualcomm 8x16 Camera Subsystem driver Hans Verkuil
2017-07-21  7:39   ` Todor Tomov
2017-07-31  9:20   ` Hans Verkuil
2017-07-20 15:25 ` Sakari Ailus
2017-07-21  7:50   ` Todor Tomov

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=20180913150431.e5auwpqkostav5qz@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=todor.tomov@linaro.org \
    --cc=ttomov@mm-sol.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).