mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
media: omap3isp: rework isp_video_try/set_format
isp_video_set_format now calls isp_video_try_format first, ensuring consistent behavior and removing duplicate code in both functions. This fixes an v4l2-compliance error: fail: v4l2-test-formats.cpp(519): !pix.sizeimage test VIDIOC_S_FMT: FAIL Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
parent
7575b8dfa9
commit
93ee7d61dc
|
|
@ -700,11 +700,15 @@ isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
|
|||
}
|
||||
|
||||
static int
|
||||
isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
|
||||
isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
|
||||
{
|
||||
struct isp_video_fh *vfh = file_to_isp_video_fh(file);
|
||||
struct isp_video *video = video_drvdata(file);
|
||||
struct v4l2_mbus_framefmt fmt;
|
||||
struct v4l2_subdev_format fmt = {
|
||||
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
|
||||
};
|
||||
struct v4l2_subdev *subdev;
|
||||
u32 pad;
|
||||
int ret;
|
||||
|
||||
if (format->type != video->type)
|
||||
return -EINVAL;
|
||||
|
|
@ -744,32 +748,11 @@ isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Fill the bytesperline and sizeimage fields by converting to media bus
|
||||
* format and back to pixel format.
|
||||
*/
|
||||
isp_video_pix_to_mbus(&format->fmt.pix, &fmt);
|
||||
isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix);
|
||||
|
||||
mutex_lock(&video->mutex);
|
||||
vfh->format = *format;
|
||||
mutex_unlock(&video->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
|
||||
{
|
||||
struct isp_video *video = video_drvdata(file);
|
||||
struct v4l2_subdev_format fmt = {
|
||||
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
|
||||
};
|
||||
struct v4l2_subdev *subdev;
|
||||
u32 pad;
|
||||
int ret;
|
||||
|
||||
if (format->type != video->type)
|
||||
return -EINVAL;
|
||||
if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
|
||||
isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
|
||||
isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
subdev = isp_video_remote_subdev(video, &pad);
|
||||
if (subdev == NULL)
|
||||
|
|
@ -786,6 +769,24 @@ isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
|
||||
{
|
||||
struct isp_video_fh *vfh = file_to_isp_video_fh(file);
|
||||
struct isp_video *video = video_drvdata(file);
|
||||
int ret;
|
||||
|
||||
ret = isp_video_try_format(file, fh, format);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mutex_lock(&video->mutex);
|
||||
vfh->format = *format;
|
||||
mutex_unlock(&video->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user