文件 图片 41/10000 实时翻译 划译 When I use LVGL to create a 4K-sized canvas on Linux, the actual canvas size does not match my settings.

Code

The code block(s) should be between ```c and ``` tags:

/*LittlevGL init*/
lv_init();

set_screen_size(3840,2160);
/*Linux frame buffer device init*/
Init_lvgl_buffer();

/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t *buf = NULL;
buf = (lv_color_t *)malloc(sizeof(lv_color_t)*3840*2160);

if(buf == NULL)
	printf("lv_color_t *buf create error!\n\r");
/*Initialize a descriptor for the buffer*/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, m_vout_width*m_vout_height);
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf   = &disp_buf;
disp_drv.flush_cb   = fbdev_flush;
get_screen_size((int *)&disp_drv.hor_res,(int*)&disp_drv.ver_res);
printf("screen_size is %d %d\n",(int)disp_drv.hor_res,(int)disp_drv.ver_res);
lv_disp_drv_register(&disp_drv);

static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/
indev_drv_1.type = LV_INDEV_TYPE_POINTER;
printf("lvgl_init end!\n\r");
int cbuf_size = sizeof(lv_color_t)*LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(3840,2160);
int cbuf_fd = -1;
lv_color_t *cbuf = NULL;
int ret = dma_buf_alloc(DMA_HEAP_PATH, cbuf_size, &cbuf_fd, (void **)&cbuf);
if (ret < 0) {
	TRACEF("alloc cbuf buffer failed!\n");
	return NULL;
}


setup_ui(&guider_ui);
canvas = lv_canvas_create(guider_ui.screen);
lv_canvas_set_buffer(canvas, cbuf, 3840,2160, LV_IMG_CF_TRUE_COLOR_ALPHA);
lv_obj_set_pos(canvas, 0, 0);
lv_canvas_fill_bg(canvas, lv_color_make(0x00, 0x00, 0x00), 0);
 

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.