]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] saa7164: mundane buffer debugging changes to track issues
authorSteven Toth <stoth@kernellabs.com>
Sat, 31 Jul 2010 18:29:34 +0000 (15:29 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 09:54:58 +0000 (07:54 -0200)
Code is removed in future patches in this set.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7164/saa7164-buffer.c
drivers/media/video/saa7164/saa7164-core.c
drivers/media/video/saa7164/saa7164-encoder.c
drivers/media/video/saa7164/saa7164.h

index 5f45ea7f3d7cd2a4ad4e95878a22eb366729640f..c7bd81e248f6297dbbf5d3f130a8dc880ea53d71 100644 (file)
@@ -241,6 +241,7 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port)
 
        dprintk(DBGLVL_BUF, "%s(port=%d)\n", __func__, port->nr);
 
+       port->counter = 0;
        saa7164_writel(port->bufcounter, 0);
        saa7164_writel(port->pitch, params->pitch);
        saa7164_writel(port->bufsize, params->pitch * params->numberoflines);
index ad619b325e96c763966dafa04271e55d691c946b..09f7a64f538bf6e1d16754f5a677d6e7a9418106 100644 (file)
@@ -316,9 +316,9 @@ static void saa7164_work_enchandler(struct work_struct *w)
                if (buf->idx == rp) {
 
                        crc = crc32(0, buf->cpu, buf->actual_size);
-                       if (crc != port->shadow_crc[rp])
-                               printk(KERN_ERR "%s crc didn't match shadow was 0x%x now 0x%x\n",
-                                       __func__, port->shadow_crc[rp], crc);
+//                     if (crc != port->shadow_crc[rp])
+//                             printk(KERN_ERR "%s crc didn't match shadow was 0x%x now 0x%x\n",
+//                                     __func__, port->shadow_crc[rp], crc);
 
                        /* Found the buffer, deal with it */
                        dprintk(DBGLVL_IRQ, "%s() wp: %d processing: %d crc32: 0x%x\n",
@@ -350,12 +350,6 @@ static void saa7164_work_enchandler(struct work_struct *w)
                                        else
                                                ok = 0;
 
-                                       if (ok == 0)
-                                               printk(KERN_ERR
-                                                       "rp: %d dmacrc: 0x%08x shadcrc: 0x%08x ubufcrc: 0x%08x %s\n",
-                                                       rp, buf->crc, port->shadow_crc[rp], ubuf->crc,
-                                                       ok ? "crcgood" : "crcbad");
-
                                        /* Requeue the buffer on the free list */
                                        ubuf->pos = 0;
 
@@ -430,6 +424,7 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
        struct list_head *c, *n;
        int wp, rp, i = 0;
        u8 *p;
+       u32 *up, j;
 
        /* Find the current write point from the hardware */
        wp = saa7164_readl(port->bufcounter);
@@ -438,6 +433,8 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
                return 0;
        }
 
+       printk(KERN_ERR "port %p wp = %d\n", port, wp);
+
        /* Find the previous buffer to the current write point */
        if (wp == 0)
                rp = 7;
@@ -449,6 +446,11 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
                return 0;
        }
 
+       if (rp == port->last_irq_rp) {
+               printk(KERN_ERR "%s() Duplicate rp = %d port %p\n",
+                       __func__, rp, port);
+       }
+
        if (rp != ((port->last_irq_rp + 1) % 8)) {
                printk(KERN_ERR "%s() Multiple bufs on interrupt, port %p\n",
                        __func__, port);
@@ -503,16 +505,17 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
                }
 
                if (buf->idx == rp) {
-
-                       memcpy_fromio(port->shadow_buf[rp], buf->cpu, buf->actual_size);
-
+                       up = (u32 *)port->shadow_buf[rp];
+                       for (j = 0 ; j < (buf->actual_size / sizeof(u32)); j++) {
+                               *(up + j) = (rp << 28) | port->counter++;
+                       }
                        port->shadow_crc[rp] = crc32(0, port->shadow_buf[rp], buf->actual_size);
 
                        buf->crc = crc32(0, buf->cpu, buf->actual_size);
 
-                       if (port->shadow_crc[rp] != buf->crc)
-                               printk(KERN_ERR "%s() crc check failed 0x%x vs 0x%x\n",
-                                       __func__, port->shadow_crc[rp], buf->crc);
+//                     if (port->shadow_crc[rp] != buf->crc)
+//                             printk(KERN_ERR "%s() crc check failed 0x%x vs 0x%x\n",
+//                                     __func__, port->shadow_crc[rp], buf->crc);
                        break;
                }
 
index 08b62e41c466690a91c5ffe139feb1e2bfeacea0..b904c61f8f81d3f0497b08036b5ac288dbf3a7ce 100644 (file)
@@ -1008,6 +1008,7 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
        struct saa7164_user_buffer *buf = 0;
        struct saa7164_dev *dev = port->dev;
        u32 crc;
+       u32 *d;
 
        mutex_lock(&port->dmaqueue_lock);
        if (!list_empty(&port->list_buf_used.list)) {
@@ -1020,6 +1021,13 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
                                buf, buf->crc, crc);
                }
 
+               d = (u32 *)buf->data;
+
+               if ((*d & 0xffffff) > (port->read_counter + 0x2000))
+                       printk(KERN_ERR "%s() *d 0x%x port %p\n", __func__, *d, port);
+
+               port->read_counter = *d;
+
        }
        mutex_unlock(&port->dmaqueue_lock);
 
index 80571e0e3d4b0be0617c4ae29fd8c273e134cc32..58141dfed246d856ff35a6c156d948c58aec55ab 100644 (file)
@@ -395,7 +395,8 @@ struct saa7164_port {
        u8 *shadow_buf[8];
        u32 shadow_crc[8];
 
-       u32 dvd_pack_offset;
+       u32 counter;
+       u32 read_counter;
 };
 
 struct saa7164_dev {