public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <snjw23@gmail.com>
To: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	linux-media@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org
Subject: Re: [PATCH 4/4] v4l2: add blackfin capture bridge driver
Date: Thu, 15 Sep 2011 23:17:26 +0200	[thread overview]
Message-ID: <4E726B66.2020808@gmail.com> (raw)
In-Reply-To: <CAHG8p1D1jnwRO0ie6xrXGL5Uhu+2YjoNdXzhnnBweZDPRyE1fw@mail.gmail.com>

On 09/15/2011 04:40 AM, Scott Jiang wrote:
> 2011/9/14 Sylwester Nawrocki<s.nawrocki@samsung.com>:
>> On 09/14/2011 09:10 AM, Scott Jiang wrote:
>>>
>>>>> +                     fmt =&bcap_formats[i];
>>>>> +                     if (mbus_code)
>>>>> +                             *mbus_code = fmt->mbus_code;
>>>>> +                     if (bpp)
>>>>> +                             *bpp = fmt->bpp;
>>>>> +                     v4l2_fill_mbus_format(&mbus_fmt, pixfmt,
>>>>> +                                             fmt->mbus_code);
>>>>> +                     ret = v4l2_subdev_call(bcap->sd, video,
>>>>> +                                             try_mbus_fmt,&mbus_fmt);
>>>>> +                     if (ret<    0)
>>>>> +                             return ret;
>>>>> +                     v4l2_fill_pix_format(pixfmt,&mbus_fmt);
>>>>> +                     pixfmt->bytesperline = pixfmt->width * fmt->bpp;
>>>>> +                     pixfmt->sizeimage = pixfmt->bytesperline
>>>>> +                                             * pixfmt->height;

No need to clamp mbus_fmt.width and mbus_fmt.height to some maximum values
to prevent allocating huge memory buffers ?

>>>>
>>>> Still pixfmt->pixelformat isn't filled.
>>>>
>>> no here pixfmt->pixelformat is passed in
>>>
>>>>> +                     return 0;
>>>>> +             }
>>>>> +     }
>>>>> +     return -EINVAL;
>>>>
>>>> I think you should return some default format, rather than giving up
>>>> when the fourcc doesn't match. However I'm not 100% sure this is
>>>> the specification requirement.
>>>>
>>> no, there is no default format for bridge driver because it knows
>>> nothing about this.
>>> all the format info bridge needs ask subdevice.
>>
>> It's the bridge driver that exports a device node and is responsible for
>> setting the default format. It should be possible to start streaming right
>> after opening the device, without VIDIOC_S_FMT, with some reasonable defaults.
>>
>> If, as you say, the bridge knows nothing about formats what the bcap_formats[]
>> array is here for ?
>>
> accually this array is to convert mbus to pixformat. ppi supports any formats.
> Ideally it should contain all formats in v4l2, but it is enough at
> present for our platform.
> If I find someone needs more, I will add it.
> So return -EINVAL means this format is out of range, it can't be supported now.

Ok, fair enough. I guess you rely on subdev driver to return some supported
value through mbus_try_fmt and then the bridge driver must be able to handle
this. However it might make sense to validate the resolution in some places
to prevent allocating insanely huge buffers, when the sensor subdev misbehaves.

> 
> about default format, I think I can only call bcap_g_fmt_vid_cap in
> probe to get this info.
> Dose anybody have a better solution?

How about doing that when device is opened for the first time ? However it
could make more sense to try to set format at the subdev and then check how 
it was adjusted. Not all subdevs might implement g_mbus_fmt op or some might
not deliver sane default values.


  parent reply	other threads:[~2011-09-15 21:17 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 18:34 [PATCH 1/4] v4l2: add vb2_get_unmapped_area in vb2 core Scott Jiang
2011-09-13  8:17 ` Guennadi Liakhovetski
2011-09-13  8:36   ` Scott Jiang
2011-09-13 18:34 ` [PATCH 2/4] v4l2: add adv7183 decoder driver Scott Jiang
2011-09-14  3:05   ` [uclinux-dist-devel] " Mike Frysinger
2011-09-13 18:34 ` [PATCH 3/4] v4l2: add vs6624 sensor driver Scott Jiang
2011-09-13  7:42   ` Guennadi Liakhovetski
2011-09-13  8:20     ` Scott Jiang
2011-09-13  8:22       ` Guennadi Liakhovetski
2011-09-14  3:28   ` [uclinux-dist-devel] " Mike Frysinger
2011-09-14  7:28     ` Scott Jiang
2011-09-18  2:52       ` Mike Frysinger
2011-09-13 18:34 ` [PATCH 4/4] v4l2: add blackfin capture bridge driver Scott Jiang
2011-09-13  8:11   ` Guennadi Liakhovetski
2011-09-13  9:56     ` Scott Jiang
2011-09-13 11:15       ` Guennadi Liakhovetski
2011-09-14  6:14         ` Scott Jiang
2011-09-16  8:11         ` Scott Jiang
2011-09-16  8:46           ` Guennadi Liakhovetski
2011-09-15  6:37     ` Scott Jiang
2011-09-15  8:49       ` Sylwester Nawrocki
2011-09-13 21:19   ` Sylwester Nawrocki
2011-09-14  7:10     ` Scott Jiang
2011-09-14 14:30       ` Sylwester Nawrocki
2011-09-15  2:40         ` Scott Jiang
2011-09-15  6:35           ` Guennadi Liakhovetski
2011-09-15  6:48             ` Scott Jiang
2011-09-15  7:14               ` Guennadi Liakhovetski
2011-09-15  7:26                 ` Scott Jiang
2011-09-15  7:32                   ` Guennadi Liakhovetski
2011-09-15 21:17           ` Sylwester Nawrocki [this message]
2011-09-16  2:34             ` Scott Jiang
2011-09-16  6:48               ` Guennadi Liakhovetski
2011-09-26 14:25         ` Hans Verkuil
2011-10-01 10:03           ` Sylwester Nawrocki
2011-09-14  3:19   ` [uclinux-dist-devel] " Mike Frysinger
2011-09-14  7:16     ` Scott Jiang
2011-09-14  7:22       ` Guennadi Liakhovetski
2011-09-17 20:54   ` Guennadi Liakhovetski

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=4E726B66.2020808@gmail.com \
    --to=snjw23@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=s.nawrocki@samsung.com \
    --cc=scott.jiang.linux@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox