Lines Matching refs:inst

25 	void (*done)(struct vpu_inst *inst, struct vpu_rpc_event *pkt);
28 static void vpu_session_handle_start_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_start_done() argument
30 vpu_trace(inst->dev, "[%d]\n", inst->id); in vpu_session_handle_start_done()
33 static void vpu_session_handle_mem_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_mem_request() argument
37 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&req_data); in vpu_session_handle_mem_request()
38 vpu_trace(inst->dev, "[%d] %d:%d %d:%d %d:%d\n", in vpu_session_handle_mem_request()
39 inst->id, in vpu_session_handle_mem_request()
46 call_void_vop(inst, mem_request, in vpu_session_handle_mem_request()
55 static void vpu_session_handle_stop_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_stop_done() argument
57 vpu_trace(inst->dev, "[%d]\n", inst->id); in vpu_session_handle_stop_done()
59 call_void_vop(inst, stop_done); in vpu_session_handle_stop_done()
62 static void vpu_session_handle_seq_hdr(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_seq_hdr() argument
68 res = vpu_get_resource(inst); in vpu_session_handle_seq_hdr()
70 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); in vpu_session_handle_seq_hdr()
71 call_void_vop(inst, event_notify, VPU_MSG_ID_SEQ_HDR_FOUND, &info); in vpu_session_handle_seq_hdr()
74 static void vpu_session_handle_resolution_change(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_resolution_change() argument
76 call_void_vop(inst, event_notify, VPU_MSG_ID_RES_CHANGE, NULL); in vpu_session_handle_resolution_change()
79 static void vpu_session_handle_enc_frame_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_enc_frame_done() argument
83 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); in vpu_session_handle_enc_frame_done()
84 dev_dbg(inst->dev, "[%d] frame id = %d, wptr = 0x%x, size = %d\n", in vpu_session_handle_enc_frame_done()
85 inst->id, info.frame_id, info.wptr, info.frame_size); in vpu_session_handle_enc_frame_done()
86 call_void_vop(inst, get_one_frame, &info); in vpu_session_handle_enc_frame_done()
89 static void vpu_session_handle_frame_request(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_frame_request() argument
93 vpu_iface_unpack_msg_data(inst->core, pkt, &fs); in vpu_session_handle_frame_request()
94 call_void_vop(inst, event_notify, VPU_MSG_ID_FRAME_REQ, &fs); in vpu_session_handle_frame_request()
97 static void vpu_session_handle_frame_release(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_frame_release() argument
99 if (inst->core->type == VPU_CORE_TYPE_ENC) { in vpu_session_handle_frame_release()
103 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info.sequence); in vpu_session_handle_frame_release()
104 dev_dbg(inst->dev, "[%d] %d\n", inst->id, info.sequence); in vpu_session_handle_frame_release()
105 info.type = inst->out_format.type; in vpu_session_handle_frame_release()
106 call_void_vop(inst, buf_done, &info); in vpu_session_handle_frame_release()
107 } else if (inst->core->type == VPU_CORE_TYPE_DEC) { in vpu_session_handle_frame_release()
110 vpu_iface_unpack_msg_data(inst->core, pkt, &fs); in vpu_session_handle_frame_release()
111 call_void_vop(inst, event_notify, VPU_MSG_ID_FRAME_RELEASE, &fs); in vpu_session_handle_frame_release()
115 static void vpu_session_handle_input_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_input_done() argument
117 dev_dbg(inst->dev, "[%d]\n", inst->id); in vpu_session_handle_input_done()
118 call_void_vop(inst, input_done); in vpu_session_handle_input_done()
121 static void vpu_session_handle_pic_decoded(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_pic_decoded() argument
125 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); in vpu_session_handle_pic_decoded()
126 call_void_vop(inst, get_one_frame, &info); in vpu_session_handle_pic_decoded()
129 static void vpu_session_handle_pic_done(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_pic_done() argument
135 vpu_iface_unpack_msg_data(inst->core, pkt, (void *)&info); in vpu_session_handle_pic_done()
136 if (inst->core->type == VPU_CORE_TYPE_DEC) in vpu_session_handle_pic_done()
137 frame.type = inst->cap_format.type; in vpu_session_handle_pic_done()
143 call_void_vop(inst, buf_done, &frame); in vpu_session_handle_pic_done()
146 static void vpu_session_handle_eos(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_eos() argument
148 call_void_vop(inst, event_notify, VPU_MSG_ID_PIC_EOS, NULL); in vpu_session_handle_eos()
151 static void vpu_session_handle_error(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_error() argument
156 dev_err(inst->dev, "instance %d firmware error : %s\n", inst->id, str); in vpu_session_handle_error()
158 dev_err(inst->dev, "instance %d is unsupported stream\n", inst->id); in vpu_session_handle_error()
159 call_void_vop(inst, event_notify, VPU_MSG_ID_UNSUPPORTED, NULL); in vpu_session_handle_error()
160 vpu_v4l2_set_error(inst); in vpu_session_handle_error()
163 static void vpu_session_handle_firmware_xcpt(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_firmware_xcpt() argument
167 dev_err(inst->dev, "%s firmware xcpt: %s\n", in vpu_session_handle_firmware_xcpt()
168 vpu_core_type_desc(inst->core->type), str); in vpu_session_handle_firmware_xcpt()
169 call_void_vop(inst, event_notify, VPU_MSG_ID_FIRMWARE_XCPT, NULL); in vpu_session_handle_firmware_xcpt()
170 set_bit(inst->id, &inst->core->hang_mask); in vpu_session_handle_firmware_xcpt()
171 vpu_v4l2_set_error(inst); in vpu_session_handle_firmware_xcpt()
174 static void vpu_session_handle_pic_skipped(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_session_handle_pic_skipped() argument
176 vpu_inst_lock(inst); in vpu_session_handle_pic_skipped()
177 vpu_skip_frame(inst, 1); in vpu_session_handle_pic_skipped()
178 vpu_inst_unlock(inst); in vpu_session_handle_pic_skipped()
199 static int vpu_session_handle_msg(struct vpu_inst *inst, struct vpu_rpc_event *msg) in vpu_session_handle_msg() argument
206 ret = vpu_iface_convert_msg_id(inst->core, msg->hdr.id); in vpu_session_handle_msg()
211 dev_dbg(inst->dev, "[%d] receive event(0x%x)\n", inst->id, msg_id); in vpu_session_handle_msg()
221 handler->done(inst, msg); in vpu_session_handle_msg()
223 vpu_response_cmd(inst, msg_id, 1); in vpu_session_handle_msg()
228 static bool vpu_inst_receive_msg(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_inst_receive_msg() argument
234 if (kfifo_len(&inst->msg_fifo) < bytes) in vpu_inst_receive_msg()
237 ret = kfifo_out(&inst->msg_fifo, pkt, bytes); in vpu_inst_receive_msg()
243 ret = kfifo_out(&inst->msg_fifo, pkt->data, bytes); in vpu_inst_receive_msg()
253 struct vpu_inst *inst = container_of(work, struct vpu_inst, msg_work); in vpu_inst_run_work() local
256 while (vpu_inst_receive_msg(inst, &pkt)) in vpu_inst_run_work()
257 vpu_session_handle_msg(inst, &pkt); in vpu_inst_run_work()
260 static void vpu_inst_handle_msg(struct vpu_inst *inst, struct vpu_rpc_event *pkt) in vpu_inst_handle_msg() argument
266 if (!inst->workqueue) in vpu_inst_handle_msg()
270 ret = kfifo_in(&inst->msg_fifo, pkt, bytes); in vpu_inst_handle_msg()
272 dev_err(inst->dev, "[%d:%d]overflow: %d\n", inst->core->id, inst->id, id); in vpu_inst_handle_msg()
273 queue_work(inst->workqueue, &inst->msg_work); in vpu_inst_handle_msg()
279 struct vpu_inst *inst; in vpu_handle_msg() local
291 inst = vpu_core_find_instance(core, pkt.hdr.index); in vpu_handle_msg()
292 if (inst) { in vpu_handle_msg()
293 vpu_response_cmd(inst, ret, 0); in vpu_handle_msg()
295 vpu_inst_record_flow(inst, ret); in vpu_handle_msg()
298 vpu_inst_handle_msg(inst, &pkt); in vpu_handle_msg()
299 vpu_inst_put(inst); in vpu_handle_msg()
366 struct vpu_inst *inst = vpu_core_find_instance(core, i); in vpu_msg_delayed_work() local
368 if (!inst) in vpu_msg_delayed_work()
371 if (inst->workqueue && kfifo_len(&inst->msg_fifo) >= bytes) in vpu_msg_delayed_work()
372 queue_work(inst->workqueue, &inst->msg_work); in vpu_msg_delayed_work()
374 vpu_inst_put(inst); in vpu_msg_delayed_work()