From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: video4linux-list@redhat.com
Subject: Re: [PATCH 3/3] soc-camera: let camera host drivers decide upon pixel format
Date: Sun, 09 Nov 2008 01:47:46 +0100 [thread overview]
Message-ID: <87tzahwwr1.fsf@free.fr> (raw)
In-Reply-To: <Pine.LNX.4.64.0811081917070.8956@axis700.grange> (Guennadi Liakhovetski's message of "Sat\, 8 Nov 2008 19\:48\:05 +0100 \(CET\)")
Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
> index 2a811f8..a375872 100644
> --- a/drivers/media/video/pxa_camera.c
> +++ b/drivers/media/video/pxa_camera.c
> @@ -907,17 +907,43 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
> static int pxa_camera_set_fmt_cap(struct soc_camera_device *icd,
> __u32 pixfmt, struct v4l2_rect *rect)
> {
> - return icd->ops->set_fmt_cap(icd, pixfmt, rect);
> + const struct soc_camera_data_format *cam_fmt;
> + int ret;
> +
> + /*
> + * TODO: find a suitable supported by the SoC output format, check
> + * whether the sensor supports one of acceptable input formats.
> + */
> + if (pixfmt) {
> + cam_fmt = soc_camera_format_by_fourcc(icd, pixfmt);
> + if (!cam_fmt)
> + return -EINVAL;
> + }
All right, here is something I don't understand.
Let's take an example : the pxa_camera was asked a YUV422P pixel format. It can
deserve it by asking the sensor a UYVY format. So the logical step would be to
do something like :
if (pixfmt == V4L2_PIX_FMT_YUV422P)
pixfmt = V4L2_PIX_FMT_UYVY;
at the beginning of pxa_camera_set_fmt_cap().
> +
> + ret = icd->ops->set_fmt_cap(icd, pixfmt, rect);
> + if (pixfmt && !ret)
> + icd->current_fmt = cam_fmt;
So here, icd->current_fmt = V4L2_PIX_FMT_UYVY, and not V4L2_PIX_FMT_YUV422P;
> @@ -345,14 +325,21 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
> rect.width = f->fmt.pix.width;
> rect.height = f->fmt.pix.height;
> ret = ici->ops->set_fmt_cap(icd, f->fmt.pix.pixelformat, &rect);
> - if (ret < 0)
> + if (ret < 0) {
> return ret;
> + } else if (!icd->current_fmt ||
> + icd->current_fmt->fourcc != f->fmt.pix.pixelformat) {
> + dev_err(&ici->dev, "Host driver hasn't set up current "
> + "format correctly!\n");
> + return -EINVAL;
> + }
And here, we fall into the error case, because icd->current_fmt is
V4L2_PIX_FMT_UYVY, and f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P.
So there is still something to improve, or have I missed something ?
--
Robert
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
next prev parent reply other threads:[~2008-11-09 0:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-08 18:48 [PATCH 3/3] soc-camera: let camera host drivers decide upon pixel format Guennadi Liakhovetski
2008-11-09 0:47 ` Robert Jarzmik [this message]
2008-11-09 10:32 ` Guennadi Liakhovetski
2008-11-09 11:13 ` Robert Jarzmik
2008-11-09 12:36 ` Guennadi Liakhovetski
2008-11-09 13:31 ` Robert Jarzmik
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=87tzahwwr1.fsf@free.fr \
--to=robert.jarzmik@free.fr \
--cc=g.liakhovetski@gmx.de \
--cc=video4linux-list@redhat.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