Message ID | 20201125123710.28491-2-andrey.konovalov@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] Revert "media: camss: Make use of V4L2_CAP_IO_MC" | expand |
Hey Andrey, I've suggested a small change, with that feel free to add my r-b. Reviewed-by: Robert Foss <robert.foss@linaro.org> On Wed, 25 Nov 2020 at 13:37, Andrey Konovalov <andrey.konovalov@linaro.org> wrote: > > Implement mbus_code filtering for format enumeration. > > Without this patch libcamera errors out with: > "ERROR V4L2 v4l2_videodevice.cpp:982 /dev/video0[cap]: Media bus code > filtering not supported by the device" > > This is the second version of this change which handles the case of > several pixel formats corresponding to one media bus format correctly. > > Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> > --- > drivers/media/platform/qcom/camss/camss-video.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c > index 20673de9020e..60737b771d52 100644 > --- a/drivers/media/platform/qcom/camss/camss-video.c > +++ b/drivers/media/platform/qcom/camss/camss-video.c > @@ -539,6 +539,7 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) > { > struct camss_video *video = video_drvdata(file); > int i, j, k; > + u32 mcode = f->mbus_code; > > if (f->type != video->type) > return -EINVAL; > @@ -549,7 +550,12 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) > /* find index "i" of "k"th unique pixelformat in formats array */ Maybe this is a good place to explain how mcode is used, and for which extension it is required. > k = -1; > for (i = 0; i < video->nformats; i++) { > + if (mcode != 0 && video->formats[i].code != mcode) > + continue; > + > for (j = 0; j < i; j++) { > + if (mcode != 0 && video->formats[j].code != mcode) > + continue; > if (video->formats[i].pixelformat == > video->formats[j].pixelformat) > break; > @@ -948,8 +954,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, > } > > vdev->fops = &msm_vid_fops; > - vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING | > - V4L2_CAP_READWRITE; > + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING > + | V4L2_CAP_READWRITE | V4L2_CAP_IO_MC; > vdev->ioctl_ops = &msm_vid_ioctl_ops; > vdev->release = msm_video_release; > vdev->v4l2_dev = v4l2_dev; > -- > 2.17.1 >
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index 20673de9020e..60737b771d52 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -539,6 +539,7 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) { struct camss_video *video = video_drvdata(file); int i, j, k; + u32 mcode = f->mbus_code; if (f->type != video->type) return -EINVAL; @@ -549,7 +550,12 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) /* find index "i" of "k"th unique pixelformat in formats array */ k = -1; for (i = 0; i < video->nformats; i++) { + if (mcode != 0 && video->formats[i].code != mcode) + continue; + for (j = 0; j < i; j++) { + if (mcode != 0 && video->formats[j].code != mcode) + continue; if (video->formats[i].pixelformat == video->formats[j].pixelformat) break; @@ -948,8 +954,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, } vdev->fops = &msm_vid_fops; - vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING | - V4L2_CAP_READWRITE; + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING + | V4L2_CAP_READWRITE | V4L2_CAP_IO_MC; vdev->ioctl_ops = &msm_vid_ioctl_ops; vdev->release = msm_video_release; vdev->v4l2_dev = v4l2_dev;
Implement mbus_code filtering for format enumeration. Without this patch libcamera errors out with: "ERROR V4L2 v4l2_videodevice.cpp:982 /dev/video0[cap]: Media bus code filtering not supported by the device" This is the second version of this change which handles the case of several pixel formats corresponding to one media bus format correctly. Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> --- drivers/media/platform/qcom/camss/camss-video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)