void ipu_uninit(ipu_lib_handle_t** ipu_handle) { if(!*ipu_handle) return; mxc_ipu_lib_task_uninit(*ipu_handle); free(*ipu_handle); *ipu_handle = NULL; }
OMX_ERRORTYPE IpulibRender::CloseDevice() { if(bInitDev != OMX_TRUE) return OMX_ErrorNone; UnRegistSignalHandler(); mxc_ipu_lib_task_uninit(&ipu_handle); bInitDev = OMX_FALSE; fsl_osal_memset(&ipu_handle, 0, sizeof(ipu_lib_handle_t)); return OMX_ErrorNone; }
OMX_ERRORTYPE VideoProcessorComponent::VideoProcessor_DeInit( ) { OMX_ERRORTYPE eRetVal = OMX_ErrorNone; /* return input buffers queued in processing queue */ if(pInBufHdr[0] != NULL) { ports[VP_IN_PORT]->SendBuffer(pInBufHdr[0]); pInBufHdr[0] = NULL; } if(pInBufHdr[1] != NULL) { ports[VP_IN_PORT]->SendBuffer(pInBufHdr[1]); pInBufHdr[1] = NULL; } if(bUseEGLImage == OMX_TRUE) { if(pOutBufHdr[0] != NULL) { ports[VP_OUT_PORT]->SendBuffer(pOutBufHdr[0]); pOutBufHdr[0] = NULL; } if(pOutBufHdr[1] != NULL) { ports[VP_OUT_PORT]->SendBuffer(pOutBufHdr[1]); pOutBufHdr[1] = NULL; } } bUseEGLImage = OMX_FALSE; mxc_ipu_lib_task_uninit(&ipu_handle); return eRetVal; }
void ipu_disp_loop_thread(void *arg) { struct decode *dec = (struct decode *)arg; DecHandle handle = dec->handle; struct vpu_display *disp = dec->disp; int index = -1, disp_clr_index, tmp_idx[3] = {0,0,0}, err, mode; pthread_attr_t attr; ipu_running = 1; pthread_attr_init(&attr); pthread_attr_setschedpolicy(&attr, SCHED_RR); while(1) { disp_clr_index = index; index = dequeue_buf(&(disp->ipu_q)); if (index < 0) { wait_queue(); ipu_waiting = 0; index = dequeue_buf(&(disp->ipu_q)); if (index < 0) { info_msg("thread is going to finish\n"); break; } } if (disp->ncount == 0) { disp->input.user_def_paddr[0] = disp->ipu_bufs[index].ipu_paddr; /* For video de-interlace, Low/Medium motion */ tmp_idx[0] = index; } else if ((disp->deinterlaced == 1) && (disp->input.motion_sel != HIGH_MOTION) && (disp->ncount == 1)) { disp->input.user_def_paddr[1] = disp->ipu_bufs[index].ipu_paddr; /* For video de-interlace, Low/Medium motion */ tmp_idx[1] = index; } else if ((disp->ncount == 1) || ((disp->deinterlaced == 1) && (disp->input.motion_sel != HIGH_MOTION) && (disp->ncount == 2))) { disp->input.user_def_paddr[disp->ncount] = disp->ipu_bufs[index].ipu_paddr; mode = (disp->deinterlaced == 1) ? (OP_STREAM_MODE | TASK_VDI_VF_MODE) : (OP_STREAM_MODE | TASK_PP_MODE); err = mxc_ipu_lib_task_init(&(disp->input), NULL, &(disp->output), mode, &(disp->ipu_handle)); if (err < 0) { err_msg("mxc_ipu_lib_task_init failed, err %d\n", err); quitflag = 1; return; } /* it only enable ipu task and finish first frame */ err = mxc_ipu_lib_task_buf_update(&(disp->ipu_handle), 0, 0, 0, NULL, NULL); if (err < 0) { err_msg("mxc_ipu_lib_task_buf_update failed, err %d\n", err); quitflag = 1; break; } /* For video de-interlace, Low/Medium motion */ tmp_idx[2] = index; if ((disp->deinterlaced == 1) && (disp->input.motion_sel != HIGH_MOTION)) disp_clr_index = tmp_idx[0]; } else { err = mxc_ipu_lib_task_buf_update(&(disp->ipu_handle), disp->ipu_bufs[index].ipu_paddr, 0, 0, NULL, NULL); if (err < 0) { err_msg("mxc_ipu_lib_task_buf_update failed, err %d\n", err); quitflag = 1; break; } /* For video de-interlace, Low/Medium motion */ if ((disp->deinterlaced == 1) && (disp->input.motion_sel != HIGH_MOTION)) { tmp_idx[0] = tmp_idx[1]; tmp_idx[1] = tmp_idx[2]; tmp_idx[2] = index; disp_clr_index = tmp_idx[0]; } } if ((dec->cmdl->format != STD_MJPG) && (disp_clr_index >= 0) && (!disp->stopping) && !((disp->deinterlaced == 1) && (disp->input.motion_sel != HIGH_MOTION) && (disp->ncount < 2))) { err = vpu_DecClrDispFlag(handle, disp_clr_index); if (err) { err_msg("vpu_DecClrDispFlag failed Error code %d\n", err); quitflag = 1; break; } } disp->ncount++; } mxc_ipu_lib_task_uninit(&(disp->ipu_handle)); pthread_attr_destroy(&attr); info_msg("Disp loop thread exit\n"); ipu_running = 0; return; }
void ipu_disp_loop_thread(void *arg) { struct DecodingInstance *dec = (struct DecodingInstance *)arg; struct vpu_display *disp = dec->disp; int index = -1, disp_clr_index, tmp_idx[3] = {0,0,0}, err, mode; pthread_attr_t attr; ipu_running = 1; pthread_attr_init(&attr); pthread_attr_setschedpolicy(&attr, SCHED_RR); while(1) { disp_clr_index = index; index = dequeue_buf(&(disp->ipu_q)); if (index < 0) { wait_queue(); ipu_waiting = 0; index = dequeue_buf(&(disp->ipu_q)); if (index < 0) { fputs("thread is going to finish\n", stderr); break; } } if (disp->ncount == 0) { disp->input.user_def_paddr[0] = disp->ipu_bufs[index].ipu_paddr; /* For video de-interlace, Low/Medium motion */ tmp_idx[0] = index; }else if ((disp->ncount == 1)) { disp->input.user_def_paddr[disp->ncount] = disp->ipu_bufs[index].ipu_paddr; mode = (OP_STREAM_MODE | TASK_PP_MODE); err = mxc_ipu_lib_task_init(&(disp->input), NULL, &(disp->output), mode, &(disp->ipu_handle)); if (err < 0) { fprintf(stderr, "mxc_ipu_lib_task_init failed, err %d\n", err); quitflag = 1; return; } /* it only enable ipu task and finish first frame */ err = mxc_ipu_lib_task_buf_update(&(disp->ipu_handle), 0, 0, 0, NULL, NULL); if (err < 0) { fprintf(stderr, "mxc_ipu_lib_task_buf_update failed, err %d\n", err); quitflag = 1; break; } } else { err = mxc_ipu_lib_task_buf_update(&(disp->ipu_handle), disp->ipu_bufs[index].ipu_paddr, 0, 0, NULL, NULL); if (err < 0) { fprintf(stderr, "mxc_ipu_lib_task_buf_update failed, err %d\n", err); quitflag = 1; break; } } disp->ncount++; } mxc_ipu_lib_task_uninit(&(disp->ipu_handle)); pthread_attr_destroy(&attr); fputs("Disp loop thread exit\n", stderr); ipu_running = 0; return; }