Message ID | 20211027120713.2240563-1-kieran.bingham@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Kieran, Thank you for the patch. On Wed, Oct 27, 2021 at 01:07:13PM +0100, Kieran Bingham wrote: > The V4L2Capability has helpers to interogate the capabilities > of a device. > > V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check > if the device is supported by a MediaController device. > > Provide a helper, and update the usage. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > --- > This might also be used in the upcoming RPi MediaController series, but > shouldn't block integration of that ... > --- > include/libcamera/internal/v4l2_videodevice.h | 4 ++++ > src/libcamera/v4l2_videodevice.cpp | 2 +- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h > index efe34d47e72b..a1c458e45088 100644 > --- a/include/libcamera/internal/v4l2_videodevice.h > +++ b/include/libcamera/internal/v4l2_videodevice.h > @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { > { > return device_caps() & V4L2_CAP_STREAMING; > } > + bool hasMediaController() const > + { > + return device_caps() & V4L2_CAP_IO_MC; > + } > }; > > class V4L2BufferCache > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > index 0cc622f91f2d..0fbf32bcfc00 100644 > --- a/src/libcamera/v4l2_videodevice.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code) > std::vector<V4L2PixelFormat> formats; > int ret; > > - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { > + if (code && !(caps_.hasMediaController())) { if (code && !caps_.hasMediaController()) { Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > LOG(V4L2, Error) > << "Media bus code filtering not supported by the device"; > return {};
Hi Kieran, Thank you for your patch. On Wed, 27 Oct 2021 at 13:07, Kieran Bingham < kieran.bingham@ideasonboard.com> wrote: > The V4L2Capability has helpers to interogate the capabilities > of a device. > > V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check > if the device is supported by a MediaController device. > > Provide a helper, and update the usage. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Just what I needed :-) Reviewed-by: Naushir Patuck <naush@raspberrypi.com> > > --- > This might also be used in the upcoming RPi MediaController series, but > shouldn't block integration of that ... > --- > include/libcamera/internal/v4l2_videodevice.h | 4 ++++ > src/libcamera/v4l2_videodevice.cpp | 2 +- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/include/libcamera/internal/v4l2_videodevice.h > b/include/libcamera/internal/v4l2_videodevice.h > index efe34d47e72b..a1c458e45088 100644 > --- a/include/libcamera/internal/v4l2_videodevice.h > +++ b/include/libcamera/internal/v4l2_videodevice.h > @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { > { > return device_caps() & V4L2_CAP_STREAMING; > } > + bool hasMediaController() const > + { > + return device_caps() & V4L2_CAP_IO_MC; > + } > }; > > class V4L2BufferCache > diff --git a/src/libcamera/v4l2_videodevice.cpp > b/src/libcamera/v4l2_videodevice.cpp > index 0cc622f91f2d..0fbf32bcfc00 100644 > --- a/src/libcamera/v4l2_videodevice.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat> > V4L2VideoDevice::enumPixelformats(uint32_t code) > std::vector<V4L2PixelFormat> formats; > int ret; > > - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { > + if (code && !(caps_.hasMediaController())) { > LOG(V4L2, Error) > << "Media bus code filtering not supported by the > device"; > return {}; > -- > 2.30.2 > >
On Wed, Oct 27, 2021 at 03:27:27PM +0300, Laurent Pinchart wrote: > Hi Kieran, > > Thank you for the patch. > > On Wed, Oct 27, 2021 at 01:07:13PM +0100, Kieran Bingham wrote: > > The V4L2Capability has helpers to interogate the capabilities > > of a device. > > > > V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check > > if the device is supported by a MediaController device. > > > > Provide a helper, and update the usage. > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > --- > > This might also be used in the upcoming RPi MediaController series, but > > shouldn't block integration of that ... > > --- > > include/libcamera/internal/v4l2_videodevice.h | 4 ++++ > > src/libcamera/v4l2_videodevice.cpp | 2 +- > > 2 files changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h > > index efe34d47e72b..a1c458e45088 100644 > > --- a/include/libcamera/internal/v4l2_videodevice.h > > +++ b/include/libcamera/internal/v4l2_videodevice.h > > @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { > > { > > return device_caps() & V4L2_CAP_STREAMING; > > } > > + bool hasMediaController() const > > + { > > + return device_caps() & V4L2_CAP_IO_MC; > > + } > > }; > > > > class V4L2BufferCache > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > > index 0cc622f91f2d..0fbf32bcfc00 100644 > > --- a/src/libcamera/v4l2_videodevice.cpp > > +++ b/src/libcamera/v4l2_videodevice.cpp > > @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code) > > std::vector<V4L2PixelFormat> formats; > > int ret; > > > > - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { > > + if (code && !(caps_.hasMediaController())) { > > if (code && !caps_.hasMediaController()) { > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Or rather, when hasMediaController() will be documented :-) > > LOG(V4L2, Error) > > << "Media bus code filtering not supported by the device"; > > return {};
Quoting Laurent Pinchart (2021-10-27 13:34:20) > On Wed, Oct 27, 2021 at 03:27:27PM +0300, Laurent Pinchart wrote: > > Hi Kieran, > > > > Thank you for the patch. > > > > On Wed, Oct 27, 2021 at 01:07:13PM +0100, Kieran Bingham wrote: > > > The V4L2Capability has helpers to interogate the capabilities > > > of a device. > > > > > > V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check > > > if the device is supported by a MediaController device. > > > > > > Provide a helper, and update the usage. > > > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > > > --- > > > This might also be used in the upcoming RPi MediaController series, but > > > shouldn't block integration of that ... > > > --- > > > include/libcamera/internal/v4l2_videodevice.h | 4 ++++ > > > src/libcamera/v4l2_videodevice.cpp | 2 +- > > > 2 files changed, 5 insertions(+), 1 deletion(-) > > > > > > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h > > > index efe34d47e72b..a1c458e45088 100644 > > > --- a/include/libcamera/internal/v4l2_videodevice.h > > > +++ b/include/libcamera/internal/v4l2_videodevice.h > > > @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { > > > { > > > return device_caps() & V4L2_CAP_STREAMING; > > > } > > > + bool hasMediaController() const > > > + { > > > + return device_caps() & V4L2_CAP_IO_MC; > > > + } > > > }; > > > > > > class V4L2BufferCache > > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > > > index 0cc622f91f2d..0fbf32bcfc00 100644 > > > --- a/src/libcamera/v4l2_videodevice.cpp > > > +++ b/src/libcamera/v4l2_videodevice.cpp > > > @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code) > > > std::vector<V4L2PixelFormat> formats; > > > int ret; > > > > > > - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { > > > + if (code && !(caps_.hasMediaController())) { > > > > if (code && !caps_.hasMediaController()) { > > > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Or rather, when hasMediaController() will be documented :-) Oh yeah ;-) That too ... I was too hasty sending this out while reviewing Naushs series ;-) v2 imminent. > > > > LOG(V4L2, Error) > > > << "Media bus code filtering not supported by the device"; > > > return {}; > > -- > Regards, > > Laurent Pinchart
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index efe34d47e72b..a1c458e45088 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -109,6 +109,10 @@ struct V4L2Capability final : v4l2_capability { { return device_caps() & V4L2_CAP_STREAMING; } + bool hasMediaController() const + { + return device_caps() & V4L2_CAP_IO_MC; + } }; class V4L2BufferCache diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 0cc622f91f2d..0fbf32bcfc00 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1019,7 +1019,7 @@ std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code) std::vector<V4L2PixelFormat> formats; int ret; - if (code && !(caps_.device_caps() & V4L2_CAP_IO_MC)) { + if (code && !(caps_.hasMediaController())) { LOG(V4L2, Error) << "Media bus code filtering not supported by the device"; return {};
The V4L2Capability has helpers to interogate the capabilities of a device. V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check if the device is supported by a MediaController device. Provide a helper, and update the usage. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- This might also be used in the upcoming RPi MediaController series, but shouldn't block integration of that ... --- include/libcamera/internal/v4l2_videodevice.h | 4 ++++ src/libcamera/v4l2_videodevice.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)