drivers/media/test-drivers/vivid/vivid-vbi-cap.c
Source file repositories/reference/linux-study-clean/drivers/media/test-drivers/vivid/vivid-vbi-cap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/test-drivers/vivid/vivid-vbi-cap.c- Extension
.c- Size
- 10204 bytes
- Lines
- 360
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/kernel.hlinux/videodev2.hmedia/v4l2-common.hvivid-core.hvivid-kthread-cap.hvivid-vbi-cap.hvivid-vbi-gen.hvivid-vid-common.h
Detected Declarations
function vivid_sliced_vbi_cap_fillfunction vivid_g_fmt_vbi_capfunction vivid_raw_vbi_cap_processfunction vivid_sliced_vbi_cap_processfunction vbi_cap_queue_setupfunction vbi_cap_buf_preparefunction vbi_cap_buf_queuefunction vbi_cap_start_streamingfunction list_for_each_entry_safefunction vbi_cap_stop_streamingfunction vbi_cap_buf_request_completefunction vidioc_g_fmt_vbi_capfunction vidioc_s_fmt_vbi_capfunction vivid_fill_service_linesfunction vidioc_g_fmt_sliced_vbi_capfunction vidioc_try_fmt_sliced_vbi_capfunction vidioc_s_fmt_sliced_vbi_capfunction vidioc_g_sliced_vbi_cap
Annotated Snippet
if (vivid_vid_can_loop(dev)) {
if (dev->vbi_out_have_wss) {
vbi_gen->data[12].data[0] = dev->vbi_out_wss[0];
vbi_gen->data[12].data[1] = dev->vbi_out_wss[1];
} else {
vbi_gen->data[12].id = 0;
}
} else {
switch (tpg_g_video_aspect(&dev->tpg)) {
case TPG_VIDEO_ASPECT_14X9_CENTRE:
vbi_gen->data[12].data[0] = 0x01;
break;
case TPG_VIDEO_ASPECT_16X9_CENTRE:
vbi_gen->data[12].data[0] = 0x0b;
break;
case TPG_VIDEO_ASPECT_16X9_ANAMORPHIC:
vbi_gen->data[12].data[0] = 0x07;
break;
case TPG_VIDEO_ASPECT_4X3:
default:
vbi_gen->data[12].data[0] = 0x08;
break;
}
}
} else if (vivid_vid_can_loop(dev) && is_60hz) {
if (dev->vbi_out_have_cc[0]) {
vbi_gen->data[0].data[0] = dev->vbi_out_cc[0][0];
vbi_gen->data[0].data[1] = dev->vbi_out_cc[0][1];
} else {
vbi_gen->data[0].id = 0;
}
if (dev->vbi_out_have_cc[1]) {
vbi_gen->data[1].data[0] = dev->vbi_out_cc[1][0];
vbi_gen->data[1].data[1] = dev->vbi_out_cc[1][1];
} else {
vbi_gen->data[1].id = 0;
}
}
}
static void vivid_g_fmt_vbi_cap(struct vivid_dev *dev, struct v4l2_vbi_format *vbi)
{
bool is_60hz = dev->std_cap[dev->input] & V4L2_STD_525_60;
vbi->sampling_rate = 27000000;
vbi->offset = 24;
vbi->samples_per_line = 1440;
vbi->sample_format = V4L2_PIX_FMT_GREY;
vbi->start[0] = is_60hz ? V4L2_VBI_ITU_525_F1_START + 9 : V4L2_VBI_ITU_625_F1_START + 5;
vbi->start[1] = is_60hz ? V4L2_VBI_ITU_525_F2_START + 9 : V4L2_VBI_ITU_625_F2_START + 5;
vbi->count[0] = vbi->count[1] = is_60hz ? 12 : 18;
vbi->flags = dev->vbi_cap_interlaced ? V4L2_VBI_INTERLACED : 0;
vbi->reserved[0] = 0;
vbi->reserved[1] = 0;
}
void vivid_raw_vbi_cap_process(struct vivid_dev *dev, struct vivid_buffer *buf)
{
struct v4l2_vbi_format vbi;
u8 *vbuf = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
vivid_g_fmt_vbi_cap(dev, &vbi);
buf->vb.sequence = dev->vbi_cap_seq_count;
if (dev->field_cap == V4L2_FIELD_ALTERNATE)
buf->vb.sequence /= 2;
vivid_sliced_vbi_cap_fill(dev, buf->vb.sequence);
memset(vbuf, 0x10, vb2_plane_size(&buf->vb.vb2_buf, 0));
if (!VIVID_INVALID_SIGNAL(dev->std_signal_mode[dev->input]))
vivid_vbi_gen_raw(&dev->vbi_gen, &vbi, vbuf);
}
void vivid_sliced_vbi_cap_process(struct vivid_dev *dev,
struct vivid_buffer *buf)
{
struct v4l2_sliced_vbi_data *vbuf =
vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
buf->vb.sequence = dev->vbi_cap_seq_count;
if (dev->field_cap == V4L2_FIELD_ALTERNATE)
buf->vb.sequence /= 2;
vivid_sliced_vbi_cap_fill(dev, buf->vb.sequence);
memset(vbuf, 0, vb2_plane_size(&buf->vb.vb2_buf, 0));
if (!VIVID_INVALID_SIGNAL(dev->std_signal_mode[dev->input])) {
unsigned i;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/kernel.h`, `linux/videodev2.h`, `media/v4l2-common.h`, `vivid-core.h`, `vivid-kthread-cap.h`, `vivid-vbi-cap.h`, `vivid-vbi-gen.h`.
- Detected declarations: `function vivid_sliced_vbi_cap_fill`, `function vivid_g_fmt_vbi_cap`, `function vivid_raw_vbi_cap_process`, `function vivid_sliced_vbi_cap_process`, `function vbi_cap_queue_setup`, `function vbi_cap_buf_prepare`, `function vbi_cap_buf_queue`, `function vbi_cap_start_streaming`, `function list_for_each_entry_safe`, `function vbi_cap_stop_streaming`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.