Edit online

Demo

28 Nov 2024
Read time: 1 minute(s)

MPP FB 接口使用

MPP FB 接口操作示例:
int main(void)
{
    struct aicfb_screeninfo 9nfo = {0};
    struct mpp_fb *fb;
    int zero, ret;

    mpp_fb_probe();   // 探测 MPP FB

    fb = mpp_fb_open();  // 打开 MPP FB 句柄
    if (!fb)
        return -1;

    /* Enable lcd panel */
    ret = mpp_fb_ioctl(fb, AICFB_POWERON, &zero);
    if (ret)
        return -1;

    /* Get screen info */
    ret = mpp_fb_ioctl(fb, AICFB_GET_SCREENINFO, &info);
    if (ret)
        return -1;

    /* Clear framebuffer */
    memset(info.framebuffer, 0x00, info.smem_len);

    /* Framebuffer is a cached buffer, flush cache is required */
    aicos_dcache_clean_invalid_range((unsigned long *)info.framebuffer, info.smem_len);

    mpp_fb_close(fb);    // 关闭 MPP FB 句柄

    return 0;
}