-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wayland support #51
base: master
Are you sure you want to change the base?
Conversation
- Update lv_conf with latest version - Modify CMakeLists.txt to support multiple configurations via options - Update README
Merge lastest change to Makefile - note: documentation states it's currently broken
Let's wait for merging Wayland in LVGL and update the submodule here too.
@100ask does the Makefile work well now? |
I am currently planning to fix this issue, the meaning here is not to abandon Makefile, right? |
@100ask Correct it means that's it's currently broken, and that cmake should be used instead. I've only removed the 'shall' verb, it was in future tense, making it slightly ambiguous. That's great news, let me know when you've fixed so that I can test it and even add the wayland target. |
bool err = false; | ||
|
||
/* Default values */ | ||
fullscreen = maximize = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the config part it to function for better readibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean move the switch/case used to get the options to a dedicated function ? Yes sure can
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just to keep main()
easier to read.
main.c
Outdated
if (tickless == 0 && sleep_wait > 0) { | ||
lv_tick_inc(sleep_wait); | ||
} | ||
|
||
/* Handle any Wayland/LVGL timers/events */ | ||
time_till_next = lv_wayland_timer_handler(); | ||
|
||
/* Run until the last window closes */ | ||
if (!lv_wayland_window_is_open(NULL)) { | ||
break; | ||
} | ||
|
||
/* Wait for something for an event to happen */ | ||
if (time_till_next == LV_NO_TIMER_READY) { | ||
sleep_wait = -1; | ||
} else if (time_till_next > INT_MAX) { | ||
sleep_wait = INT_MAX; | ||
} else { | ||
sleep_wait = time_till_next; | ||
} | ||
|
||
while ((poll(&pfd, 1, sleep_wait) < 0) && (errno == EINTR)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be part of the Wayland driver?
It would be nice to keep using lv_timer_handler
as it is. Can we have a timer are theard in the driver for polling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lv_wayland_timer_handler
was introduced by previous contributors, to poll for events, if there are no events the application sleeps until the next refresh. I don't see how it's possible to do this in the driver, the call to poll(2)
needs to know the time to next flush so it must be called from the main run loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open for suggestions, but it's going to take some more time to refactor and re-test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just wrapping the whole polling + lv_timer_handler
into an lv_wayland_event_loop
? Similar to QNX. It' won't keep lv_timer_handler
visible, but at least it's less glue code for the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I tried disabling the event driven timer handling, to move out the call to lv_timer_handler
out of the driver. But early window maximization/fullscreen doesn't work anymore on weston... It crashes because the shared memory buffers are resized and thus re-arranged. So the references in the draw units of weston become incorrect and it crashes... This is the problem I had a few months back. And the 'solution' was to build fixes around the event driven timer handler, simply because it gives more control over when the lvgl flush occurs. It can not occur in the middle of a commit. To add on top of it the event driven timer was a 'bit of hack' to begin with lvgl/lv_drivers#207. I will study the QNX driver more carefully, I see that they are pausing the timer. Will come up with something similar and make it run on weston...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the import, it's also probably a good idea to start a re-write, it needs it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kisvegabor I've adjusted the driver as much as I could to match the other ones lvgl/lvgl@7783303
I prefer to implement the sleeping when the window hidden or minimized, once we refactor the driver. It currently works well on weston and Mutter which is great. Is that fine with you ? If yes, I will take of the stubs this evening/tommorow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-introduced the sleep when hidden feature, by using the frame done event. It's a slightly different approach than original. Works well, tested and documented.
# Please set the wanted option to 'ON'. By default, FBDEV is used | ||
# be sure to also enable the selected driver in lv_conf.h | ||
|
||
option(LV_USE_WAYLAND "Use the wayland client backend" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, there is a potential issue here: https://cmake.org/cmake/help/latest/command/option.html
Before that, it should be ensured that the cache has been cleared, e.g:
if(DEFINED LV_USE_WAYLAND)
unset(LV_USE_WAYLAND CACHE)
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @YobeZhou I am not quite well versed at CMake, I've copied what I found in the existing SDL simulator https://github.com/lvgl/lv_port_pc_vscode/blob/master/CMakeLists.txt
I usually rm -rf build
when I change options.
Makefile fixed: #53 |
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT | ||
#define LV_LINUX_FBDEV_BUFFER_COUNT 1 | ||
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL | ||
#define LV_LINUX_FBDEV_BUFFER_COUNT 0 | ||
#define LV_LINUX_FBDEV_BUFFER_SIZE 60 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LV_USE_WAYLAND
is missing from here.
Hello! Any updates on this PR? |
It seems it was forgotten. @etag4048 Will you have time to finalize it? |
@kisvegabor @anaGrad Will attempt to finish this week, I wanted to add wayland to the regular makefile too. |
Fantastic, thank you! 👍 |
Hi @etag4048 any progress with this PR? Thanks. |
@nicusorcitu my colleague @EDGEMTech-GabrielC is currently reviewing, testing as well as making adjustments. |
BTW the commit made 5h ago made changes to the Makefile, but the documentation states that it's currently broken..
Haven't tried to build with the makefile