From: kbuild test robot <lkp@intel.com>
To: Sergey Zakharchenko <szakharchenko@digital-loggers.com>
Cc: kbuild-all@01.org, linux-media@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Martin Bodo <martin@digital-loggers.com>,
"Logan, Peter" <peter.logan@intel.com>,
Auke Kok <auke-jan.h.kok@intel.com>,
Sergey Zakharchenko <doublef.mobil@gmail.com>,
Sergey Zakharchenko <szakharchenko@digital-loggers.com>
Subject: Re: [PATCH] media: uvcvideo: Add a quirk to force GEO GC6500 Camera bits-per-pixel value
Date: Wed, 2 Oct 2019 20:00:01 +0800 [thread overview]
Message-ID: <201910021929.ij7Rrmvk%lkp@intel.com> (raw)
In-Reply-To: <20191002084723.76329-1-szakharchenko@digital-loggers.com>
[-- Attachment #1: Type: text/plain, Size: 11650 bytes --]
Hi Sergey,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[cannot apply to v5.4-rc1 next-20191002]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Sergey-Zakharchenko/media-uvcvideo-Add-a-quirk-to-force-GEO-GC6500-Camera-bits-per-pixel-value/20191002-185359
base: git://linuxtv.org/media_tree.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/media/usb/uvc/uvc_driver.c: In function 'uvc_parse_format.isra.6':
>> drivers/media/usb/uvc/uvc_driver.c:507:18: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
n = info->bpp[i] * div;
~~~~~~~~~^~~
vim +/i +507 drivers/media/usb/uvc/uvc_driver.c
436
437 /* ------------------------------------------------------------------------
438 * Descriptors parsing
439 */
440
441 static int uvc_parse_format(struct uvc_device *dev,
442 struct uvc_streaming *streaming, struct uvc_format *format,
443 u32 **intervals, unsigned char *buffer, int buflen)
444 {
445 struct usb_interface *intf = streaming->intf;
446 struct usb_host_interface *alts = intf->cur_altsetting;
447 struct uvc_format_desc *fmtdesc;
448 struct uvc_frame *frame;
449 const struct v4l2_format_info *info;
450 const unsigned char *start = buffer;
451 unsigned int width_multiplier = 1;
452 unsigned int interval;
453 unsigned int i, n;
454 unsigned int div;
455 u8 ftype;
456
457 format->type = buffer[2];
458 format->index = buffer[3];
459
460 switch (buffer[2]) {
461 case UVC_VS_FORMAT_UNCOMPRESSED:
462 case UVC_VS_FORMAT_FRAME_BASED:
463 n = buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED ? 27 : 28;
464 if (buflen < n) {
465 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
466 "interface %d FORMAT error\n",
467 dev->udev->devnum,
468 alts->desc.bInterfaceNumber);
469 return -EINVAL;
470 }
471
472 /* Find the format descriptor from its GUID. */
473 fmtdesc = uvc_format_by_guid(&buffer[5]);
474
475 if (fmtdesc != NULL) {
476 strscpy(format->name, fmtdesc->name,
477 sizeof(format->name));
478 format->fcc = fmtdesc->fcc;
479 } else {
480 uvc_printk(KERN_INFO, "Unknown video format %pUl\n",
481 &buffer[5]);
482 snprintf(format->name, sizeof(format->name), "%pUl\n",
483 &buffer[5]);
484 format->fcc = 0;
485 }
486
487 format->bpp = buffer[21];
488
489 /* Some devices report a format that doesn't match what they
490 * really send.
491 */
492 if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
493 if (format->fcc == V4L2_PIX_FMT_YUYV) {
494 strscpy(format->name, "Greyscale 8-bit (Y8 )",
495 sizeof(format->name));
496 format->fcc = V4L2_PIX_FMT_GREY;
497 format->bpp = 8;
498 width_multiplier = 2;
499 }
500 }
501
502 /* Some devices report bpp that doesn't match the format. */
503 if (dev->quirks & UVC_QUIRK_FORCE_BPP) {
504 info = v4l2_format_info(format->fcc);
505 if (info) {
506 div = info->hdiv * info->vdiv;
> 507 n = info->bpp[i] * div;
508 for (i = 1; i < info->comp_planes; i++)
509 n += info->bpp[i];
510 format->bpp = DIV_ROUND_UP(8 * n, div);
511 }
512 }
513
514 if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
515 ftype = UVC_VS_FRAME_UNCOMPRESSED;
516 } else {
517 ftype = UVC_VS_FRAME_FRAME_BASED;
518 if (buffer[27])
519 format->flags = UVC_FMT_FLAG_COMPRESSED;
520 }
521 break;
522
523 case UVC_VS_FORMAT_MJPEG:
524 if (buflen < 11) {
525 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
526 "interface %d FORMAT error\n",
527 dev->udev->devnum,
528 alts->desc.bInterfaceNumber);
529 return -EINVAL;
530 }
531
532 strscpy(format->name, "MJPEG", sizeof(format->name));
533 format->fcc = V4L2_PIX_FMT_MJPEG;
534 format->flags = UVC_FMT_FLAG_COMPRESSED;
535 format->bpp = 0;
536 ftype = UVC_VS_FRAME_MJPEG;
537 break;
538
539 case UVC_VS_FORMAT_DV:
540 if (buflen < 9) {
541 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
542 "interface %d FORMAT error\n",
543 dev->udev->devnum,
544 alts->desc.bInterfaceNumber);
545 return -EINVAL;
546 }
547
548 switch (buffer[8] & 0x7f) {
549 case 0:
550 strscpy(format->name, "SD-DV", sizeof(format->name));
551 break;
552 case 1:
553 strscpy(format->name, "SDL-DV", sizeof(format->name));
554 break;
555 case 2:
556 strscpy(format->name, "HD-DV", sizeof(format->name));
557 break;
558 default:
559 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
560 "interface %d: unknown DV format %u\n",
561 dev->udev->devnum,
562 alts->desc.bInterfaceNumber, buffer[8]);
563 return -EINVAL;
564 }
565
566 strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
567 sizeof(format->name));
568
569 format->fcc = V4L2_PIX_FMT_DV;
570 format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
571 format->bpp = 0;
572 ftype = 0;
573
574 /* Create a dummy frame descriptor. */
575 frame = &format->frame[0];
576 memset(&format->frame[0], 0, sizeof(format->frame[0]));
577 frame->bFrameIntervalType = 1;
578 frame->dwDefaultFrameInterval = 1;
579 frame->dwFrameInterval = *intervals;
580 *(*intervals)++ = 1;
581 format->nframes = 1;
582 break;
583
584 case UVC_VS_FORMAT_MPEG2TS:
585 case UVC_VS_FORMAT_STREAM_BASED:
586 /* Not supported yet. */
587 default:
588 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
589 "interface %d unsupported format %u\n",
590 dev->udev->devnum, alts->desc.bInterfaceNumber,
591 buffer[2]);
592 return -EINVAL;
593 }
594
595 uvc_trace(UVC_TRACE_DESCR, "Found format %s.\n", format->name);
596
597 buflen -= buffer[0];
598 buffer += buffer[0];
599
600 /* Parse the frame descriptors. Only uncompressed, MJPEG and frame
601 * based formats have frame descriptors.
602 */
603 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
604 buffer[2] == ftype) {
605 frame = &format->frame[format->nframes];
606 if (ftype != UVC_VS_FRAME_FRAME_BASED)
607 n = buflen > 25 ? buffer[25] : 0;
608 else
609 n = buflen > 21 ? buffer[21] : 0;
610
611 n = n ? n : 3;
612
613 if (buflen < 26 + 4*n) {
614 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
615 "interface %d FRAME error\n", dev->udev->devnum,
616 alts->desc.bInterfaceNumber);
617 return -EINVAL;
618 }
619
620 frame->bFrameIndex = buffer[3];
621 frame->bmCapabilities = buffer[4];
622 frame->wWidth = get_unaligned_le16(&buffer[5])
623 * width_multiplier;
624 frame->wHeight = get_unaligned_le16(&buffer[7]);
625 frame->dwMinBitRate = get_unaligned_le32(&buffer[9]);
626 frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]);
627 if (ftype != UVC_VS_FRAME_FRAME_BASED) {
628 frame->dwMaxVideoFrameBufferSize =
629 get_unaligned_le32(&buffer[17]);
630 frame->dwDefaultFrameInterval =
631 get_unaligned_le32(&buffer[21]);
632 frame->bFrameIntervalType = buffer[25];
633 } else {
634 frame->dwMaxVideoFrameBufferSize = 0;
635 frame->dwDefaultFrameInterval =
636 get_unaligned_le32(&buffer[17]);
637 frame->bFrameIntervalType = buffer[21];
638 }
639 frame->dwFrameInterval = *intervals;
640
641 /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
642 * completely. Observed behaviours range from setting the
643 * value to 1.1x the actual frame size to hardwiring the
644 * 16 low bits to 0. This results in a higher than necessary
645 * memory usage as well as a wrong image size information. For
646 * uncompressed formats this can be fixed by computing the
647 * value from the frame size.
648 */
649 if (!(format->flags & UVC_FMT_FLAG_COMPRESSED))
650 frame->dwMaxVideoFrameBufferSize = format->bpp
651 * frame->wWidth * frame->wHeight / 8;
652
653 /* Some bogus devices report dwMinFrameInterval equal to
654 * dwMaxFrameInterval and have dwFrameIntervalStep set to
655 * zero. Setting all null intervals to 1 fixes the problem and
656 * some other divisions by zero that could happen.
657 */
658 for (i = 0; i < n; ++i) {
659 interval = get_unaligned_le32(&buffer[26+4*i]);
660 *(*intervals)++ = interval ? interval : 1;
661 }
662
663 /* Make sure that the default frame interval stays between
664 * the boundaries.
665 */
666 n -= frame->bFrameIntervalType ? 1 : 2;
667 frame->dwDefaultFrameInterval =
668 min(frame->dwFrameInterval[n],
669 max(frame->dwFrameInterval[0],
670 frame->dwDefaultFrameInterval));
671
672 if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) {
673 frame->bFrameIntervalType = 1;
674 frame->dwFrameInterval[0] =
675 frame->dwDefaultFrameInterval;
676 }
677
678 uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n",
679 frame->wWidth, frame->wHeight,
680 10000000/frame->dwDefaultFrameInterval,
681 (100000000/frame->dwDefaultFrameInterval)%10);
682
683 format->nframes++;
684 buflen -= buffer[0];
685 buffer += buffer[0];
686 }
687
688 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
689 buffer[2] == UVC_VS_STILL_IMAGE_FRAME) {
690 buflen -= buffer[0];
691 buffer += buffer[0];
692 }
693
694 if (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
695 buffer[2] == UVC_VS_COLORFORMAT) {
696 if (buflen < 6) {
697 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
698 "interface %d COLORFORMAT error\n",
699 dev->udev->devnum,
700 alts->desc.bInterfaceNumber);
701 return -EINVAL;
702 }
703
704 format->colorspace = uvc_colorspace(buffer[3]);
705
706 buflen -= buffer[0];
707 buffer += buffer[0];
708 }
709
710 return buffer - start;
711 }
712
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59095 bytes --]
next prev parent reply other threads:[~2019-10-02 12:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 8:47 [PATCH] media: uvcvideo: Add a quirk to force GEO GC6500 Camera bits-per-pixel value Sergey Zakharchenko
2019-10-02 12:00 ` kbuild test robot [this message]
2019-10-02 13:01 ` [PATCH v2] " Sergey Zakharchenko
2019-10-02 14:08 ` Laurent Pinchart
2019-10-02 14:54 ` Sergey Zakharchenko
2019-10-02 17:15 ` Sergey Zakharchenko
2019-10-02 19:08 ` Laurent Pinchart
2019-10-02 19:29 ` Sergey Zakharchenko
2019-10-03 9:31 ` [PATCH v3] " Sergey Zakharchenko
2019-12-18 18:00 ` Laurent Pinchart
2019-12-18 18:46 ` Sergey Zakharchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201910021929.ij7Rrmvk%lkp@intel.com \
--to=lkp@intel.com \
--cc=auke-jan.h.kok@intel.com \
--cc=doublef.mobil@gmail.com \
--cc=kbuild-all@01.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=martin@digital-loggers.com \
--cc=mchehab@kernel.org \
--cc=peter.logan@intel.com \
--cc=szakharchenko@digital-loggers.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).