From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: video4linux-list@redhat.com
Subject: Re: [PATCH 5/5] pxa-camera: framework to handle camera-native and synthesized formats
Date: Tue, 11 Nov 2008 00:11:18 +0100 [thread overview]
Message-ID: <874p2fkwh5.fsf@free.fr> (raw)
In-Reply-To: <Pine.LNX.4.64.0811101335170.4248@axis700.grange> (Guennadi Liakhovetski's message of "Mon\, 10 Nov 2008 13\:37\:00 +0100 \(CET\)")
Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> @@ -901,15 +1042,33 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
> static int pxa_camera_set_fmt(struct soc_camera_device *icd,
> __u32 pixfmt, struct v4l2_rect *rect)
snip
> - /*
> - * 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);
> + struct camera_data *cam_data = icd->host_priv;
> + int i;
> +
> + /* First check camera native formats */
> + for (i = 0; i < cam_data->camera_formats_num; i++)
> + if (cam_data->camera_formats[i]->fourcc == pixfmt) {
> + cam_fmt = cam_data->camera_formats[i];
> + break;
> + }
> +
> + /* Next, if failed, check synthesized formats */
> + if (!cam_fmt)
> + for (i = 0; i < cam_data->extra_formats_num; i++)
> + if (cam_data->extra_formats[i].fourcc ==
> + pixfmt) {
> + cam_fmt = cam_data->extra_formats + i;
> + /* TODO: synthesize... */
> + dev_err(&icd->dev,
> + "Cannot provide format 0x%x\n",
> + pixfmt);
> + return -EOPNOTSUPP;
> + }
> +
> if (!cam_fmt)
> return -EINVAL;
> }
> @@ -924,18 +1083,31 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
snip
> - /*
> - * TODO: find a suitable supported by the SoC output format, check
> - * whether the sensor supports one of acceptable input formats.
> - */
> - cam_fmt = soc_camera_format_by_fourcc(icd, pix->pixelformat);
> + /* First check camera native formats */
> + for (i = 0; i < cam_data->camera_formats_num; i++)
> + if (cam_data->camera_formats[i]->fourcc == pixfmt) {
> + cam_fmt = cam_data->camera_formats[i];
> + break;
> + }
> +
> + /* Next, if failed, check synthesized formats */
> + if (!cam_fmt)
> + for (i = 0; i < cam_data->extra_formats_num; i++)
> + if (cam_data->extra_formats[i].fourcc == pixfmt) {
> + cam_fmt = cam_data->extra_formats + i;
> + break;
> + }
> +
> if (!cam_fmt)
> return -EINVAL;
Isn't that the second time you're looking for a format the same way, with only a
printk making a difference ? Shouldn't that be grouped in a function
(pxa_camera_find_format(icd, pixfmt) ?) ...
More globally, all camera hosts will implement the creation of this formats
table. Why did you choose to put that in pxa_camera, and not in soc_camera to
make available to all host drivers ?
I had thought you would design something like :
- soc_camera provides a format like :
struct soc_camera_format_translate {
u32 host_pixfmt;
u32 sensor_pixfmt;
};
- camera host provide a static table like this :
struct soc_camera_format_translate pxa_pixfmt_translations[] = {
{ V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_YUYV },
{ V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_UYVY },
...
{ V4L2_PIX_FMT_YUV422P, V4L2_PIX_FMT_UYVY},
};
- soc_camera provides functions like :
- soc_camera_compute_formats(struct soc_camera_format_translate trans,
struct soc_camera_data_format sensor_formats)
=> that creates the formats table
- camera host either :
- call the generic soc_camera_compute_formats()
- or make the computation themself if it is way too specific.
Is there a reason you chose to fully export the formats computation to hosts ?
Otherwise, the other 4 patches look fine to me, I'll make some tests tomorrow.
Cheers.
--
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-11 1:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 12:36 [PATCH 0/5] pixel format handling in camera host drivers - part 2 Guennadi Liakhovetski
2008-11-10 12:36 ` [PATCH 1/5] soc-camera: simplify naming Guennadi Liakhovetski
2008-11-10 12:36 ` [PATCH 2/5] soc-camera: move pixel format handling to host drivers (part 2) Guennadi Liakhovetski
2008-11-10 12:36 ` [PATCH 4/5] soc-camera: initialise fields on device-registration, more formatting cleanup Guennadi Liakhovetski
2008-11-10 12:37 ` [PATCH 5/5] pxa-camera: framework to handle camera-native and synthesized formats Guennadi Liakhovetski
2008-11-10 18:09 ` David Ellingsworth
2008-11-10 18:43 ` Guennadi Liakhovetski
2008-11-10 19:15 ` Robert Jarzmik
2008-11-10 20:22 ` Guennadi Liakhovetski
2008-11-10 23:11 ` Robert Jarzmik [this message]
2008-11-11 8:18 ` Guennadi Liakhovetski
2008-11-11 11:04 ` Robert Jarzmik
2008-11-11 11:31 ` Guennadi Liakhovetski
2008-11-11 12:02 ` Robert Jarzmik
2008-11-11 12:14 ` Guennadi Liakhovetski
2008-11-10 19:39 ` [PATCH 0/5] pixel format handling in camera host drivers - part 2 Robert Jarzmik
2008-11-10 20:33 ` Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.0811101333030.4248@axis700.grange>
2008-11-11 22:36 ` Moderators: please act (was Re: [PATCH 3/5] soc-camera: add a per-camera...) 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=874p2fkwh5.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