From patchwork Sat Jul 16 20:44:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 982502 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6GKje1M007585 for ; Sat, 16 Jul 2011 20:45:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755602Ab1GPUpF (ORCPT ); Sat, 16 Jul 2011 16:45:05 -0400 Received: from mail1-out1.atlantis.sk ([80.94.52.55]:42555 "EHLO mail.atlantis.sk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755574Ab1GPUpE (ORCPT ); Sat, 16 Jul 2011 16:45:04 -0400 Received: (qmail 7312 invoked from network); 16 Jul 2011 20:45:04 -0000 Received: from unknown (HELO pentium) (rainbow@rainbow-software.org@89.173.145.150) by mail.atlantis.sk with AES256-SHA encrypted SMTP; 16 Jul 2011 20:45:04 -0000 From: Ondrej Zary To: Joerg Heckenbach Subject: usbvision: disable scaling for Nogatech MicroCam Date: Sat, 16 Jul 2011 22:44:47 +0200 User-Agent: KMail/1.9.10 Cc: Dwaine Garden , linux-media@vger.kernel.org, Kernel development list MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201107162244.52979.linux@rainbow-software.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 16 Jul 2011 20:45:40 +0000 (UTC) Scaling causes bad artifacts (horizontal lines) with compression at least with Nogatech MicroCam so disable it (for this HW). This also fixes messed up image with some programs (Cheese with 160x120, Adobe Flash). HW seems to support only image widths that are multiple of 64 but the driver does not account that in vidioc_try_fmt_vid_cap(). Cheese calls try_fmt with 160x120, succeeds and then assumes that it really gets data in that resolution - but it gets 128x120 instead. Don't know if this affects other usbvision devices, it would be great if someone could test it. Signed-off-by: Ondrej Zary diff -urp linux-2.6.39-rc2-/drivers/media/video/usbvision//usbvision-video.c linux-2.6.39-rc2/drivers/media/video/usbvision/usbvision-video.c --- linux-2.6.39-rc2-/drivers/media/video/usbvision//usbvision-video.c 2011-07-16 16:42:35.000000000 +0200 +++ linux-2.6.39-rc2/drivers/media/video/usbvision/usbvision-video.c 2011-07-16 16:36:43.000000000 +0200 @@ -924,6 +924,11 @@ static int vidioc_try_fmt_vid_cap(struct RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); RESTRICT_TO_RANGE(vf->fmt.pix.height, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); + if (usbvision_device_data[usbvision->dev_model].codec == CODEC_WEBCAM) { + vf->fmt.pix.width = MAX_FRAME_WIDTH; + vf->fmt.pix.height = MAX_FRAME_HEIGHT; + } + vf->fmt.pix.bytesperline = vf->fmt.pix.width* usbvision->palette.bytes_per_pixel; vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*vf->fmt.pix.height; @@ -952,6 +957,11 @@ static int vidioc_s_fmt_vid_cap(struct f usbvision->cur_frame = NULL; + if (usbvision_device_data[usbvision->dev_model].codec == CODEC_WEBCAM) { + vf->fmt.pix.width = MAX_FRAME_WIDTH; + vf->fmt.pix.height = MAX_FRAME_HEIGHT; + } + /* by now we are committed to the new data... */ usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height);