mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
media: bttv: add back vbi hack
[ Upstream commit3f1faa154a
] The old (now removed) videobuf framework had an optional vbi hack where the sequence number of the frame counter was copied in the last 4 bytes of the buffer. This hack was active only for the read() interface (so not for streaming I/O), and it was enabled by bttv. This allowed applications that used read() for the VBI data to match it with the corresponding video frame. When bttv was converted to vb2 this hack was forgotten, but some old applications rely on this. So add this back, but this time in the bttv driver rather than in the vb2 framework. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes:b7ec3212a7
("media: bttv: convert to vb2") Tested-by: Dr. David Alan Gilbert <dave@treblig.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e8fa30fa71
commit
54ce93d7e6
1 changed files with 21 additions and 0 deletions
|
@ -2772,6 +2772,27 @@ bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup,
|
|||
return;
|
||||
wakeup->vbuf.vb2_buf.timestamp = ktime_get_ns();
|
||||
wakeup->vbuf.sequence = btv->field_count >> 1;
|
||||
|
||||
/*
|
||||
* Ugly hack for backwards compatibility.
|
||||
* Some applications expect that the last 4 bytes of
|
||||
* the VBI data contains the sequence number.
|
||||
*
|
||||
* This makes it possible to associate the VBI data
|
||||
* with the video frame if you use read() to get the
|
||||
* VBI data.
|
||||
*/
|
||||
if (vb2_fileio_is_active(wakeup->vbuf.vb2_buf.vb2_queue)) {
|
||||
u32 *vaddr = vb2_plane_vaddr(&wakeup->vbuf.vb2_buf, 0);
|
||||
unsigned long size =
|
||||
vb2_get_plane_payload(&wakeup->vbuf.vb2_buf, 0) / 4;
|
||||
|
||||
if (vaddr && size) {
|
||||
vaddr += size - 1;
|
||||
*vaddr = wakeup->vbuf.sequence;
|
||||
}
|
||||
}
|
||||
|
||||
vb2_buffer_done(&wakeup->vbuf.vb2_buf, state);
|
||||
if (btv->field_count == 0)
|
||||
btor(BT848_INT_VSYNC, BT848_INT_MASK);
|
||||
|
|
Loading…
Reference in a new issue