Esempio n. 1
0
int ovl2mem_trigger(int blocking, void *callback, unsigned int userdata)
{
    int ret = -1;
    int fence_idx = 0;
    int layid = 0;
    DISPFUNC();

    if(pgc->need_trigger_path == 0)
    {
        DISPMSG("ovl2mem_trigger do not trigger\n");
        if ((atomic_read(&g_trigger_ticket) - atomic_read(&g_release_ticket)) == 1)
        {
            DISPMSG("ovl2mem_trigger(%x), configue input, but does not config output!!\n", pgc->session);
            for(layid = 0; layid < (HW_OVERLAY_COUNT + 1); layid++)
            {
                fence_idx = mtkfb_query_idx_by_ticket(pgc->session, layid, atomic_read(&g_trigger_ticket));
                if(fence_idx >=0) 
                {
                    mtkfb_release_fence(pgc->session, layid, fence_idx);
                }
            }
        }
        return ret;
    }
    _ovl2mem_path_lock(__func__);

    dpmgr_path_start(pgc->dpmgr_handle, ovl2mem_cmdq_enabled());
    dpmgr_path_trigger(pgc->dpmgr_handle, pgc->cmdq_handle_config, ovl2mem_cmdq_enabled());
        
    cmdqRecWait(pgc->cmdq_handle_config, CMDQ_EVENT_DISP_WDMA1_EOF);
    
    dpmgr_path_stop(pgc->dpmgr_handle, ovl2mem_cmdq_enabled());

    ///cmdqRecDumpCommand(pgc->cmdq_handle_config);
    
    cmdqRecFlushAsyncCallback(pgc->cmdq_handle_config, ovl2mem_callback, atomic_read(&g_trigger_ticket));

    cmdqRecReset(pgc->cmdq_handle_config);
    
    pgc->need_trigger_path = 0;
    atomic_add(1, &g_trigger_ticket );
    
    _ovl2mem_path_unlock(__func__);

    dprec_logger_frame_seq_begin(pgc->session,  mtkfb_query_frm_seq_by_addr(pgc->session, 0, 0));
    DISPMSG("ovl2mem_trigger ovl2mem_seq %d-seq %d\n", get_ovl2mem_ticket(), mtkfb_query_frm_seq_by_addr(pgc->session, 0, 0));
    
    return ret;
}
Esempio n. 2
0
void update_frm_seq_info(unsigned int session_id, unsigned int addr, unsigned int addr_offset,unsigned int seq, DISP_FRM_SEQ_STATE state)
{
    int i= 0;
    unsigned device_type = DISP_SESSION_TYPE(session_id);
    //printk("update_frm_seq_info, 0x%x/0x%x/0x%x/%d/%s/%d\n", session_id, addr, addr_offset, seq, get_frame_seq_state_string(state), frm_update_cnt);

    if(seq < 0 || session_id < 0 || state > FRM_RDMA0_EOF)
        return ;
    if(device_type > DISP_SESSION_MEMORY)
    {
        printk("seq_end session_id(0x%x) , seq(%d) \n",session_id, seq);
        return;
    }

    if(device_type == DISP_SESSION_PRIMARY || device_type == DISP_SESSION_PRIMARY - 1)
    {
        if(FRM_CONFIG == state)
        {
            frm_update_sequence[frm_update_cnt].state = state;
            frm_update_sequence[frm_update_cnt].session_type = device_type;
            frm_update_sequence[frm_update_cnt].mva= addr;
            frm_update_sequence[frm_update_cnt].max_offset= addr_offset;
            if(seq > 0)
                frm_update_sequence[frm_update_cnt].seq= seq;
            MMProfileLogEx(MTKFB_MMP_Events.primary_seq_config, MMProfileFlagPulse, addr, seq);
        }
        else if(FRM_TRIGGER == state)
        {
            frm_update_sequence[frm_update_cnt].state = FRM_TRIGGER;
            MMProfileLogEx(MTKFB_MMP_Events.primary_seq_trigger, MMProfileFlagPulse, addr, seq);
            dprec_logger_frame_seq_begin(device_type,  frm_update_sequence[frm_update_cnt].seq);

            frm_update_cnt++;
            frm_update_cnt%=FRM_UPDATE_SEQ_CACHE_NUM;
        }
        else if(FRM_WDMA0_EOF == state)
        {
            for(i= 0; i< FRM_UPDATE_SEQ_CACHE_NUM; i++)
            {
                //			 if((absabs(addr -frm_update_sequence[i].mva) <=  frm_update_sequence[i].max_offset) && (frm_update_sequence[i].state == FRM_TRIGGER))
                if(frm_update_sequence[i].state == FRM_TRIGGER)
                {
                    frm_update_sequence[i].state = FRM_WDMA0_EOF;
                    frm_update_sequence[i].mva = addr;
                    MMProfileLogEx(MTKFB_MMP_Events.primary_seq_wdma0_efo, MMProfileFlagPulse, frm_update_sequence[i].mva, frm_update_sequence[i].seq);
                    ///break;
                }
            }
        }
        else if(FRM_RDMA0_SOF == state)
        {
            for(i= 0; i< FRM_UPDATE_SEQ_CACHE_NUM; i++)
            {
                if(FRM_WDMA0_EOF == frm_update_sequence[i].state && device_type == DISP_SESSION_PRIMARY && frm_update_sequence[i].mva == addr)
                {
                    frm_update_sequence[i].state = FRM_RDMA0_SOF;
                    dprec_logger_frame_seq_end(device_type,	frm_update_sequence[i].seq);
                    dprec_logger_frame_seq_begin(DISP_SESSION_PRIMARY-1,  frm_update_sequence[i].seq);
                    MMProfileLogEx(MTKFB_MMP_Events.primary_seq_rdma0_sof, MMProfileFlagPulse, frm_update_sequence[i].mva, frm_update_sequence[i].seq);
                }
            }
        }
        else if(FRM_RDMA0_EOF == state)
        {
            for(i= 0; i< FRM_UPDATE_SEQ_CACHE_NUM; i++)
            {
                if(FRM_RDMA0_SOF == frm_update_sequence[i].state && device_type == DISP_SESSION_PRIMARY && frm_update_sequence[i].mva == addr)
                {
                    frm_update_sequence[i].state = FRM_RDMA0_EOF;
                    dprec_logger_frame_seq_end(DISP_SESSION_PRIMARY-1,	frm_update_sequence[i].seq );
                    MMProfileLogEx(MTKFB_MMP_Events.primary_seq_rdma0_eof, MMProfileFlagPulse, frm_update_sequence[i].mva, frm_update_sequence[i].seq);

                }
            }
        }
    }
    else if(device_type == DISP_SESSION_MEMORY)
    {
        if(FRM_CONFIG == state)
        {
            frm_update_sequence_mem[frm_update_cnt_mem].state = state;
            frm_update_sequence_mem[frm_update_cnt_mem].session_type = device_type;
            frm_update_sequence_mem[frm_update_cnt_mem].mva= addr;
            frm_update_sequence_mem[frm_update_cnt_mem].max_offset= addr_offset;
            if(seq > 0)
                frm_update_sequence_mem[frm_update_cnt_mem].seq= seq;

            MMProfileLogEx(MTKFB_MMP_Events.external_seq_config, MMProfileFlagPulse, addr, seq);
        }
        else if(FRM_TRIGGER == state)
        {
            frm_update_sequence_mem[frm_update_cnt_mem].state = FRM_TRIGGER;
            MMProfileLogEx(MTKFB_MMP_Events.external_seq_trigger, MMProfileFlagPulse, addr, seq);
            dprec_logger_frame_seq_begin(device_type,  frm_update_sequence_mem[frm_update_cnt_mem].seq);

            frm_update_cnt_mem++;
            frm_update_cnt_mem%=FRM_UPDATE_SEQ_CACHE_NUM;
        }
        else if(FRM_WDMA0_EOF == state)
        {
            for(i= 0; i< FRM_UPDATE_SEQ_CACHE_NUM; i++)
            {
                //			  if((absabs(addr -frm_update_sequence_mem[i].mva) <=  frm_update_sequence_mem[i].max_offset) && (frm_update_sequence_mem[i].state == FRM_TRIGGER))
                if(frm_update_sequence_mem[i].state == FRM_TRIGGER)
                {
                    MMProfileLogEx(MTKFB_MMP_Events.external_seq_wdma0_efo, MMProfileFlagPulse, frm_update_sequence_mem[i].mva, frm_update_sequence_mem[i].seq);

                    frm_update_sequence_mem[i].state = FRM_WDMA0_EOF;
                    frm_update_sequence_mem[i].mva = addr;
                    dprec_logger_frame_seq_end(device_type,	frm_update_sequence_mem[i].seq);
                    ///break;
                }
            }
        }
    }

}