drivers/media/platform/renesas/vsp1/vsp1_wpf.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/vsp1/vsp1_wpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/renesas/vsp1/vsp1_wpf.c- Extension
.c- Size
- 16773 bytes
- Lines
- 606
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hmedia/v4l2-subdev.hvsp1.hvsp1_dl.hvsp1_pipe.hvsp1_rwpf.hvsp1_video.h
Detected Declarations
enum wpf_flip_ctrlfunction Copyrightfunction vsp1_wpf_set_rotationfunction vsp1_wpf_s_ctrlfunction wpf_init_controlsfunction vsp1_wpf_stopfunction vsp1_wpf_destroyfunction wpf_configure_writeback_chainfunction wpf_configure_streamfunction pipelinesfunction wpf_configure_framefunction scoped_guardfunction wpf_configure_partitionfunction wpf_max_widthfunction wpf_partition
Annotated Snippet
if (sink_format->code == MEDIA_BUS_FMT_AYUV8_1X32) {
ycbcr_enc = sink_format->ycbcr_enc;
quantization = sink_format->quantization;
} else {
ycbcr_enc = source_format->ycbcr_enc;
quantization = source_format->quantization;
}
if (ycbcr_enc == V4L2_YCBCR_ENC_601 &&
quantization == V4L2_QUANTIZATION_LIM_RANGE)
wrtm = VI6_WPF_OUTFMT_WRTM_BT601;
else if (ycbcr_enc == V4L2_YCBCR_ENC_601 &&
quantization == V4L2_QUANTIZATION_FULL_RANGE)
wrtm = VI6_WPF_OUTFMT_WRTM_BT601_EXT;
else if (ycbcr_enc == V4L2_YCBCR_ENC_709 &&
quantization == V4L2_QUANTIZATION_LIM_RANGE)
wrtm = VI6_WPF_OUTFMT_WRTM_BT709;
else
wrtm = VI6_WPF_OUTFMT_WRTM_BT709_EXT;
outfmt |= VI6_WPF_OUTFMT_CSC | wrtm;
}
wpf->outfmt = outfmt;
vsp1_dl_body_write(dlb, VI6_DPR_WPF_FPORCH(index),
VI6_DPR_WPF_FPORCH_FP_WPFN);
/*
* Sources. If the pipeline has a single input and BRx is not used,
* configure it as the master layer. Otherwise configure all
* inputs as sub-layers and select the virtual RPF as the master
* layer. For VSPX configure the enabled sources as masters.
*/
for (i = 0; i < vsp1->info->rpf_count; ++i) {
struct vsp1_rwpf *input = pipe->inputs[i];
if (!input)
continue;
srcrpf |= (pipe->iif || (!pipe->brx && pipe->num_inputs == 1))
? VI6_WPF_SRCRPF_RPF_ACT_MST(input->entity.index)
: VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index);
}
if (pipe->brx)
srcrpf |= pipe->brx->type == VSP1_ENTITY_BRU
? VI6_WPF_SRCRPF_VIRACT_MST
: VI6_WPF_SRCRPF_VIRACT2_MST;
vsp1_wpf_write(wpf, dlb, VI6_WPF_SRCRPF, srcrpf);
/* Enable interrupts. */
vsp1_dl_body_write(dlb, VI6_WPF_IRQ_STA(index), 0);
vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index),
VI6_WPF_IRQ_ENB_DFEE);
if (pipe->iif)
return;
/*
* Configure writeback for display pipelines (the wpf writeback flag is
* never set for memory-to-memory pipelines). Start by adding a chained
* display list to disable writeback after a single frame, and process
* to enable writeback. If the display list allocation fails don't
* enable writeback as we wouldn't be able to safely disable it,
* resulting in possible memory corruption.
*/
if (wpf->writeback) {
ret = wpf_configure_writeback_chain(wpf, dl);
if (ret < 0)
wpf->writeback = false;
}
vsp1_dl_body_write(dlb, VI6_WPF_WRBCK_CTRL(index),
wpf->writeback ? VI6_WPF_WRBCK_CTRL_WBMD : 0);
}
static void wpf_configure_frame(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl,
struct vsp1_dl_body *dlb)
{
const unsigned int mask = BIT(WPF_CTRL_VFLIP)
| BIT(WPF_CTRL_HFLIP);
struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
u32 outfmt;
scoped_guard(spinlock_irqsave, &wpf->flip.lock) {
wpf->flip.active = (wpf->flip.active & ~mask)
Annotation
- Immediate include surface: `linux/device.h`, `media/v4l2-subdev.h`, `vsp1.h`, `vsp1_dl.h`, `vsp1_pipe.h`, `vsp1_rwpf.h`, `vsp1_video.h`.
- Detected declarations: `enum wpf_flip_ctrl`, `function Copyright`, `function vsp1_wpf_set_rotation`, `function vsp1_wpf_s_ctrl`, `function wpf_init_controls`, `function vsp1_wpf_stop`, `function vsp1_wpf_destroy`, `function wpf_configure_writeback_chain`, `function wpf_configure_stream`, `function pipelines`.
- 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.