static void d2d3_vf_put(vframe_t *vf, void* arg) { int idx = (int)(vf->private_data); //printk("%s %d\n", __func__,idx); /* d2d3 process code start*/ /*d2d3 process code*/ if((idx<D2D3_IDX_MAX)&&(idx>=0)){ d2d3_devnox[idx].vf = NULL; /* restore early_process_fun/process_fun/private_data */ vf->early_process_fun = d2d3_devnox[idx].pre_early_process_fun; vf->process_fun = d2d3_devnox[idx].pre_process_fun; vf->private_data = d2d3_devnox[idx].pre_private_data; } else { printk("[d2d3]%s: error, return vf->private_data %x is not in the "\ "range.\n", __func__,idx); } prov = vf_get_provider(d2d3_devp->vfm_name); if(prov&&prov->ops&&prov->ops->put){ prov->ops->put(vf,prov->op_arg); vf_notify_provider(d2d3_devp->vfm_name,VFRAME_EVENT_RECEIVER_PUT,prov->op_arg); } }
static inline void mipi_vf_put(vframe_t *vf) { struct vframe_provider_s *vfp = vf_get_provider(RECEIVER_NAME); if (vfp) { vf_put(vf, RECEIVER_NAME); } return; }
static inline void ppmgr_vf_put_dec(vframe_t *vf) { struct vframe_provider_s *vfp; vfp = vf_get_provider(RECEIVER_NAME); if (!(vfp && vfp->ops && vfp->ops->peek)) return; vfp->ops->put(vf,vfp->op_arg); }
void vf_put(struct vframe_s *vf, const char *receiver) { struct vframe_provider_s *vfp; vfp = vf_get_provider(receiver); if (!(vfp && vfp->ops && vfp->ops->put)) return; vfp->ops->put(vf, vfp->op_arg); }
struct vframe_s *vf_peek(const char *receiver) { struct vframe_provider_s *vfp; vfp = vf_get_provider(receiver); if (!(vfp && vfp->ops && vfp->ops->peek)) return NULL; return vfp->ops->peek(vfp->op_arg); }
static inline vframe_t *vm_vf_get_from_provider(void) { struct vframe_provider_s *vfp; vfp = vf_get_provider(RECEIVER_NAME); if (!(vfp && vfp->ops && vfp->ops->peek)) return NULL; return vfp->ops->get(vfp->op_arg); }
static int d2d3_receiver_event_fun(int type, void* data, void* arg) { int i, ret=0; d2d3_param_t *parm = &d2d3_devp->param; if((type == VFRAME_EVENT_PROVIDER_UNREG)|| (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG)){ prov = NULL; if(d2d3_devp->flag & D2D3_BYPASS){ d2d3_enable_hw(false); d2d3_enable_path(false, parm); } vf_notify_receiver(d2d3_devp->vfm_name,VFRAME_EVENT_PROVIDER_UNREG,NULL); vf_unreg_provider(&d2d3_vf_prov); d2d3_devp->flag &= (~D2D3_REG); // keep flag when unreg pr_info("[d2d3]%s: provider unregister,disable d2d3.\n",__func__); } else if(type == VFRAME_EVENT_PROVIDER_REG){ char* provider_name = (char*)data; if((strcmp(provider_name, "deinterlace")==0)||(strcmp(provider_name, "ppmgr")==0)){ have_process_fun_private_data = 1; } else{ have_process_fun_private_data = 0; } vf_reg_provider(&d2d3_vf_prov); for(i=0; i<D2D3_IDX_MAX; i++){ d2d3_devnox[i].vf = NULL; } prov = vf_get_provider(d2d3_devp->vfm_name); d2d3_devp->flag |= D2D3_REG; vf_notify_receiver(d2d3_devp->vfm_name,VFRAME_EVENT_PROVIDER_START,NULL); } else if((VFRAME_EVENT_PROVIDER_DPBUF_CONFIG == type) && (D2D3_DPG_MUX_NRW == parm->dpg_path)) { vframe_t * vf = (vframe_t*)data; struct di_buf_s *di_buf = vf->private_data; d2d3_devp->dpg_addr = di_buf->dp_buf_adr; /*just update the dpg canvas config with the addr from di*/ d2d3_config_dpg_canvas(d2d3_devp); pre_count++; } else if(VFRAME_EVENT_PROVIDER_FR_HINT == type) { vf_notify_receiver(d2d3_devp->vfm_name,VFRAME_EVENT_PROVIDER_FR_HINT,data); } else if(VFRAME_EVENT_PROVIDER_FR_END_HINT == type) { vf_notify_receiver(d2d3_devp->vfm_name,VFRAME_EVENT_PROVIDER_FR_END_HINT,data); } return ret; }
static inline vframe_t *ppmgr_vf_peek_dec(void) { struct vframe_provider_s *vfp; vframe_t *vf; vfp = vf_get_provider(RECEIVER_NAME); if (!(vfp && vfp->ops && vfp->ops->peek)) return NULL; vf = vfp->ops->peek(vfp->op_arg); return vf; }
int vf_ppmgr_get_states(vframe_states_t *states) { int ret = -1; unsigned long flags; struct vframe_provider_s *vfp; vfp = vf_get_provider(RECEIVER_NAME); spin_lock_irqsave(&lock, flags); if (vfp && vfp->ops && vfp->ops->vf_states) { ret=vfp->ops->vf_states(states, vfp->op_arg); } spin_unlock_irqrestore(&lock, flags); return ret; }
int vf_notify_provider(const char *receiver_name, int event_type, void *data) { int ret = -1; struct vframe_provider_s *provider = vf_get_provider(receiver_name); if (provider) { if (provider->ops && provider->ops->event_cb) { provider->ops->event_cb(event_type, data, provider->op_arg); ret = 0; } } else{ /* pr_err("Error: %s, fail to get provider of receiver %s\n", __func__, receiver_name); */ } return ret; }