mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 08:02:17 +00:00
[media] saa7134: store VBI hlen/vlen globally
Don't calculate this for every buffer, store it globally instead. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
51aefd738b
commit
01c3a846c5
@ -67,10 +67,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf,
|
||||
saa_writeb(SAA7134_VBI_PHASE_OFFSET_LUMA(task), 0x00);
|
||||
saa_writeb(SAA7134_VBI_PHASE_OFFSET_CHROMA(task), 0x00);
|
||||
|
||||
saa_writeb(SAA7134_VBI_H_LEN1(task), buf->vb.width & 0xff);
|
||||
saa_writeb(SAA7134_VBI_H_LEN2(task), buf->vb.width >> 8);
|
||||
saa_writeb(SAA7134_VBI_V_LEN1(task), buf->vb.height & 0xff);
|
||||
saa_writeb(SAA7134_VBI_V_LEN2(task), buf->vb.height >> 8);
|
||||
saa_writeb(SAA7134_VBI_H_LEN1(task), dev->vbi_hlen & 0xff);
|
||||
saa_writeb(SAA7134_VBI_H_LEN2(task), dev->vbi_hlen >> 8);
|
||||
saa_writeb(SAA7134_VBI_V_LEN1(task), dev->vbi_vlen & 0xff);
|
||||
saa_writeb(SAA7134_VBI_V_LEN2(task), dev->vbi_vlen >> 8);
|
||||
|
||||
saa_andorb(SAA7134_DATA_PATH(task), 0xc0, 0x00);
|
||||
}
|
||||
@ -98,12 +98,12 @@ static int buffer_activate(struct saa7134_dev *dev,
|
||||
SAA7134_RS_CONTROL_ME |
|
||||
(buf->pt->dma >> 12);
|
||||
saa_writel(SAA7134_RS_BA1(2), base);
|
||||
saa_writel(SAA7134_RS_BA2(2), base + buf->vb.size / 2);
|
||||
saa_writel(SAA7134_RS_PITCH(2), buf->vb.width);
|
||||
saa_writel(SAA7134_RS_BA2(2), base + dev->vbi_hlen * dev->vbi_vlen);
|
||||
saa_writel(SAA7134_RS_PITCH(2), dev->vbi_hlen);
|
||||
saa_writel(SAA7134_RS_CONTROL(2), control);
|
||||
saa_writel(SAA7134_RS_BA1(3), base);
|
||||
saa_writel(SAA7134_RS_BA2(3), base + buf->vb.size / 2);
|
||||
saa_writel(SAA7134_RS_PITCH(3), buf->vb.width);
|
||||
saa_writel(SAA7134_RS_BA2(3), base + dev->vbi_hlen * dev->vbi_vlen);
|
||||
saa_writel(SAA7134_RS_PITCH(3), dev->vbi_hlen);
|
||||
saa_writel(SAA7134_RS_CONTROL(3), control);
|
||||
|
||||
/* start DMA */
|
||||
@ -119,15 +119,10 @@ static int buffer_prepare(struct videobuf_queue *q,
|
||||
{
|
||||
struct saa7134_dev *dev = q->priv_data;
|
||||
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
|
||||
struct saa7134_tvnorm *norm = dev->tvnorm;
|
||||
unsigned int lines, llength, size;
|
||||
unsigned int size;
|
||||
int err;
|
||||
|
||||
lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
|
||||
if (lines > VBI_LINE_COUNT)
|
||||
lines = VBI_LINE_COUNT;
|
||||
llength = VBI_LINE_LENGTH;
|
||||
size = lines * llength * 2;
|
||||
size = dev->vbi_hlen * dev->vbi_vlen * 2;
|
||||
if (0 != buf->vb.baddr && buf->vb.bsize < size)
|
||||
return -EINVAL;
|
||||
|
||||
@ -137,8 +132,8 @@ static int buffer_prepare(struct videobuf_queue *q,
|
||||
if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
|
||||
struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
|
||||
|
||||
buf->vb.width = llength;
|
||||
buf->vb.height = lines;
|
||||
buf->vb.width = dev->vbi_hlen;
|
||||
buf->vb.height = dev->vbi_vlen;
|
||||
buf->vb.size = size;
|
||||
buf->pt = &dev->pt_vbi;
|
||||
|
||||
@ -166,11 +161,12 @@ static int
|
||||
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
|
||||
{
|
||||
struct saa7134_dev *dev = q->priv_data;
|
||||
int llength,lines;
|
||||
|
||||
lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1;
|
||||
llength = VBI_LINE_LENGTH;
|
||||
*size = lines * llength * 2;
|
||||
dev->vbi_vlen = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 + 1;
|
||||
if (dev->vbi_vlen > VBI_LINE_COUNT)
|
||||
dev->vbi_vlen = VBI_LINE_COUNT;
|
||||
dev->vbi_hlen = VBI_LINE_LENGTH;
|
||||
*size = dev->vbi_hlen * dev->vbi_vlen * 2;
|
||||
if (0 == *count)
|
||||
*count = vbibufs;
|
||||
*count = saa7134_buffer_count(*size,*count);
|
||||
|
@ -600,6 +600,7 @@ struct saa7134_dev {
|
||||
unsigned int vbi_fieldcount;
|
||||
struct saa7134_format *fmt;
|
||||
unsigned int width, height;
|
||||
unsigned int vbi_hlen, vbi_vlen;
|
||||
struct pm_qos_request qos_request;
|
||||
|
||||
/* various v4l controls */
|
||||
|
Loading…
Reference in New Issue
Block a user