diff mbox series

usb: gadget: g_webcam: Send color matching descriptor per frame

Message ID 20221216160528.479094-1-dan.scally@ideasonboard.com (mailing list archive)
State Accepted
Commit e95765e97d9cb93258a4840440d410fa6ff7e819
Headers show
Series usb: gadget: g_webcam: Send color matching descriptor per frame | expand

Commit Message

Dan Scally Dec. 16, 2022, 4:05 p.m. UTC
Currently the color matching descriptor is only sent across the wire
a single time, following the descriptors for each format and frame.
According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
Descriptors"):

"Only one instance is allowed for a given format and if present,
the Color Matching descriptor shall be placed following the Video
and Still Image Frame descriptors for that format".

Add another reference to the color matching descriptor after the
yuyv frames so that it's correctly transmitted for that format
too.

Fixes: a9914127e834 ("USB gadget: Webcam device")
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
 drivers/usb/gadget/legacy/webcam.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Pinchart Dec. 18, 2022, 3:55 p.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Fri, Dec 16, 2022 at 04:05:28PM +0000, Daniel Scally wrote:
> Currently the color matching descriptor is only sent across the wire
> a single time, following the descriptors for each format and frame.
> According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
> Descriptors"):
> 
> "Only one instance is allowed for a given format and if present,
> the Color Matching descriptor shall be placed following the Video
> and Still Image Frame descriptors for that format".
> 
> Add another reference to the color matching descriptor after the
> yuyv frames so that it's correctly transmitted for that format
> too.
> 
> Fixes: a9914127e834 ("USB gadget: Webcam device")
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/usb/gadget/legacy/webcam.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
> index 53e38f87472b..c06dd1af7a0c 100644
> --- a/drivers/usb/gadget/legacy/webcam.c
> +++ b/drivers/usb/gadget/legacy/webcam.c
> @@ -293,6 +293,7 @@ static const struct uvc_descriptor_header * const uvc_fs_streaming_cls[] = {
>  	(const struct uvc_descriptor_header *) &uvc_format_yuv,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> +	(const struct uvc_descriptor_header *) &uvc_color_matching,
>  	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
> @@ -305,6 +306,7 @@ static const struct uvc_descriptor_header * const uvc_hs_streaming_cls[] = {
>  	(const struct uvc_descriptor_header *) &uvc_format_yuv,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> +	(const struct uvc_descriptor_header *) &uvc_color_matching,
>  	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
> @@ -317,6 +319,7 @@ static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = {
>  	(const struct uvc_descriptor_header *) &uvc_format_yuv,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> +	(const struct uvc_descriptor_header *) &uvc_color_matching,
>  	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
>  	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
Kieran Bingham Dec. 19, 2022, 10:31 a.m. UTC | #2
Quoting Laurent Pinchart (2022-12-18 15:55:44)
> Hi Dan,
> 
> Thank you for the patch.
> 
> On Fri, Dec 16, 2022 at 04:05:28PM +0000, Daniel Scally wrote:
> > Currently the color matching descriptor is only sent across the wire
> > a single time, following the descriptors for each format and frame.
> > According to the UVC 1.5 Specification 3.9.2.6 ("Color Matching
> > Descriptors"):
> > 
> > "Only one instance is allowed for a given format and if present,
> > the Color Matching descriptor shall be placed following the Video
> > and Still Image Frame descriptors for that format".
> > 
> > Add another reference to the color matching descriptor after the
> > yuyv frames so that it's correctly transmitted for that format
> > too.
> > 
> > Fixes: a9914127e834 ("USB gadget: Webcam device")
> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> 

Oh - wow this was easier than I anticipated.

Likewise:

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> >  drivers/usb/gadget/legacy/webcam.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
> > index 53e38f87472b..c06dd1af7a0c 100644
> > --- a/drivers/usb/gadget/legacy/webcam.c
> > +++ b/drivers/usb/gadget/legacy/webcam.c
> > @@ -293,6 +293,7 @@ static const struct uvc_descriptor_header * const uvc_fs_streaming_cls[] = {
> >       (const struct uvc_descriptor_header *) &uvc_format_yuv,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> > +     (const struct uvc_descriptor_header *) &uvc_color_matching,
> >       (const struct uvc_descriptor_header *) &uvc_format_mjpg,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
> > @@ -305,6 +306,7 @@ static const struct uvc_descriptor_header * const uvc_hs_streaming_cls[] = {
> >       (const struct uvc_descriptor_header *) &uvc_format_yuv,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> > +     (const struct uvc_descriptor_header *) &uvc_color_matching,
> >       (const struct uvc_descriptor_header *) &uvc_format_mjpg,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
> > @@ -317,6 +319,7 @@ static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = {
> >       (const struct uvc_descriptor_header *) &uvc_format_yuv,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
> > +     (const struct uvc_descriptor_header *) &uvc_color_matching,
> >       (const struct uvc_descriptor_header *) &uvc_format_mjpg,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
> >       (const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
> 
> -- 
> Regards,
> 
> Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
index 53e38f87472b..c06dd1af7a0c 100644
--- a/drivers/usb/gadget/legacy/webcam.c
+++ b/drivers/usb/gadget/legacy/webcam.c
@@ -293,6 +293,7 @@  static const struct uvc_descriptor_header * const uvc_fs_streaming_cls[] = {
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
@@ -305,6 +306,7 @@  static const struct uvc_descriptor_header * const uvc_hs_streaming_cls[] = {
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,
@@ -317,6 +319,7 @@  static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = {
 	(const struct uvc_descriptor_header *) &uvc_format_yuv,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_yuv_720p,
+	(const struct uvc_descriptor_header *) &uvc_color_matching,
 	(const struct uvc_descriptor_header *) &uvc_format_mjpg,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_360p,
 	(const struct uvc_descriptor_header *) &uvc_frame_mjpg_720p,