1: int32_t AG903_PgpMgrReleaseFrameCalcHandle(
AG903_PgpMgrFrameCalcHandle *handle)
2: {
3:
AG903_PgpMgrPipelineHandle *slave_pipeline;
4:
5:
6:
if ((handle == NULL) || (handle->id !=
AG903_PGP_MGR_FRAME_CALC_HANDLE_ID)) {
7:
return -
AG903_EINVAL;
8: }
9:
10:
11:
if (handle->master_handle->pipeline_no != -1) {
12:
13:
if (PgpContext.exec_pipeline[handle->master_handle->pipeline_no] == handle->master_handle) {
14:
PGPPrmParamPGPnSTATE state;
15:
AG903_PgpPrmGetPGPnSTATE(handle->master_handle->pipeline_no, &state);
16:
if (state.st !=
AG903_PGP_MGR_STATE_IDLE) {
17:
return -
AG903_EBUSY;
18: }
19: PgpContext.exec_pipeline[handle->master_handle->pipeline_no] = NULL;
20: }
21:
22:
if (PgpContext.assign_pipeline[handle->master_handle->pipeline_no] == handle->master_handle) {
23: PgpContext.assign_pipeline[handle->master_handle->pipeline_no] = NULL;
24: }
25:
if (handle->slave_pipeline ==
true) {
26: slave_pipeline = (
AG903_PgpMgrPipelineHandle *)handle->slave_handle;
27:
if (PgpContext.assign_pipeline[slave_pipeline->pipeline_no] == slave_pipeline) {
28: PgpContext.assign_pipeline[slave_pipeline->pipeline_no] = NULL;
29: }
30: }
31: }
32:
33:
34: handle->master_handle->ifc_enable =
false;
35: handle->master_handle->is_used_frame_calc =
false;
36: handle->master_handle->is_assign =
false;
37: handle->master_handle->pipeline_no = -1;
38: handle->master_handle->is_dirty =
true;
39:
if (handle->slave_pipeline ==
true) {
40: slave_pipeline = (
AG903_PgpMgrPipelineHandle *)handle->slave_handle;
41:
if ((slave_pipeline->pipeline_no != -1) && (PgpContext.exec_pipeline[slave_pipeline->pipeline_no] == slave_pipeline)) {
42: PgpContext.exec_pipeline[slave_pipeline->pipeline_no] = NULL;
43: }
44: slave_pipeline->frame_out_enable =
true;
45: slave_pipeline->is_used_frame_calc =
false;
46: slave_pipeline->is_assign =
false;
47: slave_pipeline->pipeline_no = -1;
48: slave_pipeline->is_dirty =
true;
49: }
else {
50:
AG903_PgpMgrVRAMInputHandle *slave_vram = (
AG903_PgpMgrVRAMInputHandle *)handle->slave_handle;
51: slave_vram->ref_cnt--;
52: }
53:
54: handle->is_used =
false;
55: handle->id = 0;
56: PgpContext.num_frame_calc_handles--;
57:
return AG903_ENONE;
58: }