static void vcd_clnt_exit_paused (struct vcd_clnt_ctxt_type_t *p_cctxt, s32 n_state_event_type) { VCD_MSG_MED("Exiting CLIENT_STATE_PAUSED on api %d", n_state_event_type); }
static void vcd_dev_exit_ready (struct vcd_drv_ctxt *drv_ctxt, s32 state_event) { VCD_MSG_MED("Exiting DEVICE_STATE_READY on api %d", state_event); }
void vcd_continue(void) { struct vcd_drv_ctxt *drv_ctxt; struct vcd_dev_ctxt *dev_ctxt; u32 command_continue; struct vcd_transc *transc; u32 rc; VCD_MSG_LOW("vcd_continue:"); drv_ctxt = vcd_get_drv_context(); dev_ctxt = &drv_ctxt->dev_ctxt; dev_ctxt->command_continue = false; if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_INIT) { VCD_MSG_HIGH("VCD_CMD_DEVICE_INIT is pending"); dev_ctxt->pending_cmd = VCD_CMD_NONE; (void)vcd_init_device_context(drv_ctxt, DEVICE_STATE_EVENT_NUMBER(open)); } else if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_TERM) { VCD_MSG_HIGH("VCD_CMD_DEVICE_TERM is pending"); dev_ctxt->pending_cmd = VCD_CMD_NONE; (void)vcd_deinit_device_context(drv_ctxt, DEVICE_STATE_EVENT_NUMBER(close)); } else if (dev_ctxt->pending_cmd == VCD_CMD_DEVICE_RESET) { VCD_MSG_HIGH("VCD_CMD_DEVICE_RESET is pending"); dev_ctxt->pending_cmd = VCD_CMD_NONE; (void)vcd_reset_device_context(drv_ctxt, DEVICE_STATE_EVENT_NUMBER(dev_cb)); } else { if (dev_ctxt->set_perf_lvl_pending) { rc = vcd_power_event(dev_ctxt, NULL, VCD_EVT_PWR_DEV_SET_PERFLVL); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("VCD_EVT_PWR_CLNT_SET_PERFLVL failed"); VCD_MSG_HIGH ("Not running at desired perf level." "curr=%d, reqd=%d", dev_ctxt->curr_perf_lvl, dev_ctxt->reqd_perf_lvl); } else { dev_ctxt->set_perf_lvl_pending = false; } } do { command_continue = false; if (vcd_get_command_channel_in_loop (dev_ctxt, &transc)) { if (vcd_submit_command_in_continue(dev_ctxt, transc)) command_continue = true; else { VCD_MSG_MED ("No more commands to submit"); vcd_release_command_channel(dev_ctxt, transc); vcd_release_interim_command_channels (dev_ctxt); } } } while (command_continue); do { command_continue = false; if (vcd_get_frame_channel_in_loop (dev_ctxt, &transc)) { if (vcd_try_submit_frame_in_continue(dev_ctxt, transc)) { command_continue = true; } else { VCD_MSG_MED("No more frames to submit"); vcd_release_frame_channel(dev_ctxt, transc); vcd_release_interim_frame_channels (dev_ctxt); } } } while (command_continue); if (!vcd_core_is_busy(dev_ctxt)) { rc = vcd_power_event(dev_ctxt, NULL, VCD_EVT_PWR_CLNT_CMD_END); if (VCD_FAILED(rc)) VCD_MSG_ERROR("Failed:" "VCD_EVT_PWR_CLNT_CMD_END"); } } }
static void vcd_clnt_exit_invalid(struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_INVALID on api %d", state_event); }
static void vcd_dev_enter_initing (struct vcd_drv_ctxt *drv_ctxt, s32 state_event) { VCD_MSG_MED("Entering DEVICE_STATE_INITING on api %d", state_event); }
static void vcd_clnt_exit_run (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_RUN on api %d", state_event); }
static void vcd_clnt_exit_pausing (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_PAUSING on api %d", state_event); cctxt->status.last_evt = VCD_EVT_RESP_BASE; }
static void vcd_clnt_exit_stopping (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_STOPPING on api %d", state_event); }
static u32 vcd_set_buffer_requirements_cmn (struct vcd_clnt_ctxt *cctxt, enum vcd_buffer_type buffer, struct vcd_buffer_requirement *buffer_req) { struct vcd_property_hdr Prop_hdr; u32 rc = VCD_S_SUCCESS; struct vcd_buffer_pool *buf_pool; u32 first_frm_recvd = 0; VCD_MSG_LOW("vcd_set_buffer_requirements_cmn in %d:", cctxt->clnt_state.state); if (!cctxt->decoding && cctxt->clnt_state.state != VCD_CLIENT_STATE_OPEN) { VCD_MSG_ERROR("Bad state (%d) for encoder", cctxt->clnt_state.state); return VCD_ERR_BAD_STATE; } VCD_MSG_MED("Buffer type = %d", buffer); if (buffer == VCD_BUFFER_INPUT) { Prop_hdr.prop_id = DDL_I_INPUT_BUF_REQ; buf_pool = &cctxt->in_buf_pool; first_frm_recvd = VCD_FIRST_IP_RCVD; } else if (buffer == VCD_BUFFER_OUTPUT) { Prop_hdr.prop_id = DDL_I_OUTPUT_BUF_REQ; buf_pool = &cctxt->out_buf_pool; first_frm_recvd = VCD_FIRST_OP_RCVD; } else { rc = VCD_ERR_ILLEGAL_PARM; } VCD_FAILED_RETURN(rc, "Invalid buffer type provided"); if (buf_pool->validated > 0) { VCD_MSG_ERROR("Need to free allocated buffers"); return VCD_ERR_ILLEGAL_OP; } first_frm_recvd &= cctxt->status.mask; if (first_frm_recvd) { VCD_MSG_ERROR("VCD SetBufReq called when data path is active"); return VCD_ERR_BAD_STATE; } Prop_hdr.sz = sizeof(*buffer_req); rc = ddl_set_property(cctxt->ddl_handle, &Prop_hdr, buffer_req); VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); if (buf_pool->entries) { VCD_MSG_MED("Resetting buffer requirements"); vcd_free_buffer_pool_entries(buf_pool); } rc = vcd_alloc_buffer_pool_entries(buf_pool, buffer_req); return rc; }
static u32 vcd_set_property_cmn (struct vcd_clnt_ctxt *cctxt, struct vcd_property_hdr *prop_hdr, void *prop_val) { u32 rc; VCD_MSG_LOW("vcd_set_property_cmn in %d:", cctxt->clnt_state.state); VCD_MSG_LOW("property Id = %d", prop_hdr->prop_id); if (!prop_hdr->sz || !prop_hdr->prop_id) { VCD_MSG_MED("Bad parameters"); return VCD_ERR_ILLEGAL_PARM; } rc = ddl_set_property(cctxt->ddl_handle, prop_hdr, prop_val); if (rc) { /* Some properties aren't known to ddl that we can handle */ if (prop_hdr->prop_id != VCD_I_VOP_TIMING_CONSTANT_DELTA) VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); } switch (prop_hdr->prop_id) { case VCD_I_META_BUFFER_MODE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->meta_mode = live->live; break; } case VCD_I_LIVE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->live = live->live; break; } case VCD_I_FRAME_RATE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_rate(cctxt, (struct vcd_property_frame_rate *) prop_val); } break; } case VCD_I_FRAME_SIZE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_size(cctxt, (struct vcd_property_frame_size *) prop_val); } break; } #if 1 // FEATURE_PANTECH_MMP_QCOM_CR P12554 Case(00846613)_while playing specific recoded clip, video frame is freezed for a while case VCD_I_SET_TURBO_CLK: { if (cctxt->sched_clnt_hdl) rc = vcd_set_perf_turbo_level(cctxt); break; } #endif case VCD_I_INTRA_PERIOD: { struct vcd_property_i_period *iperiod = (struct vcd_property_i_period *)prop_val; cctxt->bframe = iperiod->b_frames; break; } case VCD_I_VOP_TIMING_CONSTANT_DELTA: { struct vcd_property_vop_timing_constant_delta *delta = (struct vcd_property_vop_timing_constant_delta *) prop_val; if (delta->constant_delta > 0) { cctxt->time_frame_delta = delta->constant_delta; rc = VCD_S_SUCCESS; } else { VCD_MSG_ERROR("Frame delta must be positive"); rc = VCD_ERR_ILLEGAL_PARM; } break; } case VCD_REQ_PERF_LEVEL: rc = vcd_req_perf_level(cctxt, (struct vcd_property_perf_level *)prop_val); break; default: { break; } } return rc; }
static void vcd_clnt_enter_pausing (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Entering CLIENT_STATE_PAUSING on api %d", state_event); }
static u32 vcd_set_buffer_requirements_cmn (struct vcd_clnt_ctxt_type_t *p_cctxt, enum vcd_buffer_type e_buffer, struct vcd_buffer_requirement_type *p_buffer_req) { struct vcd_property_hdr_type Prop_hdr; u32 rc = VCD_S_SUCCESS; struct vcd_buffer_pool_type *p_buf_pool; u32 b_first_frm_recvd = FALSE; VCD_MSG_LOW("vcd_set_buffer_requirements_cmn in %d:", p_cctxt->clnt_state.e_state); if (!p_cctxt->b_decoding && p_cctxt->clnt_state.e_state != VCD_CLIENT_STATE_OPEN) { VCD_MSG_ERROR("Bad state (%d) for encoder", p_cctxt->clnt_state.e_state); return VCD_ERR_BAD_STATE; } VCD_MSG_MED("Buffer type = %d", e_buffer); if (e_buffer == VCD_BUFFER_INPUT) { Prop_hdr.prop_id = DDL_I_INPUT_BUF_REQ; p_buf_pool = &p_cctxt->in_buf_pool; b_first_frm_recvd = p_cctxt->status.b_first_ip_frame_recvd; } else if (e_buffer == VCD_BUFFER_OUTPUT) { Prop_hdr.prop_id = DDL_I_OUTPUT_BUF_REQ; p_buf_pool = &p_cctxt->out_buf_pool; b_first_frm_recvd = p_cctxt->status.b_first_op_frame_recvd; } else { rc = VCD_ERR_ILLEGAL_PARM; } VCD_FAILED_RETURN(rc, "Invalid buffer type provided"); if (p_buf_pool->n_validated > 0) { VCD_MSG_ERROR("Need to free allocated buffers"); return VCD_ERR_ILLEGAL_OP; } if (b_first_frm_recvd) { VCD_MSG_ERROR("VCD SetBufReq called when data path is active"); return VCD_ERR_BAD_STATE; } Prop_hdr.n_size = sizeof(*p_buffer_req); rc = ddl_set_property(p_cctxt->ddl_handle, &Prop_hdr, p_buffer_req); VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); if (p_buf_pool->a_entries) { VCD_MSG_MED("Resetting buffer requirements"); vcd_free_buffer_pool_entries(p_buf_pool); } rc = vcd_alloc_buffer_pool_entries(p_buf_pool, p_buffer_req); return rc; }
static u32 vcd_set_property_cmn (struct vcd_clnt_ctxt_type_t *p_cctxt, struct vcd_property_hdr_type *p_prop_hdr, void *p_prop_val) { u32 rc; VCD_MSG_LOW("vcd_set_property_cmn in %d:", p_cctxt->clnt_state.e_state); VCD_MSG_LOW("property Id = %d", p_prop_hdr->prop_id); if (!p_prop_hdr->n_size || !p_prop_hdr->prop_id) { VCD_MSG_MED("Bad parameters"); return VCD_ERR_ILLEGAL_PARM; } rc = ddl_set_property(p_cctxt->ddl_handle, p_prop_hdr, p_prop_val); VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); switch (p_prop_hdr->prop_id) { case VCD_I_LIVE: { struct vcd_property_live_type *p_live = (struct vcd_property_live_type *)p_prop_val; p_cctxt->b_live = p_live->b_live; break; } case VCD_I_FRAME_RATE: { if (p_cctxt->sched_clnt_hdl) { rc = vcd_set_frame_rate(p_cctxt, (struct vcd_property_frame_rate_type *) p_prop_val); } break; } case VCD_I_FRAME_SIZE: { if (p_cctxt->sched_clnt_hdl) { rc = vcd_set_frame_size(p_cctxt, (struct vcd_property_frame_size_type *) p_prop_val); } break; } default: { break; } } return rc; }
static void vcd_clnt_exit_invalid(struct vcd_clnt_ctxt_type_t *p_cctxt, s32 n_state_event_type) { VCD_MSG_MED("Exiting CLIENT_STATE_INVALID on api %d", n_state_event_type); }
static void vcd_clnt_enter_open (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Entering CLIENT_STATE_OPEN on api %d", state_event); }
static u32 vcd_set_property_cmn (struct vcd_clnt_ctxt *cctxt, struct vcd_property_hdr *prop_hdr, void *prop_val) { u32 rc; VCD_MSG_LOW("vcd_set_property_cmn in %d:", cctxt->clnt_state.state); VCD_MSG_LOW("property Id = %d", prop_hdr->prop_id); if (!prop_hdr->sz || !prop_hdr->prop_id) { VCD_MSG_MED("Bad parameters"); return VCD_ERR_ILLEGAL_PARM; } rc = ddl_set_property(cctxt->ddl_handle, prop_hdr, prop_val); VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); switch (prop_hdr->prop_id) { case VCD_I_META_BUFFER_MODE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->meta_mode = live->live; break; } case VCD_I_LIVE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->live = live->live; break; } case VCD_I_FRAME_RATE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_rate(cctxt, (struct vcd_property_frame_rate *) prop_val); } break; } case VCD_I_FRAME_SIZE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_size(cctxt, (struct vcd_property_frame_size *) prop_val); } break; } case VCD_I_INTRA_PERIOD: { struct vcd_property_i_period *iperiod = (struct vcd_property_i_period *)prop_val; cctxt->bframe = iperiod->b_frames; break; } default: { break; } } return rc; }
static void vcd_clnt_enter_stopping (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Entering CLIENT_STATE_STOPPING on api %d", state_event); cctxt->status.last_evt = VCD_EVT_RESP_STOP; }
static void vcd_dev_enter_null (struct vcd_drv_ctxt_type_t *p_drv_ctxt, s32 n_state_event_type) { VCD_MSG_MED("Entering DEVICE_STATE_NULL on api %d", n_state_event_type); }
static void vcd_clnt_exit_flushing (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_FLUSHING on api %d", state_event); }
static void vcd_dev_enter_not_init (struct vcd_drv_ctxt_type_t *p_drv_ctxt, s32 n_state_event_type) { VCD_MSG_MED("Entering DEVICE_STATE_NOT_INIT on api %d", n_state_event_type); }
static void vcd_clnt_exit_paused (struct vcd_clnt_ctxt *cctxt, s32 state_event) { VCD_MSG_MED("Exiting CLIENT_STATE_PAUSED on api %d", state_event); }
static void vcd_dev_enter_invalid(struct vcd_drv_ctxt_type_t *p_drv_ctxt, s32 state_event_type) { VCD_MSG_MED("Entering DEVICE_STATE_INVALID on api %d", state_event_type); }
static u32 vcd_set_property_cmn (struct vcd_clnt_ctxt *cctxt, struct vcd_property_hdr *prop_hdr, void *prop_val) { u32 rc; VCD_MSG_LOW("vcd_set_property_cmn in %d:", cctxt->clnt_state.state); VCD_MSG_LOW("property Id = %d", prop_hdr->prop_id); if (!prop_hdr->sz || !prop_hdr->prop_id) { VCD_MSG_MED("Bad parameters"); return VCD_ERR_ILLEGAL_PARM; } rc = ddl_set_property(cctxt->ddl_handle, prop_hdr, prop_val); if (rc) { if (prop_hdr->prop_id != VCD_I_VOP_TIMING_CONSTANT_DELTA) VCD_FAILED_RETURN(rc, "Failed: ddl_set_property"); } switch (prop_hdr->prop_id) { case VCD_I_META_BUFFER_MODE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->meta_mode = live->live; break; } case VCD_I_LIVE: { struct vcd_property_live *live = (struct vcd_property_live *)prop_val; cctxt->live = live->live; break; } case VCD_I_FRAME_RATE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_rate(cctxt, (struct vcd_property_frame_rate *) prop_val); } break; } case VCD_I_FRAME_SIZE: { if (cctxt->sched_clnt_hdl) { rc = vcd_set_frame_size(cctxt, (struct vcd_property_frame_size *) prop_val); } break; } case VCD_I_SET_TURBO_CLK: { rc = vcd_set_perf_turbo_level(cctxt); break; } case VCD_I_INTRA_PERIOD: { struct vcd_property_i_period *iperiod = (struct vcd_property_i_period *)prop_val; cctxt->bframe = iperiod->b_frames; break; } case VCD_REQ_PERF_LEVEL: rc = vcd_req_perf_level(cctxt, (struct vcd_property_perf_level *)prop_val); break; case VCD_I_VOP_TIMING_CONSTANT_DELTA: { struct vcd_property_vop_timing_constant_delta *delta = prop_val; if (delta->constant_delta > 0) { cctxt->time_frame_delta = delta->constant_delta; rc = VCD_S_SUCCESS; } else { VCD_MSG_ERROR("Frame delta must be positive"); rc = VCD_ERR_ILLEGAL_PARM; } break; } default: { break; } } return rc; }
static void vcd_dev_exit_initing (struct vcd_drv_ctxt_type_t *p_drv_ctxt, s32 n_state_event_type) { VCD_MSG_MED("Exiting DEVICE_STATE_INITING on api %d", n_state_event_type); }
static void vcd_dev_exit_not_init (struct vcd_drv_ctxt *drv_ctxt, s32 state_event) { VCD_MSG_MED("Exiting DEVICE_STATE_NOT_INIT on api %d", state_event); }
static void vcd_dev_exit_ready (struct vcd_drv_ctxt_type_t *p_drv_ctxt, s32 n_state_event_type) { VCD_MSG_MED("Exiting DEVICE_STATE_READY on api %d", n_state_event_type); }
static void vcd_dev_exit_invalid(struct vcd_drv_ctxt *drv_ctxt, s32 state_event) { VCD_MSG_MED("Exiting DEVICE_STATE_INVALID on api %d", state_event); }
void vcd_continue(void) { struct vcd_drv_ctxt_type_t *p_drv_ctxt; struct vcd_dev_ctxt_type *p_dev_ctxt; u32 b_continue; struct vcd_transc_type *p_transc; u32 rc; VCD_MSG_LOW("vcd_continue:"); p_drv_ctxt = vcd_get_drv_context(); p_dev_ctxt = &p_drv_ctxt->dev_ctxt; p_dev_ctxt->b_continue = FALSE; if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_INIT) { VCD_MSG_HIGH("VCD_CMD_DEVICE_INIT is pending"); p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE; (void)vcd_init_device_context(p_drv_ctxt, DEVICE_STATE_EVENT_NUMBER(pf_open)); } else if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_TERM) { VCD_MSG_HIGH("VCD_CMD_DEVICE_TERM is pending"); p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE; (void)vcd_deinit_device_context(p_drv_ctxt, DEVICE_STATE_EVENT_NUMBER(pf_close)); } else if (p_dev_ctxt->e_pending_cmd == VCD_CMD_DEVICE_RESET) { VCD_MSG_HIGH("VCD_CMD_DEVICE_RESET is pending"); p_dev_ctxt->e_pending_cmd = VCD_CMD_NONE; (void)vcd_reset_device_context(p_drv_ctxt, DEVICE_STATE_EVENT_NUMBER(pf_dev_cb)); } else { if (p_dev_ctxt->b_set_perf_lvl_pending) { rc = vcd_power_event(p_dev_ctxt, NULL, VCD_EVT_PWR_DEV_SET_PERFLVL); if (VCD_FAILED(rc)) { VCD_MSG_ERROR ("VCD_EVT_PWR_CLNT_SET_PERFLVL failed"); VCD_MSG_HIGH ("Not running at desired perf level." "curr=%d, reqd=%d", p_dev_ctxt->n_curr_perf_lvl, p_dev_ctxt->n_reqd_perf_lvl); } else { p_dev_ctxt->b_set_perf_lvl_pending = FALSE; } } do { b_continue = FALSE; if (vcd_get_command_channel_in_loop (p_dev_ctxt, &p_transc)) { if (vcd_submit_command_in_continue(p_dev_ctxt, p_transc)) b_continue = TRUE; else { VCD_MSG_MED ("No more commands to submit"); vcd_release_command_channel(p_dev_ctxt, p_transc); vcd_release_interim_command_channels (p_dev_ctxt); } } } while (b_continue); do { b_continue = FALSE; if (vcd_get_frame_channel_in_loop (p_dev_ctxt, &p_transc)) { if (vcd_try_submit_frame_in_continue(p_dev_ctxt, p_transc)) { b_continue = TRUE; } else { VCD_MSG_MED("No more frames to submit"); vcd_release_frame_channel(p_dev_ctxt, p_transc); vcd_release_interim_frame_channels (p_dev_ctxt); } } } while (b_continue); if (!vcd_core_is_busy(p_dev_ctxt)) { rc = vcd_power_event(p_dev_ctxt, NULL, VCD_EVT_PWR_CLNT_CMD_END); if (VCD_FAILED(rc)) VCD_MSG_ERROR("Failed:" "VCD_EVT_PWR_CLNT_CMD_END"); } } }
static void vcd_dev_enter_null (struct vcd_drv_ctxt *drv_ctxt, s32 state_event) { VCD_MSG_MED("Entering DEVICE_STATE_NULL on api %d", state_event); }
static void vcd_clnt_exit_stopping (struct vcd_clnt_ctxt_type_t *p_cctxt, s32 n_state_event_type) { VCD_MSG_MED("Exiting CLIENT_STATE_STOPPING on api %d", n_state_event_type); }