Hi Laurent,

On Fri, 2018-01-05 at 15:30 +0200, Laurent Pinchart wrote:
> Hi Philipp,
> 
> Thank you for the patch.
> 
> On Friday, 5 January 2018 00:51:29 EET Philipp Zabel wrote:
> > The Microsoft HoloLens Sensors device has two separate frame descriptors
> > with the same dimensions, each with a single different frame interval:
> > 
> >       VideoStreaming Interface Descriptor:
> >         bLength                            30
> >         bDescriptorType                    36
> >         bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
> >         bFrameIndex                         1
> >         bmCapabilities                   0x00
> >           Still image unsupported
> >         wWidth                           1280
> >         wHeight                           481
> >         dwMinBitRate                147763200
> >         dwMaxBitRate                147763200
> >         dwMaxVideoFrameBufferSize      615680
> >         dwDefaultFrameInterval         333333
> >         bFrameIntervalType                  1
> >         dwFrameInterval( 0)            333333
> >       VideoStreaming Interface Descriptor:
> >         bLength                            30
> >         bDescriptorType                    36
> >         bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
> >         bFrameIndex                         2
> >         bmCapabilities                   0x00
> >           Still image unsupported
> >         wWidth                           1280
> >         wHeight                           481
> >         dwMinBitRate                443289600
> >         dwMaxBitRate                443289600
> >         dwMaxVideoFrameBufferSize      615680
> >         dwDefaultFrameInterval         111111
> >         bFrameIntervalType                  1
> >         dwFrameInterval( 0)            111111
> > 
> > Skip duplicate dimensions in enum_framesizes, let enum_frameintervals list
> > the intervals from both frame descriptors. Change set_streamparm to switch
> > to the correct frame index when changing the interval. This enables 90 fps
> > capture on a Lenovo Explorer Windows Mixed Reality headset.
> > 
> > Signed-off-by: Philipp Zabel <philipp.za...@gmail.com>
> > ---
> > Changes since v1 [1]:
> > - Break out of frame size loop if maxd == 0 in uvc_v4l2_set_streamparm.
> > - Moved d and tmp variables in uvc_v4l2_set_streamparm into loop,
> >   renamed tmp variable to tmp_ival.
> > - Changed i loop variables to unsigned int.
> > - Changed index variables to unsigned int.
> > - One line per variable declaration.
> > 
> > [1] https://patchwork.linuxtv.org/patch/46109/
> > ---
> >  drivers/media/usb/uvc/uvc_v4l2.c | 71
> > +++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+),
> > 16 deletions(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> > b/drivers/media/usb/uvc/uvc_v4l2.c index f5ab8164bca5..d9ee400bf47c 100644
> > --- a/drivers/media/usb/uvc/uvc_v4l2.c
> > +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> > @@ -373,7 +373,10 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming
> > *stream, {
> >     struct uvc_streaming_control probe;
> >     struct v4l2_fract timeperframe;
> > -   uint32_t interval;
> > +   struct uvc_format *format;
> > +   struct uvc_frame *frame;
> > +   __u32 interval, maxd;
> > +   unsigned int i;
> >     int ret;
> > 
> >     if (parm->type != stream->type)
> > @@ -396,9 +399,33 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming
> > *stream, return -EBUSY;
> >     }
> > 
> > +   format = stream->cur_format;
> > +   frame = stream->cur_frame;
> >     probe = stream->ctrl;
> > -   probe.dwFrameInterval =
> > -           uvc_try_frame_interval(stream->cur_frame, interval);
> > +   probe.dwFrameInterval = uvc_try_frame_interval(frame, interval);
> > +   maxd = abs((__s32)probe.dwFrameInterval - interval);
> > +
> > +   /* Try frames with matching size to find the best frame interval. */
> > +   for (i = 0; i < format->nframes && maxd != 0; i++) {
> > +           __u32 d, tmp_ival;
>
> How about ival instead of tmp_ival ?
> 
> Apart from that,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> 
> If you're fine with the change there's no need to resubmit.

Absolutely, thanks for the review!

regards
Philipp

Reply via email to