drivers/media/platform/amphion/vpu_msgs.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/amphion/vpu_msgs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/amphion/vpu_msgs.c- Extension
.c- Size
- 11360 bytes
- Lines
- 422
- 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/init.hlinux/interconnect.hlinux/ioctl.hlinux/list.hlinux/kernel.hlinux/module.hvpu.hvpu_core.hvpu_rpc.hvpu_mbox.hvpu_defs.hvpu_cmds.hvpu_msgs.hvpu_v4l2.h
Detected Declarations
struct vpu_msg_handlerfunction vpu_session_handle_start_donefunction vpu_session_handle_mem_requestfunction vpu_session_handle_stop_donefunction vpu_session_handle_seq_hdrfunction vpu_session_handle_resolution_changefunction vpu_session_handle_enc_frame_donefunction vpu_session_handle_frame_requestfunction vpu_session_handle_frame_releasefunction vpu_session_handle_input_donefunction vpu_session_handle_pic_decodedfunction vpu_session_handle_pic_donefunction vpu_session_handle_eosfunction vpu_session_handle_errorfunction vpu_session_handle_firmware_xcptfunction vpu_session_handle_pic_skippedfunction vpu_session_handle_dbg_msgfunction vpu_terminate_string_msgfunction vpu_session_handle_msgfunction vpu_inst_receive_msgfunction vpu_inst_run_workfunction vpu_inst_handle_msgfunction vpu_handle_msgfunction vpu_isr_threadfunction vpu_core_run_msg_workfunction vpu_msg_run_workfunction vpu_msg_delayed_workfunction vpu_isr
Annotated Snippet
struct vpu_msg_handler {
u32 id;
void (*done)(struct vpu_inst *inst, struct vpu_rpc_event *pkt);
u32 is_str;
};
static void vpu_session_handle_start_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
vpu_trace(inst->dev, "[%d]\n", inst->id);
}
static void vpu_session_handle_mem_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
struct vpu_pkt_mem_req_data req_data = { 0 };
vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&req_data);
vpu_trace(inst->dev, "[%d] %d:%d %d:%d %d:%d\n",
inst->id,
req_data.enc_frame_size,
req_data.enc_frame_num,
req_data.ref_frame_size,
req_data.ref_frame_num,
req_data.act_buf_size,
req_data.act_buf_num);
vpu_inst_lock(inst);
call_void_vop(inst, mem_request,
req_data.enc_frame_size,
req_data.enc_frame_num,
req_data.ref_frame_size,
req_data.ref_frame_num,
req_data.act_buf_size,
req_data.act_buf_num);
vpu_inst_unlock(inst);
}
static void vpu_session_handle_stop_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
vpu_trace(inst->dev, "[%d]\n", inst->id);
call_void_vop(inst, stop_done);
}
static void vpu_session_handle_seq_hdr(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
struct vpu_dec_codec_info info;
const struct vpu_core_resources *res;
memset(&info, 0, sizeof(info));
res = vpu_get_resource(inst);
info.stride = res ? res->stride : 1;
vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info);
call_void_vop(inst, event_notify, VPU_MSG_ID_SEQ_HDR_FOUND, &info);
}
static void vpu_session_handle_resolution_change(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
call_void_vop(inst, event_notify, VPU_MSG_ID_RES_CHANGE, NULL);
}
static void vpu_session_handle_enc_frame_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
struct vpu_enc_pic_info info = { 0 };
vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info);
dev_dbg(inst->dev, "[%d] frame id = %d, wptr = 0x%x, size = %d\n",
inst->id, info.frame_id, info.wptr, info.frame_size);
call_void_vop(inst, get_one_frame, &info);
}
static void vpu_session_handle_frame_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
struct vpu_fs_info fs = { 0 };
vpu_iface_unpack_msg_data(inst->core, pkt, &fs);
call_void_vop(inst, event_notify, VPU_MSG_ID_FRAME_REQ, &fs);
}
static void vpu_session_handle_frame_release(struct vpu_inst *inst, struct vpu_rpc_event *pkt)
{
if (inst->core->type == VPU_CORE_TYPE_ENC) {
struct vpu_frame_info info;
memset(&info, 0, sizeof(info));
vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info.sequence);
dev_dbg(inst->dev, "[%d] %d\n", inst->id, info.sequence);
info.type = inst->out_format.type;
call_void_vop(inst, buf_done, &info);
} else if (inst->core->type == VPU_CORE_TYPE_DEC) {
struct vpu_fs_info fs = { 0 };
Annotation
- Immediate include surface: `linux/init.h`, `linux/interconnect.h`, `linux/ioctl.h`, `linux/list.h`, `linux/kernel.h`, `linux/module.h`, `vpu.h`, `vpu_core.h`.
- Detected declarations: `struct vpu_msg_handler`, `function vpu_session_handle_start_done`, `function vpu_session_handle_mem_request`, `function vpu_session_handle_stop_done`, `function vpu_session_handle_seq_hdr`, `function vpu_session_handle_resolution_change`, `function vpu_session_handle_enc_frame_done`, `function vpu_session_handle_frame_request`, `function vpu_session_handle_frame_release`, `function vpu_session_handle_input_done`.
- 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.