Commit e4561809 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: common: saa7146: fix compliance problems with field handling

The initial field value of the format is ANY, which isn't allowed.
Change to INTERLACED.

VIDIOC_TRY_FMT will overwrite vv->last_field, which is an
unwanted side-effect, so drop this.

And finally vidioc_s_fmt_vid_cap didn't initialize vv->last_field
correctly.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 0b6e30bd
...@@ -298,7 +298,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) ...@@ -298,7 +298,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
fmt->width = 384; fmt->width = 384;
fmt->height = 288; fmt->height = 288;
fmt->pixelformat = V4L2_PIX_FMT_BGR24; fmt->pixelformat = V4L2_PIX_FMT_BGR24;
fmt->field = V4L2_FIELD_ANY; fmt->field = V4L2_FIELD_INTERLACED;
fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
fmt->bytesperline = 3 * fmt->width; fmt->bytesperline = 3 * fmt->width;
fmt->sizeimage = fmt->bytesperline * fmt->height; fmt->sizeimage = fmt->bytesperline * fmt->height;
......
...@@ -381,20 +381,13 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma ...@@ -381,20 +381,13 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
} }
switch (field) { switch (field) {
case V4L2_FIELD_ALTERNATE: case V4L2_FIELD_ALTERNATE:
vv->last_field = V4L2_FIELD_TOP;
maxh = maxh / 2;
break;
case V4L2_FIELD_TOP: case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM: case V4L2_FIELD_BOTTOM:
vv->last_field = V4L2_FIELD_INTERLACED;
maxh = maxh / 2; maxh = maxh / 2;
break; break;
case V4L2_FIELD_INTERLACED:
vv->last_field = V4L2_FIELD_INTERLACED;
break;
default: default:
DEB_D("no known field mode '%d'\n", field); field = V4L2_FIELD_INTERLACED;
return -EINVAL; break;
} }
f->fmt.pix.field = field; f->fmt.pix.field = field;
...@@ -434,6 +427,14 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format ...@@ -434,6 +427,14 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
err = vidioc_try_fmt_vid_cap(file, fh, f); err = vidioc_try_fmt_vid_cap(file, fh, f);
if (0 != err) if (0 != err)
return err; return err;
switch (f->fmt.pix.field) {
case V4L2_FIELD_ALTERNATE:
vv->last_field = V4L2_FIELD_TOP;
break;
default:
vv->last_field = V4L2_FIELD_INTERLACED;
break;
}
vv->video_fmt = f->fmt.pix; vv->video_fmt = f->fmt.pix;
DEB_EE("set to pixelformat '%4.4s'\n", DEB_EE("set to pixelformat '%4.4s'\n",
(char *)&vv->video_fmt.pixelformat); (char *)&vv->video_fmt.pixelformat);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment