linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] tm6000: bugfix video image
  2010-05-19 16:58 [PATCH 1/4] tm6000: bugfix incorrect size stefan.ringel
@ 2010-05-19 16:58 ` stefan.ringel
  0 siblings, 0 replies; 4+ messages in thread
From: stefan.ringel @ 2010-05-19 16:58 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab, d.belimov, Stefan Ringel

From: Stefan Ringel <stefan.ringel@arcor.de>

bugfix image interference, what sometimes lines in a left shift has.



Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
 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; ptr<endp;) {
 		if (!dev->isoc_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;
 }
-- 
1.7.0.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] tm6000: bugfix video image
@ 2010-05-27 14:43 Luis Henrique Fagundes
  2010-05-27 15:07 ` Stefan Ringel
  2010-05-27 15:44 ` Stefan Ringel
  0 siblings, 2 replies; 4+ messages in thread
From: Luis Henrique Fagundes @ 2010-05-27 14:43 UTC (permalink / raw)
  To: Linux Media Mailing List, Dmitri Belimov, Mauro Carvalho Chehab,
	Bee Hock Goh, Stefan Ringel

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]

Hi Stefan,

Looks like your patch sent on May 19th doesn't compile. I might be
missing something, but I needed the attached patch to make it compile.

Luis

[-- Attachment #2: patch3-fix-bugfix_video_image.patch --]
[-- Type: text/x-patch, Size: 798 bytes --]

--- a/drivers/staging/tm6000/tm6000-video.c	2010-05-26 09:13:19.000000000 -0300
+++ b/drivers/staging/tm6000/tm6000-video.c	2010-05-26 09:12:29.000000000 -0300
@@ -423,7 +423,7 @@
 					jiffies);
 			return rc;
 		}
+		if (!buf)
-		if (!*buf)
 			return 0;
 	}
 
@@ -452,7 +452,7 @@
 	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);
-		memcpy(&out_p[pos], ptr, cpysize);
+		memcpy(&outp[pos], ptr, cpysize);
 		pos+=cpysize;
 		ptr+=cpysize;
 		len-=cpysize;
@@ -464,8 +464,8 @@
 			get_next_buf (dma_q, &buf);
 			if (!buf)
 				break;
-			out_p = videobuf_to_vmalloc(&(buf->vb));
-			if (!out_p)
+			outp = videobuf_to_vmalloc(&(buf->vb));
+			if (!outp)
 				return rc;
 			pos = 0;
 		}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] tm6000: bugfix video image
  2010-05-27 14:43 [PATCH 3/4] tm6000: bugfix video image Luis Henrique Fagundes
@ 2010-05-27 15:07 ` Stefan Ringel
  2010-05-27 15:44 ` Stefan Ringel
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Ringel @ 2010-05-27 15:07 UTC (permalink / raw)
  To: Luis Henrique Fagundes
  Cc: Linux Media Mailing List, Dmitri Belimov, Mauro Carvalho Chehab,
	Bee Hock Goh

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

Am 27.05.2010 16:43, schrieb Luis Henrique Fagundes:
> Hi Stefan,
>
> Looks like your patch sent on May 19th doesn't compile. I might be
> missing something, but I needed the attached patch to make it compile.
>
> Luis
>   

That is bugfix in later patch ([5/5] tm6000:rewrite copy_streams
https://patchwork.kernel.org/patch/101759/ from 23.05.2010)




-- 
Stefan Ringel <stefan.ringel@arcor.de>


[-- Attachment #2: stefan_ringel.vcf --]
[-- Type: text/x-vcard, Size: 157 bytes --]

begin:vcard
fn:Stefan Ringel
n:Ringel;Stefan
email;internet:stefan.ringel@arcor.de
note:web: www.stefanringel.de
x-mozilla-html:FALSE
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] tm6000: bugfix video image
  2010-05-27 14:43 [PATCH 3/4] tm6000: bugfix video image Luis Henrique Fagundes
  2010-05-27 15:07 ` Stefan Ringel
@ 2010-05-27 15:44 ` Stefan Ringel
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Ringel @ 2010-05-27 15:44 UTC (permalink / raw)
  To: Luis Henrique Fagundes
  Cc: Linux Media Mailing List, Dmitri Belimov, Mauro Carvalho Chehab,
	Bee Hock Goh

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

Am 27.05.2010 16:43, schrieb Luis Henrique Fagundes:
> Hi Stefan,
>
> Looks like your patch sent on May 19th doesn't compile. I might be
> missing something, but I needed the attached patch to make it compile.
>
> Luis
>   

@@ -452,7 +452,7 @@
 	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);
-		memcpy(&out_p[pos], ptr, cpysize);
+		memcpy(&outp[pos], ptr, cpysize);
 		pos+=cpysize;
 		ptr+=cpysize;
 		len-=cpysize;
@@ -464,8 +464,8 @@
 			get_next_buf (dma_q, &buf);
 			if (!buf)
 				break;
-			out_p = videobuf_to_vmalloc(&(buf->vb));
-			if (!out_p)
+			outp = videobuf_to_vmalloc(&(buf->vb));
+			if (!outp)
 				return rc;
 			pos = 0;
 		}


I have overseen that, as I generate a patch. In my devel-tree I have outp.

-- 
Stefan Ringel <stefan.ringel@arcor.de>


[-- Attachment #2: stefan_ringel.vcf --]
[-- Type: text/x-vcard, Size: 157 bytes --]

begin:vcard
fn:Stefan Ringel
n:Ringel;Stefan
email;internet:stefan.ringel@arcor.de
note:web: www.stefanringel.de
x-mozilla-html:FALSE
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-27 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 14:43 [PATCH 3/4] tm6000: bugfix video image Luis Henrique Fagundes
2010-05-27 15:07 ` Stefan Ringel
2010-05-27 15:44 ` Stefan Ringel
  -- strict thread matches above, loose matches on Subject: below --
2010-05-19 16:58 [PATCH 1/4] tm6000: bugfix incorrect size stefan.ringel
2010-05-19 16:58 ` [PATCH 3/4] tm6000: bugfix video image stefan.ringel

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).