1: int32_t AG903_PgpMgrReleasePipelineHandle(
AG903_PgpMgrPipelineHandle *handle)
2: {
3:
4:
if ((handle == NULL) || (handle->id !=
AG903_PGP_MGR_PIPELINE_HANDLE_ID)) {
5:
return -
AG903_EINVAL;
6: }
7:
8:
if (handle->is_used_frame_calc ==
true) {
9:
return -
AG903_EINVAL;
10: }
11:
12:
13:
if (handle->pipeline_no != -1) {
14:
15:
if (PgpContext.exec_pipeline[handle->pipeline_no] == handle) {
16:
PGPPrmParamPGPnSTATE state;
17:
AG903_PgpPrmGetPGPnSTATE(handle->pipeline_no, &state);
18:
if (state.st !=
AG903_PGP_MGR_STATE_IDLE) {
19:
return -
AG903_EBUSY;
20: }
21: PgpContext.exec_pipeline[handle->pipeline_no] = NULL;
22: }
23:
if (PgpContext.assign_pipeline[handle->pipeline_no] == handle) {
24: PgpContext.assign_pipeline[handle->pipeline_no] = NULL;
25: }
26: }
27:
if (handle->input_handle != NULL) {
28:
AG903_PgpMgrVRAMInputHandle *vram_handle = (
AG903_PgpMgrVRAMInputHandle *)handle->input_handle;
29:
30:
if (vram_handle->id ==
AG903_PGP_MGR_VRAM_INPUT_HANDLE_ID) {
31: vram_handle->ref_cnt--;
32:
33:
if (PgpContext.pipeline_time_sharing_enable ==
false) {
34:
if ((vram_handle->ref_cnt == 0) && (vram_handle->port_no != -1)) {
35:
if (PgpContext.assign_vram[vram_handle->port_no] == vram_handle) {
36: PgpContext.assign_vram[vram_handle->port_no] = NULL;
37: }
38: }
39: }
40: }
41: }
42:
43:
if (handle->dgc_lut != NULL) {
44: handle->dgc_lut->ref_cnt--;
45: }
46: handle->is_used =
false;
47: handle->id = 0;
48: PgpContext.num_pipeline_handles--;
49:
50:
51:
if (PgpContext.num_pipeline_handles == 0) {
52: PgpMgrResetIntr();
53: }
54:
return AG903_ENONE;
55: }