lvgl / lv_port_linux

LVGL configured to work with a standard Linux framebuffer
MIT License
260 stars 160 forks source link

Some bug-like issues #44

Closed pan1024 closed 6 months ago

pan1024 commented 10 months ago

I got this error "[Error] (4292956.517, +4292956517) lv_display_set_buffers: Asserted at expression: stride * h <= buf_size DIRECT mode requires screen sized buffer(s) lv_display.c:419"

pan1024 commented 10 months ago

I don't know how to set this due to the change of interface, but I found LV_LINUX_FBDEV_BUFFER_SIZE in lv_config.h and set it to my screen size (480*480) but this is invalid and I still get that error.

pan1024 commented 10 months ago

Until I found out about this lv_display_t * lv_linux_fbdev_create(void) { static bool inited = false; if(!inited) { lv_tick_set_cb(tick_get_cb), inited = true; }

lv_linux_fb_t * dsc = lv_malloc_zeroed(sizeof(lv_linux_fb_t));
LV_ASSERT_MALLOC(dsc);
if(dsc == NULL) return NULL;

lv_display_t * disp = lv_display_create(800, 480);
if(disp == NULL) {
    lv_free(dsc);
    return NULL;
}
dsc->fbfd = -1;
lv_display_set_driver_data(disp, dsc);
lv_display_set_flush_cb(disp, flush_cb);

return disp;

} Maybe you found the problem, lv_display_t disp = lv_display_create(800, 480); When I modify it to lv_display_t disp = lv_display_create(480, 480); The program is ready to run, and I found the same problem in the DRM code

pan1024 commented 10 months ago

As I continued reading the source code, I found this if(LV_LINUX_FBDEV_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) { draw_buf_size *= LV_LINUX_FBDEV_BUFFER_SIZE;} However, there is no LV_DISPLAY_RENDER_MODE_PARTIAL in lv_conf.h, and perhaps more details are needed to refine the use of the new version

kisvegabor commented 10 months ago

Hi,

Can you send a code snippet to reproduce the issue with

pan1024 commented 10 months ago

Hi,

Can you send a code snippet to reproduce the issue with

  • how you create the display
  • the FBDEV related part of lv_conf.h

I didn't make any changes to the project after I got it, I put it on my board after cross-compiling it according to the README, at this point I was already wondering why there was no screen configuration similar to v8.3, and then the error I mentioned occurred at runtime

pan1024 commented 10 months ago

Hi, Can you send a code snippet to reproduce the issue with

  • how you create the display
  • the FBDEV related part of lv_conf.h

I didn't make any changes to the project after I got it, I put it on my board after cross-compiling it according to the README, at this point I was already wondering why there was no screen configuration similar to v8.3, and then the error I mentioned occurred at runtime

lv_display_t * lv_linux_fbdev_create (void) It comes from lvgl/src/drivers/display/fb

kisvegabor commented 10 months ago

Please print dsc->vinfo.bits_per_pixel.

pan1024 commented 10 months ago

Please print dsc->vinfo.bits_per_pixel. dsc->vinfo.bits_per_pixel:32

pan1024 commented 10 months ago

Please print dsc->vinfo.bits_per_pixel.

I'm not sure you understand what I mean, but I mean from the main.c example so far lv_linux_fbdev_create the (void) design may not be flexible enough, and when I want to change the screen size, I need to go into the source code to modify it, if there is an easier way, please let me know

kisvegabor commented 10 months ago

what I mean, but I mean from the main.c example so far lv_linux_fbdev_create the (void) design may not be flexible enough, and when I want to change the screen size, I need to go into the source code to modify it, if there is an easier way, please let me know

Oh, I really misunderstood it and it's really set the the screen's resolution by default. What we can do is calling lv_display_set_resolution(display, hor_res, ver_res) from main.c but in lv_linux_fbdev_create we can add an LV_EVENT_RESOLUTION_CHANGED event to the display where we can reallocate the buffers.