From: Bryan Wu <pengw-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>,
Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: hansverk-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ebrower-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
jbang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
wenjiaz-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
davidw-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
gfitzer-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/2] [media] v4l: tegra: Add NVIDIA Tegra VI driver
Date: Tue, 25 Aug 2015 10:04:12 -0700 [thread overview]
Message-ID: <55DCA00C.3090303@nvidia.com> (raw)
In-Reply-To: <55DC0B91.2000204-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
On 08/24/2015 11:30 PM, Hans Verkuil wrote:
> A quick follow-up to Thierry's excellent review:
>
> On 08/25/2015 02:26 AM, Bryan Wu wrote:
>> On 08/21/2015 06:03 AM, Thierry Reding wrote:
>>> On Thu, Aug 20, 2015 at 05:51:39PM -0700, Bryan Wu wrote:
> <snip>
>
>>>> +static void
>>>> +__tegra_channel_try_format(struct tegra_channel *chan, struct v4l2_pix_format *pix,
>>>> + const struct tegra_video_format **fmtinfo)
>>>> +{
>>>> + const struct tegra_video_format *info;
>>>> + unsigned int min_width;
>>>> + unsigned int max_width;
>>>> + unsigned int min_bpl;
>>>> + unsigned int max_bpl;
>>>> + unsigned int width;
>>>> + unsigned int align;
>>>> + unsigned int bpl;
>>>> +
>>>> + /* Retrieve format information and select the default format if the
>>>> + * requested format isn't supported.
>>>> + */
>>>> + info = tegra_core_get_format_by_fourcc(pix->pixelformat);
>>>> + if (!info)
>>>> + info = tegra_core_get_format_by_fourcc(TEGRA_VF_DEF_FOURCC);
>>> Should this not be an error? As far as I can tell this is silently
>>> substituting the default format for the requested one if the requested
>>> one isn't supported. Isn't the whole point of this to find out if some
>>> format is supported?
>>>
>> I think it should return some error and escape following code. I will
>> fix that.
> Actually, this code is according to the V4L2 spec: if the given format is
> not supported, then VIDIOC_TRY_FMT should replace it with a valid default
> format.
>
> The reality is a bit more complex: in many drivers this was never reviewed
> correctly and we ended up with some drivers that return an error for this
> case and some drivers that follow the spec. Historically TV capture drivers
> return an error, webcam drivers don't. Most unfortunate.
>
> Since this driver is much more likely to be used with sensors I would
> follow the spec here and substitute an invalid format with a default
> format.
>
>
Thanks for letting me know this. It's actually quite confusing since I
looked at several drivers, some of them return error some of them use
default format.
-Bryan
WARNING: multiple messages have this Message-ID (diff)
From: Bryan Wu <pengw@nvidia.com>
To: Hans Verkuil <hverkuil@xs4all.nl>, Thierry Reding <treding@nvidia.com>
Cc: <hansverk@cisco.com>, <linux-media@vger.kernel.org>,
<ebrower@nvidia.com>, <jbang@nvidia.com>, <swarren@nvidia.com>,
<wenjiaz@nvidia.com>, <davidw@nvidia.com>, <gfitzer@nvidia.com>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH 1/2] [media] v4l: tegra: Add NVIDIA Tegra VI driver
Date: Tue, 25 Aug 2015 10:04:12 -0700 [thread overview]
Message-ID: <55DCA00C.3090303@nvidia.com> (raw)
In-Reply-To: <55DC0B91.2000204@xs4all.nl>
On 08/24/2015 11:30 PM, Hans Verkuil wrote:
> A quick follow-up to Thierry's excellent review:
>
> On 08/25/2015 02:26 AM, Bryan Wu wrote:
>> On 08/21/2015 06:03 AM, Thierry Reding wrote:
>>> On Thu, Aug 20, 2015 at 05:51:39PM -0700, Bryan Wu wrote:
> <snip>
>
>>>> +static void
>>>> +__tegra_channel_try_format(struct tegra_channel *chan, struct v4l2_pix_format *pix,
>>>> + const struct tegra_video_format **fmtinfo)
>>>> +{
>>>> + const struct tegra_video_format *info;
>>>> + unsigned int min_width;
>>>> + unsigned int max_width;
>>>> + unsigned int min_bpl;
>>>> + unsigned int max_bpl;
>>>> + unsigned int width;
>>>> + unsigned int align;
>>>> + unsigned int bpl;
>>>> +
>>>> + /* Retrieve format information and select the default format if the
>>>> + * requested format isn't supported.
>>>> + */
>>>> + info = tegra_core_get_format_by_fourcc(pix->pixelformat);
>>>> + if (!info)
>>>> + info = tegra_core_get_format_by_fourcc(TEGRA_VF_DEF_FOURCC);
>>> Should this not be an error? As far as I can tell this is silently
>>> substituting the default format for the requested one if the requested
>>> one isn't supported. Isn't the whole point of this to find out if some
>>> format is supported?
>>>
>> I think it should return some error and escape following code. I will
>> fix that.
> Actually, this code is according to the V4L2 spec: if the given format is
> not supported, then VIDIOC_TRY_FMT should replace it with a valid default
> format.
>
> The reality is a bit more complex: in many drivers this was never reviewed
> correctly and we ended up with some drivers that return an error for this
> case and some drivers that follow the spec. Historically TV capture drivers
> return an error, webcam drivers don't. Most unfortunate.
>
> Since this driver is much more likely to be used with sensors I would
> follow the spec here and substitute an invalid format with a default
> format.
>
>
Thanks for letting me know this. It's actually quite confusing since I
looked at several drivers, some of them return error some of them use
default format.
-Bryan
next prev parent reply other threads:[~2015-08-25 17:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 0:51 [PATCH RFC 0/2] NVIDIA Tegra VI V4L2 driver Bryan Wu
2015-08-21 0:51 ` [PATCH 1/2] [media] v4l: tegra: Add NVIDIA Tegra VI driver Bryan Wu
2015-08-21 0:51 ` [PATCH 2/2] ARM64: add tegra-vi support in T210 device-tree Bryan Wu
2015-08-21 0:51 ` [PATCH RFC 0/2] NVIDIA Tegra VI V4L2 driver Bryan Wu
2015-08-21 0:51 ` [PATCH 1/2] [media] v4l: tegra: Add NVIDIA Tegra VI driver Bryan Wu
2015-08-21 9:28 ` Hans Verkuil
2015-08-25 0:43 ` Bryan Wu
2015-08-21 13:03 ` Thierry Reding
2015-08-21 13:25 ` Hans Verkuil
[not found] ` <20150821130339.GB22118-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-08-25 0:26 ` Bryan Wu
2015-08-25 0:26 ` Bryan Wu
[not found] ` <55DBB62C.4020606-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-08-25 6:30 ` Hans Verkuil
2015-08-25 6:30 ` Hans Verkuil
[not found] ` <55DC0B91.2000204-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2015-08-25 11:25 ` Thierry Reding
2015-08-25 11:25 ` Thierry Reding
2015-08-25 17:04 ` Bryan Wu [this message]
2015-08-25 17:04 ` Bryan Wu
2015-08-25 13:44 ` Thierry Reding
2015-08-25 13:44 ` Thierry Reding
2015-08-25 14:15 ` Hans Verkuil
[not found] ` <55DC789E.8060300-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2015-08-25 14:24 ` Thierry Reding
2015-08-25 14:24 ` Thierry Reding
[not found] ` <20150825134444.GH14034-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-08-25 21:42 ` Bryan Wu
2015-08-25 21:42 ` Bryan Wu
2015-08-21 0:51 ` [PATCH 2/2] ARM64: add tegra-vi support in T210 device-tree Bryan Wu
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=55DCA00C.3090303@nvidia.com \
--to=pengw-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=davidw-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=ebrower-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=gfitzer-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=hansverk-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
--cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
--cc=jbang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=wenjiaz-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
/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.