Lines Matching full:vpu
12 static void handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) in handle_enc_init_msg() argument
16 vpu->inst_addr = msg->vpu_inst_addr; in handle_enc_init_msg()
17 vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, in handle_enc_init_msg()
21 if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) in handle_enc_init_msg()
25 mtk_vcodec_debug(vpu, "firmware version: 0x%x\n", in handle_enc_init_msg()
31 mtk_vcodec_err(vpu, "unhandled firmware version 0x%x\n", in handle_enc_init_msg()
33 vpu->failure = 1; in handle_enc_init_msg()
38 static void handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data) in handle_enc_encode_msg() argument
42 vpu->state = msg->state; in handle_enc_encode_msg()
43 vpu->bs_size = msg->bs_size; in handle_enc_encode_msg()
44 vpu->is_key_frm = msg->is_key_frm; in handle_enc_encode_msg()
50 struct venc_vpu_inst *vpu = in vpu_enc_ipi_handler() local
53 mtk_vcodec_debug(vpu, "msg_id %x inst %p status %d", in vpu_enc_ipi_handler()
54 msg->msg_id, vpu, msg->status); in vpu_enc_ipi_handler()
56 vpu->signaled = 1; in vpu_enc_ipi_handler()
57 vpu->failure = (msg->status != VENC_IPI_MSG_STATUS_OK); in vpu_enc_ipi_handler()
58 if (vpu->failure) in vpu_enc_ipi_handler()
63 handle_enc_init_msg(vpu, data); in vpu_enc_ipi_handler()
68 handle_enc_encode_msg(vpu, data); in vpu_enc_ipi_handler()
73 mtk_vcodec_err(vpu, "unknown msg id %x", msg->msg_id); in vpu_enc_ipi_handler()
78 mtk_vcodec_debug_leave(vpu); in vpu_enc_ipi_handler()
81 static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, in vpu_enc_send_msg() argument
86 mtk_vcodec_debug_enter(vpu); in vpu_enc_send_msg()
88 if (!vpu->ctx->dev->fw_handler) { in vpu_enc_send_msg()
89 mtk_vcodec_err(vpu, "inst dev is NULL"); in vpu_enc_send_msg()
93 status = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, vpu->id, msg, in vpu_enc_send_msg()
96 mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d", in vpu_enc_send_msg()
100 if (vpu->failure) in vpu_enc_send_msg()
103 mtk_vcodec_debug_leave(vpu); in vpu_enc_send_msg()
108 int vpu_enc_init(struct venc_vpu_inst *vpu) in vpu_enc_init() argument
113 mtk_vcodec_debug_enter(vpu); in vpu_enc_init()
115 init_waitqueue_head(&vpu->wq_hd); in vpu_enc_init()
116 vpu->signaled = 0; in vpu_enc_init()
117 vpu->failure = 0; in vpu_enc_init()
119 status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id, in vpu_enc_init()
123 mtk_vcodec_err(vpu, "vpu_ipi_register fail %d", status); in vpu_enc_init()
129 out.venc_inst = (unsigned long)vpu; in vpu_enc_init()
130 if (vpu_enc_send_msg(vpu, &out, sizeof(out))) { in vpu_enc_init()
131 mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_INIT fail"); in vpu_enc_init()
135 mtk_vcodec_debug_leave(vpu); in vpu_enc_init()
140 static unsigned int venc_enc_param_crop_right(struct venc_vpu_inst *vpu, in venc_enc_param_crop_right() argument
159 int vpu_enc_set_param(struct venc_vpu_inst *vpu, in vpu_enc_set_param() argument
163 const bool is_ext = MTK_ENC_CTX_IS_EXT(vpu->ctx); in vpu_enc_set_param()
169 mtk_vcodec_debug(vpu, "id %d ->", id); in vpu_enc_set_param()
173 out.base.vpu_inst_addr = vpu->inst_addr; in vpu_enc_set_param()
180 venc_enc_param_crop_right(vpu, enc_param); in vpu_enc_set_param()
211 mtk_vcodec_err(vpu, "id %d not supported", id); in vpu_enc_set_param()
214 if (vpu_enc_send_msg(vpu, &out, msg_size)) { in vpu_enc_set_param()
215 mtk_vcodec_err(vpu, in vpu_enc_set_param()
220 mtk_vcodec_debug(vpu, "id %d <-", id); in vpu_enc_set_param()
225 int vpu_enc_encode(struct venc_vpu_inst *vpu, unsigned int bs_mode, in vpu_enc_encode() argument
231 const bool is_ext = MTK_ENC_CTX_IS_EXT(vpu->ctx); in vpu_enc_encode()
237 mtk_vcodec_debug(vpu, "bs_mode %d ->", bs_mode); in vpu_enc_encode()
241 out.base.vpu_inst_addr = vpu->inst_addr; in vpu_enc_encode()
251 mtk_vcodec_err(vpu, "dma_addr not align to 16"); in vpu_enc_encode()
265 if (vpu_enc_send_msg(vpu, &out, msg_size)) { in vpu_enc_encode()
266 mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_ENCODE %d fail", in vpu_enc_encode()
271 mtk_vcodec_debug(vpu, "bs_mode %d state %d size %d key_frm %d <-", in vpu_enc_encode()
272 bs_mode, vpu->state, vpu->bs_size, vpu->is_key_frm); in vpu_enc_encode()
277 int vpu_enc_deinit(struct venc_vpu_inst *vpu) in vpu_enc_deinit() argument
281 mtk_vcodec_debug_enter(vpu); in vpu_enc_deinit()
285 out.vpu_inst_addr = vpu->inst_addr; in vpu_enc_deinit()
286 if (vpu_enc_send_msg(vpu, &out, sizeof(out))) { in vpu_enc_deinit()
287 mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_DEINIT fail"); in vpu_enc_deinit()
291 mtk_vcodec_debug_leave(vpu); in vpu_enc_deinit()