Commit 637bc207 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cx88: remove fmt from the buffer struct

This is a duplicate of dev->fmt and can be removed. As a consequence a
lot of tests that check if the format has changed midstream can be
removed as well: the format cannot change midstream, so this is a bogus
check.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 082417d1
...@@ -229,17 +229,13 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, ...@@ -229,17 +229,13 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
dprintk(1,"[%p/%d] restart_queue - first active\n", dprintk(1,"[%p/%d] restart_queue - first active\n",
buf,buf->vb.i); buf,buf->vb.i);
} else if (prev->vb.width == buf->vb.width && } else {
prev->vb.height == buf->vb.height &&
prev->fmt == buf->fmt) {
list_move_tail(&buf->vb.queue, &q->active); list_move_tail(&buf->vb.queue, &q->active);
buf->vb.state = VIDEOBUF_ACTIVE; buf->vb.state = VIDEOBUF_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
dprintk(1,"[%p/%d] restart_queue - move to active\n", dprintk(1,"[%p/%d] restart_queue - move to active\n",
buf,buf->vb.i); buf,buf->vb.i);
} else {
return 0;
} }
prev = buf; prev = buf;
} }
......
...@@ -420,7 +420,7 @@ static int start_video_dma(struct cx8800_dev *dev, ...@@ -420,7 +420,7 @@ static int start_video_dma(struct cx8800_dev *dev,
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21], cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21],
buf->bpl, buf->risc.dma); buf->bpl, buf->risc.dma);
cx88_set_scale(core, buf->vb.width, buf->vb.height, buf->vb.field); cx88_set_scale(core, buf->vb.width, buf->vb.height, buf->vb.field);
cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); cx_write(MO_COLOR_CTRL, dev->fmt->cxformat | ColorFormatGamma);
/* reset counter */ /* reset counter */
cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET); cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET);
...@@ -497,17 +497,13 @@ static int restart_video_queue(struct cx8800_dev *dev, ...@@ -497,17 +497,13 @@ static int restart_video_queue(struct cx8800_dev *dev,
dprintk(2,"[%p/%d] restart_queue - first active\n", dprintk(2,"[%p/%d] restart_queue - first active\n",
buf,buf->vb.i); buf,buf->vb.i);
} else if (prev->vb.width == buf->vb.width && } else {
prev->vb.height == buf->vb.height &&
prev->fmt == buf->fmt) {
list_move_tail(&buf->vb.queue, &q->active); list_move_tail(&buf->vb.queue, &q->active);
buf->vb.state = VIDEOBUF_ACTIVE; buf->vb.state = VIDEOBUF_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
dprintk(2,"[%p/%d] restart_queue - move to active\n", dprintk(2,"[%p/%d] restart_queue - move to active\n",
buf,buf->vb.i); buf,buf->vb.i);
} else {
return 0;
} }
prev = buf; prev = buf;
} }
...@@ -538,7 +534,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -538,7 +534,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
int rc, init_buffer = 0; int rc;
BUG_ON(NULL == dev->fmt); BUG_ON(NULL == dev->fmt);
if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) || if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) ||
...@@ -548,59 +544,47 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -548,59 +544,47 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
return -EINVAL; return -EINVAL;
if (buf->fmt != dev->fmt || buf->vb.width = dev->width;
buf->vb.width != dev->width || buf->vb.height = dev->height;
buf->vb.height != dev->height || buf->vb.field = field;
buf->vb.field != field) {
buf->fmt = dev->fmt;
buf->vb.width = dev->width;
buf->vb.height = dev->height;
buf->vb.field = field;
init_buffer = 1;
}
if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
init_buffer = 1;
if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
goto fail; goto fail;
} }
if (init_buffer) { buf->bpl = buf->vb.width * dev->fmt->depth >> 3;
buf->bpl = buf->vb.width * buf->fmt->depth >> 3; switch (buf->vb.field) {
switch (buf->vb.field) { case V4L2_FIELD_TOP:
case V4L2_FIELD_TOP: cx88_risc_buffer(dev->pci, &buf->risc,
cx88_risc_buffer(dev->pci, &buf->risc, dma->sglist, 0, UNSET,
dma->sglist, 0, UNSET, buf->bpl, 0, buf->vb.height);
buf->bpl, 0, buf->vb.height); break;
break; case V4L2_FIELD_BOTTOM:
case V4L2_FIELD_BOTTOM: cx88_risc_buffer(dev->pci, &buf->risc,
cx88_risc_buffer(dev->pci, &buf->risc, dma->sglist, UNSET, 0,
dma->sglist, UNSET, 0, buf->bpl, 0, buf->vb.height);
buf->bpl, 0, buf->vb.height); break;
break; case V4L2_FIELD_SEQ_TB:
case V4L2_FIELD_INTERLACED: cx88_risc_buffer(dev->pci, &buf->risc,
cx88_risc_buffer(dev->pci, &buf->risc, dma->sglist,
dma->sglist, 0, buf->bpl, 0, buf->bpl * (buf->vb.height >> 1),
buf->bpl, buf->bpl, buf->bpl, 0,
buf->vb.height >> 1); buf->vb.height >> 1);
break; break;
case V4L2_FIELD_SEQ_TB: case V4L2_FIELD_SEQ_BT:
cx88_risc_buffer(dev->pci, &buf->risc, cx88_risc_buffer(dev->pci, &buf->risc,
dma->sglist, dma->sglist,
0, buf->bpl * (buf->vb.height >> 1), buf->bpl * (buf->vb.height >> 1), 0,
buf->bpl, 0, buf->bpl, 0,
buf->vb.height >> 1); buf->vb.height >> 1);
break; break;
case V4L2_FIELD_SEQ_BT: case V4L2_FIELD_INTERLACED:
cx88_risc_buffer(dev->pci, &buf->risc, default:
dma->sglist, cx88_risc_buffer(dev->pci, &buf->risc,
buf->bpl * (buf->vb.height >> 1), 0, dma->sglist, 0, buf->bpl,
buf->bpl, 0, buf->bpl, buf->bpl,
buf->vb.height >> 1); buf->vb.height >> 1);
break; break;
default:
BUG();
}
} }
dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
buf, buf->vb.i, buf, buf->vb.i,
...@@ -646,22 +630,12 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) ...@@ -646,22 +630,12 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
} else { } else {
prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue);
if (prev->vb.width == buf->vb.width && list_add_tail(&buf->vb.queue, &q->active);
prev->vb.height == buf->vb.height && buf->vb.state = VIDEOBUF_ACTIVE;
prev->fmt == buf->fmt) { buf->count = q->count++;
list_add_tail(&buf->vb.queue,&q->active); prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
buf->vb.state = VIDEOBUF_ACTIVE; dprintk(2, "[%p/%d] buffer_queue - append to active\n",
buf->count = q->count++; buf, buf->vb.i);
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
dprintk(2,"[%p/%d] buffer_queue - append to active\n",
buf, buf->vb.i);
} else {
list_add_tail(&buf->vb.queue,&q->queued);
buf->vb.state = VIDEOBUF_QUEUED;
dprintk(2,"[%p/%d] buffer_queue - first queued\n",
buf, buf->vb.i);
}
} }
} }
......
...@@ -319,7 +319,6 @@ struct cx88_buffer { ...@@ -319,7 +319,6 @@ struct cx88_buffer {
/* cx88 specific */ /* cx88 specific */
unsigned int bpl; unsigned int bpl;
struct btcx_riscmem risc; struct btcx_riscmem risc;
const struct cx8800_fmt *fmt;
u32 count; u32 count;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment