Lines Matching refs:inst
164 static int wait_session_msg(struct venus_inst *inst) in wait_session_msg() argument
168 ret = wait_for_completion_timeout(&inst->done, TIMEOUT); in wait_session_msg()
172 if (inst->error != HFI_ERR_NONE) in wait_session_msg()
178 int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops *ops) in hfi_session_create() argument
180 struct venus_core *core = inst->core; in hfi_session_create()
185 inst->state = INST_UNINIT; in hfi_session_create()
186 init_completion(&inst->done); in hfi_session_create()
187 inst->ops = ops; in hfi_session_create()
190 list_add_tail(&inst->list, &core->instances); in hfi_session_create()
198 int hfi_session_init(struct venus_inst *inst, u32 pixfmt) in hfi_session_init() argument
200 struct venus_core *core = inst->core; in hfi_session_init()
204 if (inst->state != INST_UNINIT) in hfi_session_init()
207 inst->hfi_codec = to_codec_type(pixfmt); in hfi_session_init()
208 reinit_completion(&inst->done); in hfi_session_init()
210 ret = ops->session_init(inst, inst->session_type, inst->hfi_codec); in hfi_session_init()
214 ret = wait_session_msg(inst); in hfi_session_init()
218 inst->state = INST_INIT; in hfi_session_init()
224 void hfi_session_destroy(struct venus_inst *inst) in hfi_session_destroy() argument
226 struct venus_core *core = inst->core; in hfi_session_destroy()
229 list_del_init(&inst->list); in hfi_session_destroy()
236 int hfi_session_deinit(struct venus_inst *inst) in hfi_session_deinit() argument
238 const struct hfi_ops *ops = inst->core->ops; in hfi_session_deinit()
241 if (inst->state == INST_UNINIT) in hfi_session_deinit()
244 if (inst->state < INST_INIT) in hfi_session_deinit()
247 reinit_completion(&inst->done); in hfi_session_deinit()
249 ret = ops->session_end(inst); in hfi_session_deinit()
253 ret = wait_session_msg(inst); in hfi_session_deinit()
257 inst->state = INST_UNINIT; in hfi_session_deinit()
263 int hfi_session_start(struct venus_inst *inst) in hfi_session_start() argument
265 const struct hfi_ops *ops = inst->core->ops; in hfi_session_start()
268 if (inst->state != INST_LOAD_RESOURCES) in hfi_session_start()
271 reinit_completion(&inst->done); in hfi_session_start()
273 ret = ops->session_start(inst); in hfi_session_start()
277 ret = wait_session_msg(inst); in hfi_session_start()
281 inst->state = INST_START; in hfi_session_start()
287 int hfi_session_stop(struct venus_inst *inst) in hfi_session_stop() argument
289 const struct hfi_ops *ops = inst->core->ops; in hfi_session_stop()
292 if (inst->state != INST_START) in hfi_session_stop()
295 reinit_completion(&inst->done); in hfi_session_stop()
297 ret = ops->session_stop(inst); in hfi_session_stop()
301 ret = wait_session_msg(inst); in hfi_session_stop()
305 inst->state = INST_STOP; in hfi_session_stop()
311 int hfi_session_continue(struct venus_inst *inst) in hfi_session_continue() argument
313 struct venus_core *core = inst->core; in hfi_session_continue()
318 return core->ops->session_continue(inst); in hfi_session_continue()
322 int hfi_session_abort(struct venus_inst *inst) in hfi_session_abort() argument
324 const struct hfi_ops *ops = inst->core->ops; in hfi_session_abort()
327 reinit_completion(&inst->done); in hfi_session_abort()
329 ret = ops->session_abort(inst); in hfi_session_abort()
333 ret = wait_session_msg(inst); in hfi_session_abort()
341 int hfi_session_load_res(struct venus_inst *inst) in hfi_session_load_res() argument
343 const struct hfi_ops *ops = inst->core->ops; in hfi_session_load_res()
346 if (inst->state != INST_INIT) in hfi_session_load_res()
349 reinit_completion(&inst->done); in hfi_session_load_res()
351 ret = ops->session_load_res(inst); in hfi_session_load_res()
355 ret = wait_session_msg(inst); in hfi_session_load_res()
359 inst->state = INST_LOAD_RESOURCES; in hfi_session_load_res()
364 int hfi_session_unload_res(struct venus_inst *inst) in hfi_session_unload_res() argument
366 const struct hfi_ops *ops = inst->core->ops; in hfi_session_unload_res()
369 if (inst->state != INST_STOP) in hfi_session_unload_res()
372 reinit_completion(&inst->done); in hfi_session_unload_res()
374 ret = ops->session_release_res(inst); in hfi_session_unload_res()
378 ret = wait_session_msg(inst); in hfi_session_unload_res()
382 inst->state = INST_RELEASE_RESOURCES; in hfi_session_unload_res()
388 int hfi_session_flush(struct venus_inst *inst, u32 type, bool block) in hfi_session_flush() argument
390 const struct hfi_ops *ops = inst->core->ops; in hfi_session_flush()
393 reinit_completion(&inst->done); in hfi_session_flush()
395 ret = ops->session_flush(inst, type); in hfi_session_flush()
400 ret = wait_session_msg(inst); in hfi_session_flush()
409 int hfi_session_set_buffers(struct venus_inst *inst, struct hfi_buffer_desc *bd) in hfi_session_set_buffers() argument
411 const struct hfi_ops *ops = inst->core->ops; in hfi_session_set_buffers()
413 return ops->session_set_buffers(inst, bd); in hfi_session_set_buffers()
416 int hfi_session_unset_buffers(struct venus_inst *inst, in hfi_session_unset_buffers() argument
419 const struct hfi_ops *ops = inst->core->ops; in hfi_session_unset_buffers()
422 reinit_completion(&inst->done); in hfi_session_unset_buffers()
424 ret = ops->session_unset_buffers(inst, bd); in hfi_session_unset_buffers()
431 ret = wait_session_msg(inst); in hfi_session_unset_buffers()
438 int hfi_session_get_property(struct venus_inst *inst, u32 ptype, in hfi_session_get_property() argument
441 const struct hfi_ops *ops = inst->core->ops; in hfi_session_get_property()
444 if (inst->state < INST_INIT || inst->state >= INST_STOP) in hfi_session_get_property()
447 reinit_completion(&inst->done); in hfi_session_get_property()
449 ret = ops->session_get_property(inst, ptype); in hfi_session_get_property()
453 ret = wait_session_msg(inst); in hfi_session_get_property()
457 *hprop = inst->hprop; in hfi_session_get_property()
463 int hfi_session_set_property(struct venus_inst *inst, u32 ptype, void *pdata) in hfi_session_set_property() argument
465 const struct hfi_ops *ops = inst->core->ops; in hfi_session_set_property()
467 if (inst->state < INST_INIT || inst->state >= INST_STOP) in hfi_session_set_property()
470 return ops->session_set_property(inst, ptype, pdata); in hfi_session_set_property()
474 int hfi_session_process_buf(struct venus_inst *inst, struct hfi_frame_data *fd) in hfi_session_process_buf() argument
476 const struct hfi_ops *ops = inst->core->ops; in hfi_session_process_buf()
479 return ops->session_etb(inst, fd); in hfi_session_process_buf()
482 return ops->session_ftb(inst, fd); in hfi_session_process_buf()