]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (3426): PATCH cx88-mpeg: cx8802_restart_queue() for blackbird
authorJelle Foks <jelle@foks.8m.com>
Thu, 9 Mar 2006 20:44:07 +0000 (17:44 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 25 Jun 2006 05:05:07 +0000 (02:05 -0300)
Fixes "cx8802_restart_queue: queue is empty" storm in syslog

Signed-off-by: Jelle Foks <jelle@foks.8m.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx88/cx88-mpeg.c

index e1b38ff0c8a38586875e5351ac21e2c7cd0b0513..a9d7795a8e143563ed155c109d474d725671012e 100644 (file)
@@ -143,10 +143,43 @@ static int cx8802_restart_queue(struct cx8802_dev    *dev,
        struct cx88_buffer *buf;
        struct list_head *item;
 
-       dprintk( 0, "cx8802_restart_queue\n" );
+       dprintk( 1, "cx8802_restart_queue\n" );
        if (list_empty(&q->active))
        {
-               dprintk( 0, "cx8802_restart_queue: queue is empty\n" );
+              struct cx88_buffer *prev;
+              prev = NULL;
+
+              dprintk(1, "cx8802_restart_queue: queue is empty\n" );
+
+              for (;;) {
+                      if (list_empty(&q->queued))
+                              return 0;
+                      buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue);
+                      if (NULL == prev) {
+                              list_del(&buf->vb.queue);
+                              list_add_tail(&buf->vb.queue,&q->active);
+                              cx8802_start_dma(dev, q, buf);
+                              buf->vb.state = STATE_ACTIVE;
+                              buf->count    = q->count++;
+                              mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
+                              dprintk(1,"[%p/%d] restart_queue - first active\n",
+                                      buf,buf->vb.i);
+
+                      } else if (prev->vb.width  == buf->vb.width  &&
+                                 prev->vb.height == buf->vb.height &&
+                                 prev->fmt       == buf->fmt) {
+                              list_del(&buf->vb.queue);
+                              list_add_tail(&buf->vb.queue,&q->active);
+                              buf->vb.state = STATE_ACTIVE;
+                              buf->count    = q->count++;
+                              prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
+                              dprintk(1,"[%p/%d] restart_queue - move to active\n",
+                                      buf,buf->vb.i);
+                      } else {
+                              return 0;
+                      }
+                      prev = buf;
+              }
                return 0;
        }