mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 12:14:01 +08:00
media: rcar-vin: Do not enumerate unsupported pixel formats
If a pixel format is not supported by the hardware NULL is returned by rvin_format_from_pixel() for that fourcc. Verify that the pixel format is supported using this or skip it when enumerating. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
1091eb8306
commit
8f49006174
@ -296,12 +296,22 @@ static int rvin_g_fmt_vid_cap(struct file *file, void *priv,
|
||||
static int rvin_enum_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct v4l2_fmtdesc *f)
|
||||
{
|
||||
if (f->index >= ARRAY_SIZE(rvin_formats))
|
||||
return -EINVAL;
|
||||
struct rvin_dev *vin = video_drvdata(file);
|
||||
unsigned int i;
|
||||
int matched;
|
||||
|
||||
f->pixelformat = rvin_formats[f->index].fourcc;
|
||||
matched = -1;
|
||||
for (i = 0; i < ARRAY_SIZE(rvin_formats); i++) {
|
||||
if (rvin_format_from_pixel(vin, rvin_formats[i].fourcc))
|
||||
matched++;
|
||||
|
||||
return 0;
|
||||
if (matched == f->index) {
|
||||
f->pixelformat = rvin_formats[i].fourcc;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int rvin_g_selection(struct file *file, void *fh,
|
||||
|
Loading…
Reference in New Issue
Block a user