diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-04-17 04:55:43 -0300 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:55:36 +0900 |
commit | 926855a9bee9becac92929d466c3f7c45b13f212 (patch) | |
tree | 649a4db36de2689d0dae44df2ae25e00ac130954 | |
parent | b2928c7c50a22b370fcb279c3924955064bd5e48 (diff) | |
download | linux-3.10-926855a9bee9becac92929d466c3f7c45b13f212.tar.gz linux-3.10-926855a9bee9becac92929d466c3f7c45b13f212.tar.bz2 linux-3.10-926855a9bee9becac92929d466c3f7c45b13f212.zip |
upstream: [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>
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-vbi.c | 38 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134.h | 1 |
2 files changed, 18 insertions, 21 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c b/drivers/media/pci/saa7134/saa7134-vbi.c index e044539361f..7f285633529 100644 --- a/drivers/media/pci/saa7134/saa7134-vbi.c +++ b/drivers/media/pci/saa7134/saa7134-vbi.c @@ -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); diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 3f7cd5f6ef5..77b16a7c066 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -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 */ |