STRUCT S5P_MFC_CTX(9)
π struct s5p_mfc_ctx(9) π
okay so bestie, welcome to the Kernel API Manual β this is the page about struct s5p_mfc_ctx, and it's literally the whole personality of a single instance's context. like, everything the driver needs to remember about one running thing lives in here. it's giving "main character struct" and honestly? deserved. π
β¨ NAME β¨
struct s5p_mfc_ctx β this struct contains the instance context π
πΈ SYNOPSIS πΈ
struct s5p_mfc_ctx {
struct s5p_mfc_dev *dev;
struct v4l2_fh fh;
int num;
int int_cond;
int int_type;
unsigned int int_err;
wait_queue_head_t queue;
const struct s5p_mfc_fmt *src_fmt;
const struct s5p_mfc_fmt *dst_fmt;
struct vb2_queue vq_src;
struct vb2_queue vq_dst;
struct list_head src_queue;
struct list_head dst_queue;
unsigned int src_queue_cnt;
unsigned int dst_queue_cnt;
enum s5p_mfc_inst_type type;
enum s5p_mfc_inst_state state;
int inst_no;
int img_width;
int img_height;
int buf_width;
int buf_height;
int luma_size;
int chroma_size;
int chroma_size_1;
int mv_size;
unsigned long consumed_stream;
unsigned int dpb_flush_flag;
unsigned int head_processed;
struct s5p_mfc_priv_buf bank1;
struct s5p_mfc_priv_buf bank2;
enum s5p_mfc_queue_state capture_state;
enum s5p_mfc_queue_state output_state;
struct s5p_mfc_buf src_bufs[MFC_MAX_BUFFERS];
int src_bufs_cnt;
struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS];
int dst_bufs_cnt;
unsigned int sequence;
unsigned long dec_dst_flag;
size_t dec_src_buf_size;
int codec_mode;
int slice_interface;
int loop_filter_mpeg4;
int display_delay;
int display_delay_enable;
int after_packed_pb;
int sei_fp_parse;
int pb_count;
int total_dpb_count;
int mv_count;
struct s5p_mfc_priv_buf ctx;
struct s5p_mfc_priv_buf dsc;
struct s5p_mfc_priv_buf shm;
struct s5p_mfc_enc_params enc_params;
size_t enc_dst_buf_size;
size_t luma_dpb_size;
size_t chroma_dpb_size;
size_t me_buffer_size;
size_t tmv_buffer_size;
enum v4l2_mpeg_mfc51_video_force_frame_type force_frame_type;
struct list_head ref_queue;
unsigned int ref_queue_cnt;
enum v4l2_mpeg_video_multi_slice_mode slice_mode;
union {
unsigned int mb;
unsigned int bits;
} slice_size;
const struct s5p_mfc_codec_ops *c_ops;
struct v4l2_ctrl *ctrls[MFC_MAX_CTRLS];
struct v4l2_ctrl_handler ctrl_handler;
size_t scratch_buf_size;
int is_10bit;
int is_422;
int stride[VB2_MAX_PLANE_COUNT];
};
no cap, that's a lot of fields. don't panic. we're gonna go through every single one, and by the end you'll be obsessed. π«Ά
π¦ Members π¦
π§ the identity crisis section
devβ pointer to thes5p_mfc_devof the device. like, which device do you belong to, babefhβ astruct v4l2_fh. that's it, that's the whole vibenumβ number of the context that this structure describestypeβ type of the instance β decoder or encoder πstateβ state of the context, aka what chapter of its life it's in rninst_noβ number of the hw instance associated with the context
π« interrupt & waitqueue energy
int_condβ variable used by the waitqueueint_typeβ type of the last interruptint_errβ error number received from MFC hw in the interruptqueueβ waitqueue that can be used to wait for this context to finish. it's literally the "bestie r u done yet" queue π
π formats & queues
src_fmtβ source pixelformat informationdst_fmtβ destination pixelformat informationvq_srcβ vb2 queue for source buffersvq_dstβ vb2 queue for destination bufferssrc_queueβ driver internal queue for source buffersdst_queueβ driver internal queue for destination bufferssrc_queue_cntβ number of buffers queued on the source internal queuedst_queue_cntβ number of buffers queued on the dest internal queuecapture_stateβ state of the capture buffers queueoutput_stateβ state of the output buffers queue
π sizes & dimensions (the measuring tape moment)
img_widthβ width of the image that is decoded or encodedimg_heightβ height of the image that is decoded or encodedbuf_widthβ width of the buffer for processed imagebuf_heightβ height of the buffer for processed imageluma_sizeβ size of a luma planechroma_sizeβ size of a chroma planechroma_size_1β size of a chroma third plane β¨mv_sizeβ size of a motion vectors buffer
π stream bookkeeping
consumed_streamβ number of bytes that have been used so far from the decoding bufferdpb_flush_flagβ flag used to indicate that a DPB buffers are being flushedhead_processedβ flag mentioning whether the header data is processed completely or notsequenceβ counter for the sequence number for v4l2dec_dst_flagβ flags for buffers queued in the hardwaredec_src_buf_sizeβ size of the buffer for source buffers in decoding
π memory banks & buffer pools
bank1β handle to memory allocated for temporary buffers from memory bank 1bank2β handle to memory allocated for temporary buffers from memory bank 2src_bufsβ information on allocated source bufferssrc_bufs_cntβ number of allocated source buffersdst_bufsβ information on allocated destination buffersdst_bufs_cntβ number of allocated destination buffers
π₯ codec settings (decoder side)
codec_modeβ number of codec mode used by MFC hwslice_interfaceβ slice interface flagloop_filter_mpeg4β loop filter for MPEG4 flagdisplay_delayβ value of the display delay for H264display_delay_enableβ display delay for H264 enable flagafter_packed_pbβ flag used to track buffer when stream is in Packed PB formatsei_fp_parseβ enable/disable parsing of frame packing SEI informationpb_countβ count of the DPB buffers required by MFC hwtotal_dpb_countβ count of DPB buffers with additional buffers requested by the applicationmv_countβ number of MV buffers allocated for decoding
πΈ buffer handles
ctxβ context buffer informationdscβ descriptor buffer informationshmβ shared memory buffer information
π encoder stuff
enc_paramsβ encoding parameters for MFCenc_dst_buf_sizeβ size of the buffers for encoder outputluma_dpb_sizeβ dpb buffer size for lumachroma_dpb_sizeβ dpb buffer size for chromame_buffer_sizeβ size of the motion estimation buffertmv_buffer_sizeβ size of temporal predictor motion vector bufferforce_frame_typeβ encoder's frame type forcing controlref_queueβ list of the reference buffers for encodingref_queue_cntβ number of the buffers in the reference listslice_modeβ mode of dividing frames into slicesslice_sizeβ slice size
π ops & controls
c_opsβ ops for encodingctrlsβ array of controls, used when adding controls to the v4l2 control frameworkctrl_handlerβ handler for v4l2 framework
β the little extras at the bottom
scratch_buf_sizeβ scratch buffer sizeis_10bitβ state to check 10bit supportis_422β state to check YUV422 10bit formatstrideβ size of stride for all planes
π«Ά SEE ALSO π«Ά
- Kernel file
./drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h struct s5p_mfc_priv_buf(9)struct s5p_mfc_dev(9)
ngl bestie, if you're digging this deep you're already iconic β go read those two structs next, they're the supporting cast and they ate too π₯
and that's the whole page!! π this lil writeup lives in ./drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h and it's dated October 2026 β so yeah, staying current, slay. struct s5p_mfc_ctx(9) out. π¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms