Example #1
0
void _g2d_command_handler(g2d_command_t *cmd)
{
    G2D_DBG("start to handle command (0x%04x)\n", cmd->ctx.flag);

    switch (cmd->ctx.flag)
    {
    case G2D_FLAG_END_OF_FRAME:
        g2d_drv_fb_queue_buffer(cmd->ctx.fb_id);
        break;

    case G2D_FLAG_FLUSH:
        break;

    case G2D_FLAG_MIRROR_FRONT_FB:
        if (g2d_drv_fb_fill_mirror_cmd(&cmd->ctx) != 0) break;
    default:
        {
#ifdef G2D_PROFILE
            struct timeval t1, t2;
            do_gettimeofday(&t1);
#endif
            g2d_drv_power_on();

            g2d_drv_run(&cmd->ctx);

            while (g2d_drv_get_status())
            {
                wait_event_interruptible_timeout(isr_wait_queue, !g2d_drv_get_status(), (30 * HZ / 1000));
                if (g2d_drv_get_status()) G2D_ERR("TIMEOUT: G2D is still busy");
            }

#ifdef G2D_PROFILE
            do_gettimeofday(&t2);
            G2D_INF("process time (%u)\n", (t2.tv_sec - t1.tv_sec) * 1000000 + (t2.tv_usec - t1.tv_usec));
#endif

#ifdef G2D_DEBUG
            _g2d_reg_dump();
#endif

            g2d_drv_reset();

            g2d_drv_power_off();
        }
        break;
    }

    G2D_DBG("handle command (0x%04x) W2M(0x%08x) L0(0x%08x) L1(0x%08x) L2(0x%08x) L3(0x%08x) done\n", cmd->ctx.flag, ioread32(0xF20C5044), ioread32(0xF20C5084), ioread32(0xF20C50C4), ioread32(0xF20C5104), ioread32(0xF20C5144));

    memset(&cmd->ctx, 0, sizeof(g2d_context_t));

#ifdef G2D_QUEUE
    if (cmd->sync_cmd)
    {
        cmd->sync_cmd = false;
        up(&cmd->sync);
    }
    up(&cmd->lock);
#endif
}
Example #2
0
void _g2d_command_handler(g2d_command_t *cmd)
{
    G2D_DBG("start to handle command\n");

#ifdef G2D_QUEUE
    if (cmd->ctx.end_of_frame)
    {
        g2d_drv_fb_queue_buffer(cmd->ctx.fb_id);
        up(&cmd->lock);
        return;
    }
#endif

    g2d_drv_power_on();

    g2d_drv_run(&cmd->ctx);

    wait_event_interruptible(isr_wait_queue, !g2d_drv_get_status());

#ifdef G2D_DEBUG
    _g2d_reg_dump();
#endif

    g2d_drv_power_off();

    G2D_DBG("handle command done\n");

#ifdef G2D_QUEUE
    up(&cmd->lock);
#endif
}