diff options
author | Corentin Labbe <clabbe@baylibre.com> | 2020-09-25 20:30:54 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-10-01 10:03:28 +0200 |
commit | d1d015376c13661436aebaaede5b81cb769bf9cb (patch) | |
tree | 92a77fe113892720f8165dae65b2f3e7df835596 /drivers/staging | |
parent | 11c9c16f7cb5b7d6fba2d6b7f1ec92a3be0c3df2 (diff) |
media: zoran: fix some compliance test
Add TODO for "TRY_FMT cannot handle an invalid pixelformat"
We need to set pixelformat in some case.
We should also handle some minimum requirement.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/zoran/zoran_driver.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 021073ba08e6..ab9eec50abad 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1217,9 +1217,12 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh, if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat) break; - if (i == NUM_FORMATS) + if (i == NUM_FORMATS) { + /* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL; + } + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; fmt->fmt.pix.colorspace = zoran_formats[i].colorspace; if (BUZ_MAX_HEIGHT < (fmt->fmt.pix.height * 2)) fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; @@ -1332,6 +1335,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, if (i == NUM_FORMATS) { pci_err(zr->pci_dev, "VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", fmt->fmt.pix.pixelformat); + /* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL; } @@ -1341,10 +1345,16 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, res = -EBUSY; return res; } + + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT) fmt->fmt.pix.height = BUZ_MAX_HEIGHT; if (fmt->fmt.pix.width > BUZ_MAX_WIDTH) fmt->fmt.pix.width = BUZ_MAX_WIDTH; + if (fmt->fmt.pix.height < BUZ_MIN_HEIGHT) + fmt->fmt.pix.height = BUZ_MIN_HEIGHT; + if (fmt->fmt.pix.width < BUZ_MIN_WIDTH) + fmt->fmt.pix.width = BUZ_MIN_WIDTH; map_mode_raw(fh); |