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 int d2d3_post_process_fun(void* arg, unsigned zoom_start_x_lines, unsigned zoom_end_x_lines, unsigned zoom_start_y_lines, unsigned zoom_end_y_lines, vframe_t* disp_vf) { int ret = 0; int idx = (int)arg; d2d3_devnox_t* p_d2d3_devnox = NULL; di_buf_t *di_buf_p = NULL; if((idx>=0) && (idx<D2D3_IDX_MAX)){ p_d2d3_devnox = &d2d3_devnox[idx]; if(have_process_fun_private_data && p_d2d3_devnox->pre_process_fun){ ret = p_d2d3_devnox->pre_process_fun(p_d2d3_devnox->pre_private_data, zoom_start_x_lines, zoom_end_x_lines, zoom_start_y_lines, zoom_end_y_lines, disp_vf); } }else{ pr_info("[d2d3]%s: the index %d over the max index.\n",__func__,idx); } post_count++; zoom_start_x_lines = zoom_start_x_lines&0xffff; zoom_end_x_lines = zoom_end_x_lines&0xffff; zoom_start_y_lines = zoom_start_y_lines&0xffff; zoom_end_y_lines = zoom_end_y_lines&0xffff; if(d2d3_devp->flag & D2D3_REG){ vf_notify_receiver(VFM_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); /*d2d3 irq process*/ if(!(d2d3_devp->flag & D2D3_BYPASS)){ di_buf_p = p_d2d3_devnox->pre_private_data; d2d3_devp->dbr_addr = di_buf_p->dp_buf_adr; ret = d2d3_irq_process(zoom_end_x_lines-zoom_start_x_lines+1, zoom_end_y_lines-zoom_start_y_lines+1,di_buf_p->reverse_flag); } } return ret; }
static irqreturn_t vmpeg12_isr(int irq, void *dev_id) { u32 reg, info, seqinfo, offset, pts, pts_valid = 0; vframe_t *vf; ulong flags; WRITE_MPEG_REG(ASSIST_MBOX1_CLR_REG, 1); reg = READ_MPEG_REG(MREG_BUFFEROUT); if (reg) { info = READ_MPEG_REG(MREG_PIC_INFO); offset = READ_MPEG_REG(MREG_FRAME_OFFSET); info = info | PICINFO_TOP_FIRST; if (((info & PICINFO_TYPE_MASK) == PICINFO_TYPE_I) && (pts_lookup_offset(PTS_TYPE_VIDEO, offset, &pts, 0) == 0)) { pts_valid = 1; } /*if (frame_prog == 0)*/ { frame_prog = info & PICINFO_PROG; } if ((dec_control & DEC_CONTROL_FLAG_FORCE_2500_720_576_INTERLACE) && (frame_width == 720) && (frame_height == 576) && (frame_dur == 3840)) { frame_prog = 0; } else if ((dec_control & DEC_CONTROL_FLAG_FORCE_3000_704_480_INTERLACE) && (frame_width == 704) && (frame_height == 480) && (frame_dur == 3200)) { frame_prog = 0; } else if ((dec_control & DEC_CONTROL_FLAG_FORCE_2500_704_576_INTERLACE) && (frame_width == 704) && (frame_height == 576) && (frame_dur == 3840)) { frame_prog = 0; } else if ((dec_control & DEC_CONTROL_FLAG_FORCE_2500_544_576_INTERLACE) && (frame_width == 544) && (frame_height == 576) && (frame_dur == 3840)) { frame_prog = 0; } else if ((dec_control & DEC_CONTROL_FLAG_FORCE_2500_480_576_INTERLACE) && (frame_width == 480) && (frame_height == 576) && (frame_dur == 3840)) { frame_prog = 0; } if (frame_prog & PICINFO_PROG) { u32 index = ((reg & 7) - 1) & 3; seqinfo = READ_MPEG_REG(MREG_SEQ_INFO); vf = vfq_pop(&newframe_q); set_frame_info(vf); vf->index = index; vf->type = VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_FIELD; if ((seqinfo & SEQINFO_EXT_AVAILABLE) && (seqinfo & SEQINFO_PROG)) { if (info & PICINFO_RPT_FIRST) { if (info & PICINFO_TOP_FIRST) { vf->duration = vf->duration * 3; // repeat three times } else { vf->duration = vf->duration * 2; // repeat two times } } vf->duration_pulldown = 0; // no pull down } else { vf->duration_pulldown = (info & PICINFO_RPT_FIRST) ? vf->duration >> 1 : 0; } vf->duration += vf->duration_pulldown; vf->canvas0Addr = vf->canvas1Addr = index2canvas(index); vf->pts = (pts_valid) ? pts : 0; vfbuf_use[index]++; if (error_skip(info, vf)) { spin_lock_irqsave(&lock, flags); vfq_push(&recycle_q, vf); spin_unlock_irqrestore(&lock, flags); } else { vfq_push(&display_q, vf); } vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); } else {
static irqreturn_t vmjpeg_isr(int irq, void *dev_id) { u32 reg, offset, pts, pts_valid = 0; vframe_t *vf; WRITE_MPEG_REG(ASSIST_MBOX1_CLR_REG, 1); reg = READ_MPEG_REG(MREG_FROM_AMRISC); if (reg & PICINFO_BUF_IDX_MASK) { offset = READ_MPEG_REG(MREG_FRAME_OFFSET); if (pts_lookup_offset(PTS_TYPE_VIDEO, offset, &pts, 0) == 0) { pts_valid = 1; } if ((reg & PICINFO_INTERLACE) == 0) { u32 index = ((reg & PICINFO_BUF_IDX_MASK) - 1) & 3; vfpool_idx[fill_ptr] = index; vf = &vfpool[fill_ptr]; set_frame_info(vf); vf->type = VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_FIELD; vf->canvas0Addr = vf->canvas1Addr = index2canvas0(index); vf->pts = (pts_valid) ? pts : 0; vfbuf_use[index]++; INCPTR(fill_ptr); vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); } else { u32 index = ((reg & PICINFO_BUF_IDX_MASK) - 1) & 3; vfpool_idx[fill_ptr] = index; vf = &vfpool[fill_ptr]; set_frame_info(vf); #if 0 if (reg & PICINFO_AVI1) { /* AVI1 format */ if (reg & PICINFO_INTERLACE_AVI1_BOT) { vf->type = VIDTYPE_INTERLACE_BOTTOM | VIDTYPE_INTERLACE_FIRST; } else { vf->type = VIDTYPE_INTERLACE_TOP; } } else { if (reg & PICINFO_INTERLACE_FIRST) { vf->type = VIDTYPE_INTERLACE_TOP | VIDTYPE_INTERLACE_FIRST; } else { vf->type = VIDTYPE_INTERLACE_BOTTOM; } } vf->type |= VIDTYPE_VIU_FIELD; vf->duration >>= 1; vf->canvas0Addr = vf->canvas1Addr = index2canvas0(index); if ((vf->type & VIDTYPE_INTERLACE_FIRST) && (pts_valid)) { vf->pts = pts; } else { vf->pts = 0; } vfbuf_use[index]++; INCPTR(fill_ptr); #else /* send whole frame by weaving top & bottom field */ vf->type = VIDTYPE_PROGRESSIVE; vf->canvas0Addr = index2canvas0(index); vf->canvas1Addr = index2canvas1(index); if (pts_valid) { vf->pts = pts; } else { vf->pts = 0; } vfbuf_use[index]++; INCPTR(fill_ptr); vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); #endif } WRITE_MPEG_REG(MREG_FROM_AMRISC, 0); }
static irqreturn_t vmjpeg_isr(int irq, void *dev_id) { u32 reg, offset, pts, pts_valid = 0; vframe_t *vf = NULL; WRITE_VREG(ASSIST_MBOX1_CLR_REG, 1); reg = READ_VREG(MREG_FROM_AMRISC); if (reg & PICINFO_BUF_IDX_MASK) { offset = READ_VREG(MREG_FRAME_OFFSET); if (pts_lookup_offset(PTS_TYPE_VIDEO, offset, &pts, 0) == 0) { pts_valid = 1; } if ((reg & PICINFO_INTERLACE) == 0) { u32 index = ((reg & PICINFO_BUF_IDX_MASK) - 1) & 3; if (index >= DECODE_BUFFER_NUM_MAX) { printk("fatal error, invalid buffer index."); return IRQ_HANDLED; } if (kfifo_get(&newframe_q, &vf) == 0) { printk("fatal error, no available buffer slot."); return IRQ_HANDLED; } set_frame_info(vf); vf->index = index; #ifdef NV21 vf->type = VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_FIELD | VIDTYPE_VIU_NV21; #else vf->type = VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_FIELD; #endif vf->canvas0Addr = vf->canvas1Addr = index2canvas0(index); vf->pts = (pts_valid) ? pts : 0; vf->orientation = 0 ; vfbuf_use[index]++; kfifo_put(&display_q, (const vframe_t **)&vf); vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); } else { u32 index = ((reg & PICINFO_BUF_IDX_MASK) - 1) & 3; if (index >= DECODE_BUFFER_NUM_MAX) { printk("fatal error, invalid buffer index."); return IRQ_HANDLED; } if (kfifo_get(&newframe_q, &vf) == 0) { printk("fatal error, no available buffer slot."); return IRQ_HANDLED; } set_frame_info(vf); vf->index = index; #if 0 if (reg & PICINFO_AVI1) { /* AVI1 format */ if (reg & PICINFO_INTERLACE_AVI1_BOT) { vf->type = VIDTYPE_INTERLACE_BOTTOM | VIDTYPE_INTERLACE_FIRST; } else { vf->type = VIDTYPE_INTERLACE_TOP; } } else { if (reg & PICINFO_INTERLACE_FIRST) { vf->type = VIDTYPE_INTERLACE_TOP | VIDTYPE_INTERLACE_FIRST; } else { vf->type = VIDTYPE_INTERLACE_BOTTOM; } } vf->type |= VIDTYPE_VIU_FIELD; #ifdef NV21 vf->type |= VIDTYPE_VIU_NV21; #endif vf->duration >>= 1; vf->canvas0Addr = vf->canvas1Addr = index2canvas0(index); vf->orientation = 0 ; if ((vf->type & VIDTYPE_INTERLACE_FIRST) && (pts_valid)) { vf->pts = pts; } else { vf->pts = 0; } vfbuf_use[index]++; kfifo_put(&display_q, (const vframe_t **)&vf); #else /* send whole frame by weaving top & bottom field */ #ifdef NV21 vf->type = VIDTYPE_PROGRESSIVE | VIDTYPE_VIU_NV21; #else vf->type = VIDTYPE_PROGRESSIVE; #endif vf->canvas0Addr = index2canvas0(index); vf->canvas1Addr = index2canvas1(index); vf->orientation = 0 ; if (pts_valid) { vf->pts = pts; } else { vf->pts = 0; } vfbuf_use[index]++; kfifo_put(&display_q, (const vframe_t **)&vf); vf_notify_receiver(PROVIDER_NAME,VFRAME_EVENT_PROVIDER_VFRAME_READY,NULL); #endif } WRITE_VREG(MREG_FROM_AMRISC, 0); }