Re: [PATCH v10 26/38] media: add V4L2_SUBDEV_CAP_MPLEXED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 14, 2021 at 09:39:50AM +0100, Jacopo Mondi wrote:
> On Tue, Nov 30, 2021 at 04:15:24PM +0200, Tomi Valkeinen wrote:
> > Add a subdev capability flag to expose to userspace if a subdev supports
> > multiplexed streams.
> >
> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> > ---
> >  drivers/media/v4l2-core/v4l2-subdev.c | 4 +++-
> >  include/uapi/linux/v4l2-subdev.h      | 3 +++
> >  2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> > index 2053fe1cd67d..721148e35624 100644
> > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > @@ -419,7 +419,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
> >
> >  		memset(cap->reserved, 0, sizeof(cap->reserved));
> >  		cap->version = LINUX_VERSION_CODE;
> > -		cap->capabilities = ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0;
> > +		cap->capabilities =
> > +			(ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0) |
> > +			((sd->flags & V4L2_SUBDEV_FL_MULTIPLEXED) ? V4L2_SUBDEV_CAP_MPLEXED : 0);
> 
> I had been suggested to go for:
> 
> 	bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);
> 
> when introducing V4L2_SUBDEV_CAP_RO_SUBDEV.
> 
> To me it doesn't make much difference
> 
> Reviewed-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx>
> 
> >
> >  		return 0;
> >  	}
> > diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
> > index 658106f5b5dc..d91ab6f22fa7 100644
> > --- a/include/uapi/linux/v4l2-subdev.h
> > +++ b/include/uapi/linux/v4l2-subdev.h
> > @@ -188,6 +188,9 @@ struct v4l2_subdev_capability {
> >  /* The v4l2 sub-device video device node is registered in read-only mode. */
> >  #define V4L2_SUBDEV_CAP_RO_SUBDEV		0x00000001
> >
> > +/* The v4l2 sub-device supports multiplexed streams. */
> > +#define V4L2_SUBDEV_CAP_MPLEXED			0x00000002

We have V4L2_SUBDEV_FL_MULTIPLEXED vs. V4L2_SUBDEV_CAP_MPLEXED, can we
try to standardize naming ? V4L2 is notoriously bad in this area
(VIDIOC_ENUM_FMT vs. VIDIOC_ENUMSTD, v4l2_fmtdesc vs. v4l2_format, ...).
It would be nice to avoid repeating the same mistakes all the time, my
OCD is suffering :-( (and this also really hinders development, when one
has to always remember which abbreviation has been used in a given
context).

> > +
> >  /* Backwards compatibility define --- to be removed */
> >  #define v4l2_subdev_edid v4l2_edid
> >

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux