media: omap3isp: v4l2-compliance fixes
v2 cover media: omap3isp: v4l2-compliance fixes
When I worked on the patch series to remove the vb2 wait_prepare/finish callbacks, I had to test that series on my Beagle xM board with a Leopard Imaging li5m03 camera.
Since I wanted to use v4l2-compliance to test the vb2 change, I first had to fix a bunch of other compliance problems in this driver so it would actually be able to run the streaming tests.
This series contains the fixes I made to get to that point.
It depends on one sensor driver fix (posted separately):
https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/
This series doesn't fix all compliance problems, but at least it is a lot better now.
Regards,
Hans
Changes since v1:
- Simplify isp_video_enum_format by checking for duplicate pixelformats
- Drop -ENOTTY to -EINVAL change in isp_video_try_format.
Hans Verkuil (11):
media: omap3isp: add V4L2_CAP_IO_MC and don't set bus_info
media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes
media: omap3isp: implement enum_fmt_vid_cap/out
media: omap3isp: use V4L2_COLORSPACE_SRGB instead of _JPEG
media: omap3isp: set initial format
media: omap3isp: rework isp_video_try/set_format
media: omap3isp: implement create/prepare_bufs
media: omap3isp: better VIDIOC_G/S_PARM handling
media: omap3isp: support ctrl events for isppreview
media: omap3isp: ispccp2: always clamp in ccp2_try_format()
media: omap3isp: isppreview: always clamp in preview_try_format()
drivers/media/platform/ti/omap3isp/ispccp2.c | 2 +- .../media/platform/ti/omap3isp/isppreview.c | 25 +-- .../media/platform/ti/omap3isp/ispresizer.c | 2 +- drivers/media/platform/ti/omap3isp/ispvideo.c | 178 +++++++++++++----- 4 files changed, 146 insertions(+), 61 deletions(-)
Signature · 1 line
2.51.0
PATCH v2 1/11 media: omap3isp: add V4L2_CAP_IO_MC and don't set bus_info
Since this is a media-centric device set the V4L2_CAP_IO_MC capability. Also don't set bus_info, leave that to the v4l2 core.
This fixes v4l2-compliance errors:
test MC information (see 'Media Driver Info' above): OK
fail: v4l2-compliance.cpp(661): missing bus_info prefix ('media')
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +3 -5
@@ -645,11 +645,9 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)strscpy (cap->driver,ISP_VIDEO_DRIVER_NAME ,sizeof (cap->driver));strscpy (cap->card, video->video.name,sizeof (cap->card)); -strscpy (cap->bus_info,"media" ,sizeof (cap->bus_info)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VIDEO_OUTPUT - |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS ; - + |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS |V4L2_CAP_IO_MC ;return 0 ; }
@@ -1451,10 +1449,10 @@ int omap3isp_video_init(struct isp_video *video, const char *name) video->video.ioctl_ops = &isp_video_ioctl_ops;if (video->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) video->video.device_caps =V4L2_CAP_VIDEO_CAPTURE - |V4L2_CAP_STREAMING ; + |V4L2_CAP_STREAMING |V4L2_CAP_IO_MC ;else video->video.device_caps =V4L2_CAP_VIDEO_OUTPUT - |V4L2_CAP_STREAMING ; + |V4L2_CAP_STREAMING |V4L2_CAP_IO_MC ; video->pipe.stream_state =ISP_PIPELINE_STREAM_STOPPED ;
Signature · 1 line
2.51.0
PATCH v2 2/11 media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes
In reply to Hans VerkuilThe isp_video_mbus_to_pix/pix_to_mbus functions did not take the last empty entry { 0, } of the formats array into account.
As a result, isp_video_mbus_to_pix would accept code 0 and isp_video_pix_to_mbus would select code 0 if no match was found.
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +3 -3
@@ -148,12 +148,12 @@ static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, pix->width = mbus->width; pix->height = mbus->height; -for (i =0 ; i <ARRAY_SIZE (formats); ++i) { +for (i =0 ; i <ARRAY_SIZE (formats) -1 ; ++i) {if (formats[i].code == mbus->code)break ; } -if (WARN_ON (i ==ARRAY_SIZE (formats))) +if (WARN_ON (i ==ARRAY_SIZE (formats) -1 ))return 0 ; min_bpl = pix->width * formats[i].bpp;
@@ -191,7 +191,7 @@ static void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix,/* Skip the last format in the loop so that it will be selected if no * match is found. */ -for (i =0 ; i <ARRAY_SIZE (formats) -1 ; ++i) { +for (i =0 ; i <ARRAY_SIZE (formats) -2 ; ++i) {if (formats[i].pixelformat == pix->pixelformat)break ; }
Signature · 1 line
2.51.0
PATCH v2 3/11 media: omap3isp: implement enum_fmt_vid_cap/out
In reply to Hans VerkuilAdd missing ioctls. This makes v4l2-compliance happier:
fail: v4l2-test-formats.cpp(516): pixelformat 59565955 (UYVY) for buftype 1 not reported by ENUM_FMT
test VIDIOC_G_FMT: FAIL
fail: v4l2-test-formats.cpp(516): pixelformat 59565955 (UYVY) for buftype 1 not reported by ENUM_FMT
test VIDIOC_TRY_FMT: FAIL
fail: v4l2-test-formats.cpp(516): pixelformat 56595559 (YUYV) for buftype 1 not reported by ENUM_FMT
test VIDIOC_S_FMT: FAIL
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +36 -3
@@ -35,6 +35,10 @@/* * NOTE: When adding new media bus codes, always remember to add * corresponding in-memory formats to the table below!!! +* +* If there are multiple entries with the same pixelformat but +* different media bus codes, then keep those together. Otherwise +* isp_video_enum_format() cannot detect duplicate pixelformats. */ static struct isp_format_info formats[] = { {MEDIA_BUS_FMT_Y8_1X8 ,MEDIA_BUS_FMT_Y8_1X8 ,
@@ -97,12 +101,12 @@ static struct isp_format_info formats[] = { {MEDIA_BUS_FMT_UYVY8_1X16 ,MEDIA_BUS_FMT_UYVY8_1X16 ,MEDIA_BUS_FMT_UYVY8_1X16 ,0 , V4L2_PIX_FMT_UYVY, 16, 2, }, - { MEDIA_BUS_FMT_YUYV8_1X16, MEDIA_BUS_FMT_YUYV8_1X16, -MEDIA_BUS_FMT_YUYV8_1X16 ,0 , - V4L2_PIX_FMT_YUYV, 16, 2, }, { MEDIA_BUS_FMT_UYVY8_2X8, MEDIA_BUS_FMT_UYVY8_2X8,MEDIA_BUS_FMT_UYVY8_2X8 ,0 , V4L2_PIX_FMT_UYVY, 8, 2, }, + { MEDIA_BUS_FMT_YUYV8_1X16, MEDIA_BUS_FMT_YUYV8_1X16, +MEDIA_BUS_FMT_YUYV8_1X16 ,0 , + V4L2_PIX_FMT_YUYV, 16, 2, }, { MEDIA_BUS_FMT_YUYV8_2X8, MEDIA_BUS_FMT_YUYV8_2X8,MEDIA_BUS_FMT_YUYV8_2X8 ,0 , V4L2_PIX_FMT_YUYV, 8, 2, },
@@ -652,6 +656,33 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)return 0 ; } +static int +isp_video_enum_format (struct file *file,void *fh,struct v4l2_fmtdesc *f) +{ +struct isp_video *video =video_drvdata (file); +unsigned int i, j; + +if (f->type != video->type) +return -EINVAL ; + +for (i =0 , j =0 ; i <ARRAY_SIZE (formats); i++) { +/* Weed out duplicate pixelformats with different mbus codes */ +if (!f->mbus_code && i && + formats[i -1 ].pixelformat == formats[i].pixelformat) +continue ; +if (f->mbus_code && formats[i].code != f->mbus_code) +continue ; + +if (j == f->index) { + f->pixelformat = formats[i].pixelformat; +return 0 ; + } + j++; + } + +return -EINVAL ; +} +static int isp_video_get_format (struct file *file,void *fh,struct v4l2_format *format) {
@@ -1258,9 +1289,11 @@ isp_video_s_input(struct file *file, void *fh, unsigned int input)static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { .vidioc_querycap = isp_video_querycap, + .vidioc_enum_fmt_vid_cap = isp_video_enum_format, .vidioc_g_fmt_vid_cap = isp_video_get_format, .vidioc_s_fmt_vid_cap = isp_video_set_format, .vidioc_try_fmt_vid_cap = isp_video_try_format, + .vidioc_enum_fmt_vid_out = isp_video_enum_format, .vidioc_g_fmt_vid_out = isp_video_get_format, .vidioc_s_fmt_vid_out = isp_video_set_format, .vidioc_try_fmt_vid_out = isp_video_try_format,
Signature · 1 line
2.51.0
PATCH v2 4/11 media: omap3isp: use V4L2_COLORSPACE_SRGB instead of _JPEG
In reply to Hans VerkuilJPEG colorspace should generally not be used unless it is actually dealing with JPG data. This fixes v4l2-compliance errors:
fail: v4l2-test-formats.cpp(416): pixelformat != V4L2_PIX_FMT_JPEG && pixelformat != V4L2_PIX_FMT_MJPEG && colorspace == V4L2_COLORSPACE_JPEG fail: v4l2-test-formats.cpp(521): testColorspace(!node->is_io_mc, pix.pixelformat, pix.colorspace, pix.ycbcr_enc, pix.quantization)
test VIDIOC_TRY_FMT: FAIL
--- drivers/media/platform/ti/omap3isp/isppreview.c | 2 +- drivers/media/platform/ti/omap3isp/ispresizer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/ti/omap3isp/isppreview.c +1 -1
@@ -1796,7 +1796,7 @@ static void preview_try_format(struct isp_prev_device *prev, fmt->width = crop->width; fmt->height = crop->height; - fmt->colorspace =V4L2_COLORSPACE_JPEG ; + fmt->colorspace =V4L2_COLORSPACE_SRGB ;break ; }
drivers/media/platform/ti/omap3isp/ispresizer.c +1 -1
@@ -1405,7 +1405,7 @@ static void resizer_try_format(struct isp_res_device *res,break ; } - fmt->colorspace =V4L2_COLORSPACE_JPEG ; + fmt->colorspace =V4L2_COLORSPACE_SRGB ; fmt->field =V4L2_FIELD_NONE ; }
Signature · 1 line
2.51.0
PATCH v2 5/11 media: omap3isp: set initial format
In reply to Hans VerkuilInitialize the v4l2_format to a default. Empty formats are not allowed in V4L2, so this fixes v4l2-compliance issues:
fail: v4l2-test-formats.cpp(514): !pix.width || !pix.height
test VIDIOC_G_FMT: FAIL
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/platform/ti/omap3isp/ispvideo.c +8 -0
@@ -1319,6 +1319,7 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {static int isp_video_open (struct file *file) {struct isp_video *video =video_drvdata (file); +struct v4l2_mbus_framefmt fmt;struct isp_video_fh *handle;struct vb2_queue *queue;int ret =0 ;
@@ -1361,6 +1362,13 @@ static int isp_video_open(struct file *file)memset (&handle->format,0 ,sizeof (handle->format)); handle->format.type = video->type; + handle->format.fmt.pix.width =720 ; + handle->format.fmt.pix.height =480 ; + handle->format.fmt.pix.pixelformat =V4L2_PIX_FMT_UYVY ; + handle->format.fmt.pix.field =V4L2_FIELD_NONE ; + handle->format.fmt.pix.colorspace =V4L2_COLORSPACE_SRGB ; +isp_video_pix_to_mbus (&handle->format.fmt.pix, &fmt); +isp_video_mbus_to_pix (video, &fmt, &handle->format.fmt.pix); handle->timeperframe.denominator =1 ; handle->video = video;
Signature · 1 line
2.51.0
PATCH v2 6/11 media: omap3isp: rework isp_video_try/set_format
In reply to Hans Verkuilisp_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
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +30 -29
@@ -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) {
Signature · 1 line
2.51.0
PATCH v2 7/11 media: omap3isp: implement create/prepare_bufs
In reply to Hans VerkuilAdd missing ioctls. This makes v4l2-compliance happier:
warn: v4l2-test-buffers.cpp(813): VIDIOC_CREATE_BUFS not supported
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +45 -2
@@ -329,6 +329,13 @@ static int isp_video_queue_setup(struct vb2_queue *queue,struct isp_video_fh *vfh =vb2_get_drv_priv (queue);struct isp_video *video = vfh->video; +if (*num_planes) { +if (*num_planes !=1 ) +return -EINVAL ; +if (sizes[0 ] < vfh->format.fmt.pix.sizeimage) +return -EINVAL ; +return 0 ; + } *num_planes =1 ; sizes[0 ] = vfh->format.fmt.pix.sizeimage;
@@ -344,6 +351,7 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf) {struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (buf);struct isp_video_fh *vfh =vb2_get_drv_priv (buf->vb2_queue); +unsigned int size = vfh->format.fmt.pix.sizeimage;struct isp_buffer *buffer =to_isp_buffer (vbuf);struct isp_video *video = vfh->video;dma_addr_t addr;
@@ -364,8 +372,13 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf)return -EINVAL ; } -vb2_set_plane_payload (&buffer->vb.vb2_buf,0 , - vfh->format.fmt.pix.sizeimage); +if (vb2_plane_size (&buffer->vb.vb2_buf,0 ) < size) { +dev_dbg (video->isp->dev, +"data will not fit into plane (%lu < %u)\n" , +vb2_plane_size (&buffer->vb.vb2_buf,0 ), size); +return -EINVAL ; + } +vb2_set_plane_payload (&buffer->vb.vb2_buf,0 , size); buffer->dma = addr;return 0 ;
@@ -935,6 +948,20 @@ isp_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb)return ret; } +static int +isp_video_create_bufs (struct file *file,void *fh,struct v4l2_create_buffers *p) +{ +struct isp_video_fh *vfh =file_to_isp_video_fh (file); +struct isp_video *video =video_drvdata (file); +int ret; + +mutex_lock (&video->queue_lock); + ret =vb2_create_bufs (&vfh->queue, p); +mutex_unlock (&video->queue_lock); + +return ret; +} +static int isp_video_querybuf (struct file *file,void *fh,struct v4l2_buffer *b) {
@@ -949,6 +976,20 @@ isp_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)return ret; } +static int +isp_video_prepare_buf (struct file *file,void *fh,struct v4l2_buffer *b) +{ +struct isp_video_fh *vfh =file_to_isp_video_fh (file); +struct isp_video *video =video_drvdata (file); +int ret; + +mutex_lock (&video->queue_lock); + ret =vb2_prepare_buf (&vfh->queue, video->video.v4l2_dev->mdev, b); +mutex_unlock (&video->queue_lock); + +return ret; +} +static int isp_video_qbuf (struct file *file,void *fh,struct v4l2_buffer *b) {
@@ -1303,7 +1344,9 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { .vidioc_g_parm = isp_video_get_param, .vidioc_s_parm = isp_video_set_param, .vidioc_reqbufs = isp_video_reqbufs, + .vidioc_create_bufs = isp_video_create_bufs, .vidioc_querybuf = isp_video_querybuf, + .vidioc_prepare_buf = isp_video_prepare_buf, .vidioc_qbuf = isp_video_qbuf, .vidioc_dqbuf = isp_video_dqbuf, .vidioc_streamon = isp_video_streamon,
Signature · 1 line
2.51.0
PATCH v2 8/11 media: omap3isp: better VIDIOC_G/S_PARM handling
In reply to Hans VerkuilFix various v4l2-compliance errors relating to timeperframe.
VIDIOC_G/S_PARM is only supported for Video Output, so disable these ioctls for Capture devices.
Ensure numerator and denominator are never 0.
Set missing V4L2_CAP_TIMEPERFRAME capability for VIDIOC_S_PARM.
v4l2-compliance:
fail: v4l2-test-formats.cpp(1388): out->timeperframe.numerator == 0 || out->timeperframe.denominator == 0
test VIDIOC_G/S_PARM: FAIL
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/media/platform/ti/omap3isp/ispvideo.c +9 -2
@@ -928,7 +928,10 @@ isp_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a)if (a->parm.output.timeperframe.denominator ==0 ) a->parm.output.timeperframe.denominator =1 ; +if (a->parm.output.timeperframe.numerator ==0 ) + a->parm.output.timeperframe.numerator =1 ; + a->parm.output.capability =V4L2_CAP_TIMEPERFRAME ; vfh->timeperframe = a->parm.output.timeperframe;return 0 ;
@@ -1413,6 +1416,7 @@ static int isp_video_open(struct file *file) handle->format.fmt.pix.colorspace =V4L2_COLORSPACE_SRGB ;isp_video_pix_to_mbus (&handle->format.fmt.pix, &fmt);isp_video_mbus_to_pix (video, &fmt, &handle->format.fmt.pix); + handle->timeperframe.numerator =1 ; handle->timeperframe.denominator =1 ; handle->video = video;
@@ -1532,12 +1536,15 @@ int omap3isp_video_init(struct isp_video *video, const char *name) video->video.vfl_type =VFL_TYPE_VIDEO ; video->video.release = video_device_release_empty; video->video.ioctl_ops = &isp_video_ioctl_ops; -if (video->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) +if (video->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE ) { video->video.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING |V4L2_CAP_IO_MC ; -else +v4l2_disable_ioctl (&video->video,VIDIOC_S_PARM ); +v4l2_disable_ioctl (&video->video,VIDIOC_G_PARM ); + }else { video->video.device_caps =V4L2_CAP_VIDEO_OUTPUT |V4L2_CAP_STREAMING |V4L2_CAP_IO_MC ; + } video->pipe.stream_state =ISP_PIPELINE_STREAM_STOPPED ;
Signature · 1 line
2.51.0
PATCH v2 9/11 media: omap3isp: support ctrl events for isppreview
In reply to Hans VerkuilThe preview subdev device was missing V4L2_SUBDEV_FL_HAS_EVENTS, and that prevented VIDIOC_SUBSCRIBE_EVENT from working.
Fixes a v4l2-compliance error:
fail: v4l2-test-controls.cpp(1128): subscribe event for control 'User Controls' failed
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
--- drivers/media/platform/ti/omap3isp/isppreview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti/omap3isp/isppreview.c +1 -1
@@ -2277,7 +2277,7 @@ static int preview_init_entities(struct isp_prev_device *prev)strscpy (sd->name,"OMAP3 ISP preview" ,sizeof (sd->name)); sd->grp_id =1 <<16 ;/* group ID for isp subdevs */ v4l2_set_subdevdata (sd, prev); - sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + sd->flags |=V4L2_SUBDEV_FL_HAS_EVENTS |V4L2_SUBDEV_FL_HAS_DEVNODE ;v4l2_ctrl_handler_init (&prev->ctrls,2 ); v4l2_ctrl_new_std(&prev->ctrls, &preview_ctrl_ops, V4L2_CID_BRIGHTNESS,
Signature · 1 line
2.51.0
PATCH v2 10/11 media: omap3isp: ispccp2: always clamp in ccp2_try_format()
In reply to Hans VerkuilIf ccp2->input == CCP2_INPUT_NONE, then try_format didn't clamp the width and height. This can happen with v4l2-compliance tests.
Always clamp.
This fixes this v4l2-compliance error:
fail: v4l2-test-subdevs.cpp(171): fse.max_width == ~0U || fse.max_height == ~0U fail: v4l2-test-subdevs.cpp(270): ret && ret != ENOTTY
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: FAIL
--- drivers/media/platform/ti/omap3isp/ispccp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti/omap3isp/ispccp2.c +1 -1
@@ -658,7 +658,7 @@ static void ccp2_try_format(struct isp_ccp2_device *ccp2, fmt->height =clamp_t (u32, fmt->height,ISPCCP2_DAT_SIZE_MIN ,ISPCCP2_DAT_SIZE_MAX ); - }else if (ccp2->input ==CCP2_INPUT_MEMORY ) { + }else { fmt->width =clamp_t (u32, fmt->width,ISPCCP2_LCM_HSIZE_COUNT_MIN ,ISPCCP2_LCM_HSIZE_COUNT_MAX );
Signature · 1 line
2.51.0
PATCH v2 11/11 media: omap3isp: isppreview: always clamp in preview_try_format()
In reply to Hans VerkuilIf prev->input != PREVIEW_INPUT_MEMORY the width and height weren't clamped. Just always clamp.
This fixes a v4l2-compliance error:
fail: v4l2-test-subdevs.cpp(171): fse.max_width == ~0U || fse.max_height == ~0U fail: v4l2-test-subdevs.cpp(270): ret && ret != ENOTTY
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: FAIL
--- .../media/platform/ti/omap3isp/isppreview.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/media/platform/ti/omap3isp/isppreview.c +8 -13
@@ -1742,22 +1742,17 @@ static void preview_try_format(struct isp_prev_device *prev,switch (pad) {case PREV_PAD_SINK : -/* When reading data from the CCDC, the input size has already -* been mangled by the CCDC output pad so it can be accepted -* as-is. -* -* When reading data from memory, clamp the requested width and -* height. The TRM doesn't specify a minimum input height, make +/* +* Clamp the requested width and height. +* The TRM doesn't specify a minimum input height, make * sure we got enough lines to enable the noise filter and color * filter array interpolation. */ -if (prev->input ==PREVIEW_INPUT_MEMORY ) { - fmt->width =clamp_t (u32, fmt->width,PREV_MIN_IN_WIDTH , -preview_max_out_width (prev)); - fmt->height =clamp_t (u32, fmt->height, -PREV_MIN_IN_HEIGHT , -PREV_MAX_IN_HEIGHT ); - } + fmt->width =clamp_t (u32, fmt->width,PREV_MIN_IN_WIDTH , +preview_max_out_width (prev)); + fmt->height =clamp_t (u32, fmt->height, +PREV_MIN_IN_HEIGHT , +PREV_MAX_IN_HEIGHT ); fmt->colorspace =V4L2_COLORSPACE_SRGB ;
Signature · 1 line
2.51.0