[media] cx88: v4l2-compliance fixes
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 3 Apr 2015 10:22:40 +0000 (07:22 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 1 May 2015 09:59:03 +0000 (06:59 -0300)
Fix three v4l2-compliance failures:

- the colorspace wasn't set in vidioc_try_fmt_vid_cap().
- the field wasn't set in v4l2_buffer when vb2_buffer_done() was called.
- the sequence wasn't set in v4l2_buffer when vb2_buffer_done() was called.
  This fix also removes the unused buf->count field and starts the count
  at 0 instead of 1.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx88/cx88-core.c
drivers/media/pci/cx88/cx88-mpeg.c
drivers/media/pci/cx88/cx88-vbi.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/cx88/cx88.h

index 3501be9f19d8646b3d2c22ecbfc20bd9b8b590ac..aab7cf4c9825e118bb0ecb506bd63fc018b66f3c 100644 (file)
@@ -519,6 +519,8 @@ void cx88_wakeup(struct cx88_core *core,
        buf = list_entry(q->active.next,
                         struct cx88_buffer, list);
        v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
+       buf->vb.v4l2_buf.field = core->field;
+       buf->vb.v4l2_buf.sequence = q->count++;
        list_del(&buf->list);
        vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
 }
index 98344540c51f83bb57be721a98d9c8b6288357c2..34f5057444772f34a364bd0a596adfe5b683588d 100644 (file)
@@ -173,7 +173,7 @@ int cx8802_start_dma(struct cx8802_dev    *dev,
 
        /* reset counter */
        cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET);
-       q->count = 1;
+       q->count = 0;
 
        /* enable irqs */
        dprintk( 1, "setting the interrupt mask\n" );
@@ -216,8 +216,6 @@ static int cx8802_restart_queue(struct cx8802_dev    *dev,
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
                buf, buf->vb.v4l2_buf.index);
        cx8802_start_dma(dev, q, buf);
-       list_for_each_entry(buf, &q->active, list)
-               buf->count = q->count++;
        return 0;
 }
 
@@ -260,7 +258,6 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
        if (list_empty(&cx88q->active)) {
                dprintk( 1, "queue is empty - first active\n" );
                list_add_tail(&buf->list, &cx88q->active);
-               buf->count    = cx88q->count++;
                dprintk(1,"[%p/%d] %s - first active\n",
                        buf, buf->vb.v4l2_buf.index, __func__);
 
@@ -269,7 +266,6 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
                dprintk( 1, "queue is not empty - append to active\n" );
                prev = list_entry(cx88q->active.prev, struct cx88_buffer, list);
                list_add_tail(&buf->list, &cx88q->active);
-               buf->count    = cx88q->count++;
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk( 1, "[%p/%d] %s - append to active\n",
                        buf, buf->vb.v4l2_buf.index, __func__);
index 32eb7fdb875e294268bedf94f265d9ac48a41ab3..7510e80eb2ff89537ec360ebb43867b382320e5f 100644 (file)
@@ -59,7 +59,7 @@ static int cx8800_start_vbi_dma(struct cx8800_dev    *dev,
 
        /* reset counter */
        cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET);
-       q->count = 1;
+       q->count = 0;
 
        /* enable irqs */
        cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_VIDINT);
@@ -102,8 +102,6 @@ int cx8800_restart_vbi_queue(struct cx8800_dev    *dev,
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
                buf, buf->vb.v4l2_buf.index);
        cx8800_start_vbi_dma(dev, q, buf);
-       list_for_each_entry(buf, &q->active, list)
-               buf->count = q->count++;
        return 0;
 }
 
@@ -175,7 +173,6 @@ static void buffer_queue(struct vb2_buffer *vb)
        if (list_empty(&q->active)) {
                list_add_tail(&buf->list, &q->active);
                cx8800_start_vbi_dma(dev, q, buf);
-               buf->count    = q->count++;
                dprintk(2,"[%p/%d] vbi_queue - first active\n",
                        buf, buf->vb.v4l2_buf.index);
 
@@ -183,7 +180,6 @@ static void buffer_queue(struct vb2_buffer *vb)
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(q->active.prev, struct cx88_buffer, list);
                list_add_tail(&buf->list, &q->active);
-               buf->count    = q->count++;
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2,"[%p/%d] buffer_queue - append to active\n",
                        buf, buf->vb.v4l2_buf.index);
index c9decd80bf619c0e750350f4c39fb89dd1cb1d45..cebb07d87617290d7fb03eb2ddf9a72c52525238 100644 (file)
@@ -370,7 +370,7 @@ static int start_video_dma(struct cx8800_dev    *dev,
 
        /* reset counter */
        cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET);
-       q->count = 1;
+       q->count = 0;
 
        /* enable irqs */
        cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_VIDINT);
@@ -423,8 +423,6 @@ static int restart_video_queue(struct cx8800_dev    *dev,
                dprintk(2,"restart_queue [%p/%d]: restart dma\n",
                        buf, buf->vb.v4l2_buf.index);
                start_video_dma(dev, q, buf);
-               list_for_each_entry(buf, &q->active, list)
-                       buf->count = q->count++;
        }
        return 0;
 }
@@ -523,7 +521,6 @@ static void buffer_queue(struct vb2_buffer *vb)
 
        if (list_empty(&q->active)) {
                list_add_tail(&buf->list, &q->active);
-               buf->count    = q->count++;
                dprintk(2,"[%p/%d] buffer_queue - first active\n",
                        buf, buf->vb.v4l2_buf.index);
 
@@ -531,7 +528,6 @@ static void buffer_queue(struct vb2_buffer *vb)
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(q->active.prev, struct cx88_buffer, list);
                list_add_tail(&buf->list, &q->active);
-               buf->count    = q->count++;
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
                        buf, buf->vb.v4l2_buf.index);
@@ -771,6 +767,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
                (f->fmt.pix.width * fmt->depth) >> 3;
        f->fmt.pix.sizeimage =
                f->fmt.pix.height * f->fmt.pix.bytesperline;
+       f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 
        return 0;
 }
index b9fe1ac248030518b984857566aa72707394ef8a..e75547827c523cdf3ef866ed7d1f1badc4a81752 100644 (file)
@@ -327,7 +327,6 @@ struct cx88_buffer {
        /* cx88 specific */
        unsigned int           bpl;
        struct cx88_riscmem    risc;
-       u32                    count;
 };
 
 struct cx88_dmaqueue {