-
Notifications
You must be signed in to change notification settings - Fork 167
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
Conversation
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 into 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.
CMakeLists.txt
Outdated
# 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 |
lv_conf.h
Outdated
#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. |
4b3f802
to
743a790
Compare
@nicusorcitu it should be working now, can you test please ? |
@anaGrad can you please verify? Thanks. |
I tested and on first run it looks great! |
Will it work also with LVGL master/v9.2 branch? can you please verify? |
Yes, works fine |
@etag4048 please resolve the conflict and we are good to go 🙂 |
Use external scripts to obtain the selected backend in lv_conf.h Generate wayland protocol via a shell script instead of CMake
Remove the step that tells to edit the CMakeLists.txt file and manually enable the option to select the backend
Solve merge conflit with the main branch
abe682d
to
b28dc67
Compare
@kisvegabor Ready. |
Thank you Erik. Pleas take a look at the CI, now all the test are failing. :( |
Thank you, Erik! Merging. |
@kisvegabor Fixed the CI... I am not familiar with the RHEL, oraclelinux and rocky linux. Not my style of distributions @debug-richard Could you help out and please tell me the name of the packages for wayland-scanner and wayland-client in those distributions? Before the CI I've never had issues compiling on Ubuntu 22.04, I am interested in what issues did you experience when you say you had a hard time building. |
@etag4048
Unfortunately, you forgot to enable the wayland build in the CI file which means the dependencies for the wayland build are currently missing. I fired up the Docker containers and these seem to be the required dependencies:
|
@debug-richard Thanks for the package names, at least on Ubuntu one can use |
@nicusorcitu I want to perform some small refactoring, like doing a separate file per backend. Improve the readme, to list the required dependencies for popular distros. Also integrating the backend selection to the GNU Makefile would be nice. |
Sure, any improvement is much appreciated :) |
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