[media] cx23885: add vbi buffer formatting, window changes and video core changes
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
4f9c41439c
Коммит
5ab27e6d31
|
@ -1214,6 +1214,54 @@ int cx23885_risc_databuffer(struct pci_dev *pci,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
|
struct scatterlist *sglist, unsigned int top_offset,
|
||||||
|
unsigned int bottom_offset, unsigned int bpl,
|
||||||
|
unsigned int padding, unsigned int lines)
|
||||||
|
{
|
||||||
|
u32 instructions, fields;
|
||||||
|
__le32 *rp;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
fields = 0;
|
||||||
|
if (UNSET != top_offset)
|
||||||
|
fields++;
|
||||||
|
if (UNSET != bottom_offset)
|
||||||
|
fields++;
|
||||||
|
|
||||||
|
/* estimate risc mem: worst case is one write per page border +
|
||||||
|
one write per scan line + syncs + jump (all 2 dwords). Padding
|
||||||
|
can cause next bpl to start close to a page border. First DMA
|
||||||
|
region may be smaller than PAGE_SIZE */
|
||||||
|
/* write and jump need and extra dword */
|
||||||
|
instructions = fields * (1 + ((bpl + padding) * lines)
|
||||||
|
/ PAGE_SIZE + lines);
|
||||||
|
instructions += 2;
|
||||||
|
rc = btcx_riscmem_alloc(pci, risc, instructions*12);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
/* write risc instructions */
|
||||||
|
rp = risc->cpu;
|
||||||
|
|
||||||
|
/* Sync to line 6, so US CC line 21 will appear in line '12'
|
||||||
|
* in the userland vbi payload */
|
||||||
|
if (UNSET != top_offset)
|
||||||
|
rp = cx23885_risc_field(rp, sglist, top_offset, 6,
|
||||||
|
bpl, padding, lines, 0);
|
||||||
|
|
||||||
|
if (UNSET != bottom_offset)
|
||||||
|
rp = cx23885_risc_field(rp, sglist, bottom_offset, 0x207,
|
||||||
|
bpl, padding, lines, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* save pointer to jmp instruction address */
|
||||||
|
risc->jmp = rp;
|
||||||
|
BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
|
int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
u32 reg, u32 mask, u32 value)
|
u32 reg, u32 mask, u32 value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,12 +56,13 @@ int cx23885_vbi_fmt(struct file *file, void *priv,
|
||||||
if (dev->tvnorm & V4L2_STD_525_60) {
|
if (dev->tvnorm & V4L2_STD_525_60) {
|
||||||
/* ntsc */
|
/* ntsc */
|
||||||
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
|
f->fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
|
||||||
f->fmt.vbi.sampling_rate = 28636363;
|
f->fmt.vbi.sampling_rate = 27000000;
|
||||||
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
|
||||||
f->fmt.vbi.offset = 64 * 4;
|
f->fmt.vbi.offset = 0;
|
||||||
|
f->fmt.vbi.flags = 0;
|
||||||
f->fmt.vbi.start[0] = 10;
|
f->fmt.vbi.start[0] = 10;
|
||||||
f->fmt.vbi.count[0] = 17;
|
f->fmt.vbi.count[0] = 17;
|
||||||
f->fmt.vbi.start[1] = 272;
|
f->fmt.vbi.start[1] = 263 + 10 + 1;
|
||||||
f->fmt.vbi.count[1] = 17;
|
f->fmt.vbi.count[1] = 17;
|
||||||
} else if (dev->tvnorm & V4L2_STD_625_50) {
|
} else if (dev->tvnorm & V4L2_STD_625_50) {
|
||||||
/* pal */
|
/* pal */
|
||||||
|
@ -222,7 +223,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
|
||||||
rc = videobuf_iolock(q, &buf->vb, NULL);
|
rc = videobuf_iolock(q, &buf->vb, NULL);
|
||||||
if (0 != rc)
|
if (0 != rc)
|
||||||
goto fail;
|
goto fail;
|
||||||
cx23885_risc_buffer(dev->pci, &buf->risc,
|
cx23885_risc_vbibuffer(dev->pci, &buf->risc,
|
||||||
dma->sglist,
|
dma->sglist,
|
||||||
0, buf->vb.width * buf->vb.height,
|
0, buf->vb.width * buf->vb.height,
|
||||||
buf->vb.width, 0,
|
buf->vb.width, 0,
|
||||||
|
|
|
@ -1070,7 +1070,8 @@ static int vidioc_streamon(struct file *file, void *priv,
|
||||||
struct cx23885_dev *dev = fh->dev;
|
struct cx23885_dev *dev = fh->dev;
|
||||||
dprintk(1, "%s()\n", __func__);
|
dprintk(1, "%s()\n", __func__);
|
||||||
|
|
||||||
if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
|
if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
|
||||||
|
(fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (unlikely(i != fh->type))
|
if (unlikely(i != fh->type))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1087,7 +1088,8 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
|
||||||
int err, res;
|
int err, res;
|
||||||
dprintk(1, "%s()\n", __func__);
|
dprintk(1, "%s()\n", __func__);
|
||||||
|
|
||||||
if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
|
if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
|
||||||
|
(fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (i != fh->type)
|
if (i != fh->type)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -509,6 +509,11 @@ extern int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
unsigned int top_offset, unsigned int bottom_offset,
|
unsigned int top_offset, unsigned int bottom_offset,
|
||||||
unsigned int bpl, unsigned int padding, unsigned int lines);
|
unsigned int bpl, unsigned int padding, unsigned int lines);
|
||||||
|
|
||||||
|
extern int cx23885_risc_vbibuffer(struct pci_dev *pci,
|
||||||
|
struct btcx_riscmem *risc, struct scatterlist *sglist,
|
||||||
|
unsigned int top_offset, unsigned int bottom_offset,
|
||||||
|
unsigned int bpl, unsigned int padding, unsigned int lines);
|
||||||
|
|
||||||
void cx23885_cancel_buffers(struct cx23885_tsport *port);
|
void cx23885_cancel_buffers(struct cx23885_tsport *port);
|
||||||
|
|
||||||
extern int cx23885_restart_queue(struct cx23885_tsport *port,
|
extern int cx23885_restart_queue(struct cx23885_tsport *port,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче