drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c- Extension
.c- Size
- 51656 bytes
- Lines
- 1640
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
s5p_mfc_common.hs5p_mfc_cmd.hs5p_mfc_ctrl.hs5p_mfc_debug.hs5p_mfc_intr.hs5p_mfc_pm.hs5p_mfc_opr.hs5p_mfc_opr_v5.hasm/cacheflush.hlinux/delay.hlinux/dma-mapping.hlinux/err.hlinux/firmware.hlinux/io.hlinux/jiffies.hlinux/mm.hlinux/sched.h
Detected Declarations
function MFCfunction s5p_mfc_release_dec_desc_buffer_v5function s5p_mfc_alloc_codec_buffers_v5function s5p_mfc_release_codec_buffers_v5function s5p_mfc_alloc_instance_buffer_v5function s5p_mfc_release_instance_buffer_v5function s5p_mfc_alloc_dev_context_buffer_v5function s5p_mfc_release_dev_context_buffer_v5function s5p_mfc_read_info_v5function s5p_mfc_dec_calc_dpb_size_v5function s5p_mfc_enc_calc_src_size_v5function s5p_mfc_set_dec_desc_bufferfunction s5p_mfc_set_shared_bufferfunction s5p_mfc_set_dec_stream_buffer_v5function s5p_mfc_set_dec_frame_buffer_v5function s5p_mfc_set_enc_stream_buffer_v5function s5p_mfc_set_enc_frame_buffer_v5function s5p_mfc_get_enc_frame_buffer_v5function s5p_mfc_set_enc_ref_buffer_v5function s5p_mfc_set_enc_paramsfunction s5p_mfc_set_enc_params_h264function s5p_mfc_set_enc_params_mpeg4function s5p_mfc_set_enc_params_h263function s5p_mfc_init_decode_v5function s5p_mfc_set_flushfunction s5p_mfc_decode_one_frame_v5function s5p_mfc_init_encode_v5function s5p_mfc_encode_one_frame_v5function s5p_mfc_run_res_changefunction s5p_mfc_run_dec_framefunction s5p_mfc_run_enc_framefunction s5p_mfc_run_init_decfunction s5p_mfc_run_init_encfunction s5p_mfc_run_init_dec_buffersfunction s5p_mfc_try_run_v5function s5p_mfc_clear_int_flags_v5function s5p_mfc_get_dspl_y_adr_v5function s5p_mfc_get_dec_y_adr_v5function s5p_mfc_get_dspl_status_v5function s5p_mfc_get_dec_status_v5function s5p_mfc_get_dec_frame_type_v5function s5p_mfc_get_disp_frame_type_v5function s5p_mfc_get_consumed_stream_v5function s5p_mfc_get_int_reason_v5function s5p_mfc_get_int_err_v5function s5p_mfc_err_dec_v5function s5p_mfc_get_img_width_v5function s5p_mfc_get_img_height_v5
Annotated Snippet
if (ctx->codec_mode == S5P_MFC_CODEC_H264_ENC) {
enc_ref_c_size = ALIGN(ctx->img_width,
S5P_FIMV_NV12MT_HALIGN)
* ALIGN(ctx->img_height >> 1,
S5P_FIMV_NV12MT_VALIGN);
enc_ref_c_size = ALIGN(enc_ref_c_size,
S5P_FIMV_NV12MT_SALIGN);
} else {
guard_width = ALIGN(ctx->img_width + 16,
S5P_FIMV_NV12MT_HALIGN);
guard_height = ALIGN((ctx->img_height >> 1) + 4,
S5P_FIMV_NV12MT_VALIGN);
enc_ref_c_size = ALIGN(guard_width * guard_height,
S5P_FIMV_NV12MT_SALIGN);
}
mfc_debug(2, "recon luma size: %d chroma size: %d\n",
enc_ref_y_size, enc_ref_c_size);
} else {
return -EINVAL;
}
/* Codecs have different memory requirements */
switch (ctx->codec_mode) {
case S5P_MFC_CODEC_H264_DEC:
ctx->bank1.size =
ALIGN(S5P_FIMV_DEC_NB_IP_SIZE +
S5P_FIMV_DEC_VERT_NB_MV_SIZE,
S5P_FIMV_DEC_BUF_ALIGN);
ctx->bank2.size = ctx->total_dpb_count * ctx->mv_size;
break;
case S5P_MFC_CODEC_MPEG4_DEC:
ctx->bank1.size =
ALIGN(S5P_FIMV_DEC_NB_DCAC_SIZE +
S5P_FIMV_DEC_UPNB_MV_SIZE +
S5P_FIMV_DEC_SUB_ANCHOR_MV_SIZE +
S5P_FIMV_DEC_STX_PARSER_SIZE +
S5P_FIMV_DEC_OVERLAP_TRANSFORM_SIZE,
S5P_FIMV_DEC_BUF_ALIGN);
ctx->bank2.size = 0;
break;
case S5P_MFC_CODEC_VC1RCV_DEC:
case S5P_MFC_CODEC_VC1_DEC:
ctx->bank1.size =
ALIGN(S5P_FIMV_DEC_OVERLAP_TRANSFORM_SIZE +
S5P_FIMV_DEC_UPNB_MV_SIZE +
S5P_FIMV_DEC_SUB_ANCHOR_MV_SIZE +
S5P_FIMV_DEC_NB_DCAC_SIZE +
3 * S5P_FIMV_DEC_VC1_BITPLANE_SIZE,
S5P_FIMV_DEC_BUF_ALIGN);
ctx->bank2.size = 0;
break;
case S5P_MFC_CODEC_MPEG2_DEC:
ctx->bank1.size = 0;
ctx->bank2.size = 0;
break;
case S5P_MFC_CODEC_H263_DEC:
ctx->bank1.size =
ALIGN(S5P_FIMV_DEC_OVERLAP_TRANSFORM_SIZE +
S5P_FIMV_DEC_UPNB_MV_SIZE +
S5P_FIMV_DEC_SUB_ANCHOR_MV_SIZE +
S5P_FIMV_DEC_NB_DCAC_SIZE,
S5P_FIMV_DEC_BUF_ALIGN);
ctx->bank2.size = 0;
break;
case S5P_MFC_CODEC_H264_ENC:
ctx->bank1.size = (enc_ref_y_size * 2) +
S5P_FIMV_ENC_UPMV_SIZE +
S5P_FIMV_ENC_COLFLG_SIZE +
S5P_FIMV_ENC_INTRAMD_SIZE +
S5P_FIMV_ENC_NBORINFO_SIZE;
ctx->bank2.size = (enc_ref_y_size * 2) +
(enc_ref_c_size * 4) +
S5P_FIMV_ENC_INTRAPRED_SIZE;
break;
case S5P_MFC_CODEC_MPEG4_ENC:
ctx->bank1.size = (enc_ref_y_size * 2) +
S5P_FIMV_ENC_UPMV_SIZE +
S5P_FIMV_ENC_COLFLG_SIZE +
S5P_FIMV_ENC_ACDCCOEF_SIZE;
ctx->bank2.size = (enc_ref_y_size * 2) +
(enc_ref_c_size * 4);
break;
case S5P_MFC_CODEC_H263_ENC:
ctx->bank1.size = (enc_ref_y_size * 2) +
S5P_FIMV_ENC_UPMV_SIZE +
S5P_FIMV_ENC_ACDCCOEF_SIZE;
ctx->bank2.size = (enc_ref_y_size * 2) +
(enc_ref_c_size * 4);
break;
default:
break;
Annotation
- Immediate include surface: `s5p_mfc_common.h`, `s5p_mfc_cmd.h`, `s5p_mfc_ctrl.h`, `s5p_mfc_debug.h`, `s5p_mfc_intr.h`, `s5p_mfc_pm.h`, `s5p_mfc_opr.h`, `s5p_mfc_opr_v5.h`.
- Detected declarations: `function MFC`, `function s5p_mfc_release_dec_desc_buffer_v5`, `function s5p_mfc_alloc_codec_buffers_v5`, `function s5p_mfc_release_codec_buffers_v5`, `function s5p_mfc_alloc_instance_buffer_v5`, `function s5p_mfc_release_instance_buffer_v5`, `function s5p_mfc_alloc_dev_context_buffer_v5`, `function s5p_mfc_release_dev_context_buffer_v5`, `function s5p_mfc_read_info_v5`, `function s5p_mfc_dec_calc_dpb_size_v5`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.