From patchwork Wed May 19 16:58:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Ringel X-Patchwork-Id: 3456 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 19 May 2010 17:00:40 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 19 May 2010 14:04:22 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OEmdM-0002rC-KY; Wed, 19 May 2010 17:00:40 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482Ab0ESRAj (ORCPT + 1 other); Wed, 19 May 2010 13:00:39 -0400 Received: from mail-in-16.arcor-online.net ([151.189.21.56]:40592 "EHLO mail-in-16.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752307Ab0ESRAi (ORCPT ); Wed, 19 May 2010 13:00:38 -0400 Received: from mail-in-03-z2.arcor-online.net (mail-in-03-z2.arcor-online.net [151.189.8.15]) by mx.arcor.de (Postfix) with ESMTP id 7F69D86E5; Wed, 19 May 2010 19:00:36 +0200 (CEST) Received: from mail-in-01.arcor-online.net (mail-in-01.arcor-online.net [151.189.21.41]) by mail-in-03-z2.arcor-online.net (Postfix) with ESMTP id 72E0A9DDF5; Wed, 19 May 2010 19:00:36 +0200 (CEST) Received: from localhost.localdomain (dslb-094-222-008-085.pools.arcor-ip.net [94.222.8.85]) (Authenticated sender: stefan.ringel@arcor.de) by mail-in-01.arcor-online.net (Postfix) with ESMTPA id 10BFC5A5B0; Wed, 19 May 2010 19:00:36 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-01.arcor-online.net 10BFC5A5B0 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1274288436; bh=Z6rqqdpQywT77FTqjiqoTPv9+egYxb9iCWZImtkB0Kg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=rIyQGX50F6eyv0NszyG60/IqZrblOTDlZw46yOj5B16rxAUsNldEJA3F4b9Y9gQDY MbwMiRFapq4i+1kbgkjExZKj9JC6JB/Ew6bfgM/1KD8VzAyjNWDqnmuaa/UTsV7TkW Za5vcSF+EMLR8cc11wAg5vE9DJrSgvBO7+Ite7e0= From: stefan.ringel@arcor.de To: linux-media@vger.kernel.org Cc: mchehab@redhat.com, d.belimov@gmail.com, Stefan Ringel Subject: [PATCH 3/4] tm6000: bugfix video image Date: Wed, 19 May 2010 18:58:26 +0200 Message-Id: <1274288307-2858-5-git-send-email-stefan.ringel@arcor.de> X-Mailer: git-send-email 1.7.0.3 In-Reply-To: <1274288307-2858-3-git-send-email-stefan.ringel@arcor.de> References: <1274288307-2858-3-git-send-email-stefan.ringel@arcor.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Stefan Ringel bugfix image interference, what sometimes lines in a left shift has. Signed-off-by: Stefan Ringel --- drivers/staging/tm6000/tm6000-video.c | 82 +++++++++++++++++---------------- 1 files changed, 42 insertions(+), 40 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index f1acd79..4d92a12 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -339,14 +339,23 @@ static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, return rc; } -static int copy_streams(u8 *data, u8 *out_p, unsigned long len, - struct urb *urb, struct tm6000_buffer **buf) +static int copy_streams(u8 *data, unsigned long len, + struct urb *urb) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); u8 *ptr=data, *endp=data+len; unsigned long header=0; int rc=0; + struct tm6000_buffer *buf; + char *outp = NULL; + + get_next_buf(dma_q, &buf); + if (buf) + outp = videobuf_to_vmalloc(&buf->vb); + + if (!outp) + return 0; for (ptr=data; ptrisoc_ctl.cmd) { @@ -394,7 +403,7 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, } HEADER: /* Copy or continue last copy */ - rc=copy_packet(urb,header,&ptr,endp,out_p,buf); + rc=copy_packet(urb,header,&ptr,endp,outp,&buf); if (rc<0) { buf=NULL; printk(KERN_ERR "tm6000: buffer underrun at %ld\n", @@ -410,30 +419,39 @@ HEADER: /* * Identify the tm5600/6000 buffer header type and properly handles */ -static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, - struct urb *urb, struct tm6000_buffer **buf) +static int copy_multiplexed(u8 *ptr, unsigned long len, + struct urb *urb) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); unsigned int pos=dev->isoc_ctl.pos,cpysize; int rc=1; + struct tm6000_buffer *buf; + char *outp = NULL; + + get_next_buf(dma_q, &buf); + if (buf) + outp = videobuf_to_vmalloc(&buf->vb); + + if (!outp) + return 0; while (len>0) { - cpysize=min(len,(*buf)->vb.size-pos); -//printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); + cpysize=min(len,buf->vb.size-pos); + //printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); memcpy(&out_p[pos], ptr, cpysize); pos+=cpysize; ptr+=cpysize; len-=cpysize; - if (pos >= (*buf)->vb.size) { + if (pos >= buf->vb.size) { pos=0; /* Announces that a new buffer were filled */ - buffer_filled (dev, dma_q, *buf); + buffer_filled (dev, dma_q, buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - get_next_buf (dma_q, buf); - if (!*buf) + get_next_buf (dma_q, &buf); + if (!buf) break; - out_p = videobuf_to_vmalloc(&((*buf)->vb)); + out_p = videobuf_to_vmalloc(&(buf->vb)); if (!out_p) return rc; pos = 0; @@ -493,52 +511,36 @@ static inline int tm6000_isoc_copy(struct urb *urb) struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); struct tm6000_buffer *buf; - int i, len=0, rc=1; - int size; - char *outp = NULL, *p; - unsigned long copied; + int i, len=0, rc=1, status; + char *p; - get_next_buf(dma_q, &buf); - if (buf) - outp = videobuf_to_vmalloc(&buf->vb); - - if (!outp) - return 0; - - size = buf->vb.size; - - copied=0; - - if (urb->status<0) { - print_err_status (dev,-1,urb->status); + if (urb->status < 0) { + print_err_status (dev, -1, urb->status); return 0; } for (i = 0; i < urb->number_of_packets; i++) { - int status = urb->iso_frame_desc[i].status; + status = urb->iso_frame_desc[i].status; if (status<0) { print_err_status (dev,i,status); continue; } - len=urb->iso_frame_desc[i].actual_length; + len = urb->iso_frame_desc[i].actual_length; -// if (len>=TM6000_URB_MSG_LEN) { - p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; + if (len > 0) { + p = urb->transfer_buffer + urb->iso_frame_desc[i].offset; if (!urb->iso_frame_desc[i].status) { - if ((buf->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { - rc=copy_multiplexed(p, outp, len, urb, &buf); + if ((dev->fourcc)==V4L2_PIX_FMT_TM6000) { + rc=copy_multiplexed(p, len, urb); if (rc<=0) return rc; } else { - copy_streams(p, outp, len, urb, &buf); + copy_streams(p, len, urb); } } - copied += len; - if (copied >= size || !buf) - break; -// } + } } return rc; }