Initialization screen

The screen needs to be initialized before the Qt application executes, otherwise it will not display properly.For screen initialization, see logo.c in JpegPlayer/.

  • Download document/JpegPlayer.tar to Linux system and unzip it to the same directory as project:

  • Go to the unzip directory and copy logo.c as disp_init.c:

  • Alter disp_init.c to remove any code other than initialization:

#define TEST_GFX    0


struct fb_var_screeninfo vinfo = {0};
struct fb_fix_screeninfo finfo = {0};
MI_FB_DisplayLayerAttr_t g_stLayerInfo = {0};

//Start of frame buffer mem
static char *frameBuffer = NULL;

#include <sched.h>
#include <pthread.h>

int main(int argc, char **argv)
{
    const char *devfile = "/dev/fb0";
    long int screensize = 0;
    int fbFd = 0;
    BITMAP logo;
    BITMAP fb;
    MI_DISP_PubAttr_t stDispPubAttr = {0};
    memset(&g_stLayerInfo, 0, sizeof(MI_FB_DisplayLayerAttr_t));

    sstar_disp_init(&stDispPubAttr);

    fbFd = open(devfile, O_RDWR);

    if(fbFd == -1)
    {
        perror("Error: cannot open framebuffer device");
        exit(1);
    }

    int show = 0;

    if(ioctl(fbFd, FBIOSET_SHOW, &show) < 0)
    {
        return (0);
    }

    //get fb_fix_screeninfo
    if(ioctl(fbFd, FBIOGET_FSCREENINFO, &finfo) == -1)
    {
        perror("Error reading fixed information");
        exit(2);
    }

    //get fb_var_screeninfo
    if(ioctl(fbFd, FBIOGET_VSCREENINFO, &vinfo) == -1)
    {
        perror("Error reading variable information");
        exit(3);
    }
    //get FBIOGET_DISPLAYLAYER_ATTRIBUTES
    if(ioctl(fbFd, FBIOGET_DISPLAYLAYER_ATTRIBUTES, &g_stLayerInfo) == -1)
    {
        perror("3Error reading variable information");
        exit(3);
    }


SHOW:

    //Pandisplay
    if(ioctl(fbFd, FBIOPAN_DISPLAY, &vinfo) == -1)
    {
        perror("Error: failed to FBIOPAN_DISPLAY");
        exit(5);
    }
    /*Do not let him quit, otherwise the system will close the FBFD, read initialization failed, can be implemented by the way of background operation*/
    while(1)
    {
        sleep(1);
    }

#if (0)
    sstar_disp_Deinit(&stDispPubAttr);
    unmap buffer
    munmap(frameBuffer, screensize);
    fclose(fp);
    close(fbFd);
#endif

    return 0;
}
  • Copy the adjusted screen parameter header file to the JpegPlayerdirectory:

  • Change sstardisp.c and include the screen parameter header file:

#define UI_1024_600 1
#define USE_MIPI    0


#if UI_1024_600
#include "SAT070CP50_1024x600.h"
#else
#if USE_MIPI
#include "EK79007_1024x600_MIPI.h"
#else
#include "SAT070AT50_800x480.h"
#endif
#endif

// loacl play res
#if UI_1024_600
//#define LOCAL_VIDEO_W  822
//#define LOCAL_VIDEO_H  464
//#define LOCAL_VIDEO_X  100
//#define LOCAL_VIDEO_Y  60
#define LOCAL_VIDEO_W  1024
#define LOCAL_VIDEO_H  600
#define LOCAL_VIDEO_X  0
#define LOCAL_VIDEO_Y  0
#else
//#define LOCAL_VIDEO_W  640
//#define LOCAL_VIDEO_H  360
//#define LOCAL_VIDEO_X  100
//#define LOCAL_VIDEO_Y  60
#define LOCAL_VIDEO_W  800
#define LOCAL_VIDEO_H  480
#define LOCAL_VIDEO_X  0
#define LOCAL_VIDEO_Y  0
#endif
  • Modify the makefile
LOGO_SRC:=disp_init.c  sstardisp.c bmp.c  jpeg.c common/verify_gfx.c common/blitutil.c
LOGO:=disp_init
  • The disp_init executable file will be generated in the directory after compilation:
    # make
文档更新时间: 2021-03-18 11:08   作者:Aeeditor