drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c- Extension
.c- Size
- 32728 bytes
- Lines
- 1227
- 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.hlinux/errno.hlinux/kernel.hlinux/pm_runtime.hlinux/slab.hlinux/workqueue.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmtk_mdp_core.hmtk_mdp_m2m.hmtk_mdp_regs.hmtk_vpu.h
Detected Declarations
struct mtk_mdp_pix_limitfunction mtk_mdp_bound_align_imagefunction mtk_mdp_check_crop_changefunction mtk_mdp_try_cropfunction mtk_mdp_ctx_state_lock_setfunction mtk_mdp_ctx_state_is_setfunction mtk_mdp_set_frame_sizefunction mtk_mdp_m2m_start_streamingfunction mtk_mdp_m2m_stop_streamingfunction mtk_mdp_prepare_addrfunction mtk_mdp_m2m_get_bufsfunction mtk_mdp_process_donefunction mtk_mdp_m2m_workerfunction mtk_mdp_m2m_device_runfunction mtk_mdp_m2m_queue_setupfunction mtk_mdp_m2m_buf_preparefunction mtk_mdp_m2m_buf_queuefunction mtk_mdp_m2m_querycapfunction mtk_mdp_enum_fmtfunction mtk_mdp_m2m_enum_fmt_vid_capfunction mtk_mdp_m2m_enum_fmt_vid_outfunction mtk_mdp_m2m_g_fmt_mplanefunction mtk_mdp_m2m_try_fmt_mplanefunction mtk_mdp_m2m_s_fmt_mplanefunction mtk_mdp_m2m_reqbufsfunction mtk_mdp_m2m_streamonfunction mtk_mdp_is_target_composefunction mtk_mdp_is_target_cropfunction mtk_mdp_m2m_g_selectionfunction mtk_mdp_check_scaler_ratiofunction mtk_mdp_m2m_s_selectionfunction mtk_mdp_m2m_queue_initfunction mtk_mdp_s_ctrlfunction mtk_mdp_ctrls_createfunction mtk_mdp_set_default_paramsfunction mtk_mdp_m2m_openfunction mtk_mdp_m2m_releasefunction mtk_mdp_register_m2m_devicefunction mtk_mdp_unregister_m2m_device
Annotated Snippet
struct mtk_mdp_pix_limit {
u16 org_w;
u16 org_h;
u16 target_rot_dis_w;
u16 target_rot_dis_h;
u16 target_rot_en_w;
u16 target_rot_en_h;
};
static struct mtk_mdp_pix_align mtk_mdp_size_align = {
.org_w = 16,
.org_h = 16,
.target_w = 2,
.target_h = 2,
};
static const struct mtk_mdp_fmt mtk_mdp_formats[] = {
{
.pixelformat = V4L2_PIX_FMT_MT21C,
.depth = { 8, 4 },
.row_depth = { 8, 8 },
.num_planes = 2,
.num_comp = 2,
.align = &mtk_mdp_size_align,
.flags = MTK_MDP_FMT_FLAG_OUTPUT,
}, {
.pixelformat = V4L2_PIX_FMT_NV12M,
.depth = { 8, 4 },
.row_depth = { 8, 8 },
.num_planes = 2,
.num_comp = 2,
.flags = MTK_MDP_FMT_FLAG_OUTPUT |
MTK_MDP_FMT_FLAG_CAPTURE,
}, {
.pixelformat = V4L2_PIX_FMT_YUV420M,
.depth = { 8, 2, 2 },
.row_depth = { 8, 4, 4 },
.num_planes = 3,
.num_comp = 3,
.flags = MTK_MDP_FMT_FLAG_OUTPUT |
MTK_MDP_FMT_FLAG_CAPTURE,
}, {
.pixelformat = V4L2_PIX_FMT_YVU420,
.depth = { 12 },
.row_depth = { 8 },
.num_planes = 1,
.num_comp = 3,
.flags = MTK_MDP_FMT_FLAG_OUTPUT |
MTK_MDP_FMT_FLAG_CAPTURE,
}
};
static struct mtk_mdp_pix_limit mtk_mdp_size_max = {
.target_rot_dis_w = 4096,
.target_rot_dis_h = 4096,
.target_rot_en_w = 4096,
.target_rot_en_h = 4096,
};
static struct mtk_mdp_pix_limit mtk_mdp_size_min = {
.org_w = 16,
.org_h = 16,
.target_rot_dis_w = 16,
.target_rot_dis_h = 16,
.target_rot_en_w = 16,
.target_rot_en_h = 16,
};
/* align size for normal raster scan pixel format */
static struct mtk_mdp_pix_align mtk_mdp_rs_align = {
.org_w = 2,
.org_h = 2,
.target_w = 2,
.target_h = 2,
};
static struct mtk_mdp_variant mtk_mdp_default_variant = {
.pix_max = &mtk_mdp_size_max,
.pix_min = &mtk_mdp_size_min,
.pix_align = &mtk_mdp_rs_align,
.h_scale_up_max = 32,
.v_scale_up_max = 32,
.h_scale_down_max = 32,
.v_scale_down_max = 128,
};
static const struct mtk_mdp_fmt *mtk_mdp_find_fmt(u32 pixelformat, u32 type)
{
u32 i, flag;
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/kernel.h`, `linux/pm_runtime.h`, `linux/slab.h`, `linux/workqueue.h`, `media/v4l2-event.h`, `media/v4l2-ioctl.h`.
- Detected declarations: `struct mtk_mdp_pix_limit`, `function mtk_mdp_bound_align_image`, `function mtk_mdp_check_crop_change`, `function mtk_mdp_try_crop`, `function mtk_mdp_ctx_state_lock_set`, `function mtk_mdp_ctx_state_is_set`, `function mtk_mdp_set_frame_size`, `function mtk_mdp_m2m_start_streaming`, `function mtk_mdp_m2m_stop_streaming`, `function mtk_mdp_prepare_addr`.
- 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.