Skip to content
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

LVGL 8.3+wayland can't find wayland shell #311

Open
arilink opened this issue May 16, 2024 · 20 comments
Open

LVGL 8.3+wayland can't find wayland shell #311

arilink opened this issue May 16, 2024 · 20 comments

Comments

@arilink
Copy link

arilink commented May 16, 2024

weston version:10.0.0
LVGL version:8.3.0
LVGL driver 8.3.0

I tried to run LVGL on the rk3568 platform. The macro definition enables wayland and XDG shell, but the segment err is prompted when lvgl demo is run, so I further debug the problem that lvgl cannot find wayland shell. But my qt program can work normally, what could be the problem?

image

@arilink
Copy link
Author

arilink commented May 16, 2024

image

@arilink
Copy link
Author

arilink commented May 16, 2024

After searching the problem step by step, I found that weston10 did not have wl_shell interface, instead of xdg_shell, so I opened the macro definition of XDG_SHELL, searched the header file and lib again, and compiled and ran it. At this time, the following error occurred, I do not know how to solve it

@arilink
Copy link
Author

arilink commented May 16, 2024

image

@kisvegabor
Copy link
Member

@daniel-rossier it might be useful for the LVGL v9 Wayland driver.

@daniel-rossier
Copy link

Thanks Gábor! Indeed, it may help; I forward the info to @etag4048 who is nearly ready to submit a PR with the support of LVLG 9 in wayland.

@arilink
Copy link
Author

arilink commented May 21, 2024

So the lvgl v9 doesn't have this problem?

@etag4048
Copy link
Contributor

@arilink Did you update the lv_drv_conf.h and set LV_WAYLAND_XDG_SHELL to 1 ? Support for wl-shell has been deprecated for 3 years, it has been dropped in Weston 10.x

@arilink
Copy link
Author

arilink commented May 23, 2024

@etag4048 Yes, I have set LV_WAYLAND_XDG_SHELL to 1 but it still won't display properly, this picture is USE LV_WAYLAND_XDG_SHELL
Uploading image.png…

@etag4048
Copy link
Contributor

etag4048 commented May 24, 2024

@arilink Looking at the screenshots more carefully, there is something abnormal in the wayland debug logs. It seems like create_window is called two times since [email protected]_title is present two times, are you calling lv_wayland_create_window multiple times ?

At it's core this problem is caused by a race condition that is apparent on some weston configurations. The buffer is attached to the surface before weston sends the configure event. Upon the configure event xdg_surface_handle_configure is called where the surface_configured flag is set. Instead, in your case the surface_configured is set in create_graphic_obj and when LVGL calls the flush cb _lv_wayland_flush on line 1992 the buffer gets attached too early..

Try commenting out the line 1411 obj->surface_configured = true;
Add wl_display_dispatch(application.display); in create_window right after wl_surface_commit(window->body->surface); on line 1800.

Also check why [email protected]_title is present two times.

Please avoid screenshots, you can capture the wayland logs like so ./your_app 2>/tmp/wayland_debug and then paste the logs it makes life easy :)

@arilink
Copy link
Author

arilink commented May 24, 2024

@etag4048 I only called lv_wayland_create_window once in main.c file. You mean that surface was not fully configured when flush cb was used, so this problem occurred, right? I uploaded wayland.c, could you please help me adjust the code, because the code line number you described seems to be inconsistent with mine
wayland.zip

@etag4048
Copy link
Contributor

etag4048 commented May 24, 2024

@arilink It looks like lvgl drivers on the rk3568 are outdated, please apply the patch c8d483f this issue has been fixed in commit c8d483f by previous contributors. Another solution could be to update to release/v8.3 the above answer is applicable on 8cdabe8 you have to checkout the correct branch to be on version 8.3. Also weston 10 is not the most up date version.

@arilink
Copy link
Author

arilink commented May 24, 2024

OK. I will try release/v8.3

@arilink
Copy link
Author

arilink commented May 28, 2024

@etag4048
After replacing the Driver of release/v8.3, lvgl can display normally, but there will be other problems, as follows
1.RK3568 hardware supports multi-screen display, so does weston. I plan to use HDMI as the main display, run Qt app, and DSI as the secondary display to display lvgl app
2. I start the Qt app first, and once I run lvgl->demo qt app the app screen disappears
3. In the/etc/XDG/weston/weston. Ini. I configured two outputs and corresponding app ids
Where could this be a problem?

@arilink
Copy link
Author

arilink commented May 28, 2024

lvgl app start log is blow:
root@ATK-DLRK356X:~# /opt/lvgl/lvgl-wayland2
[ 854435.514] -> [email protected]_registry(new id wl_registry@2)
[ 854435.711] [email protected]_registry(new id wl_registry@2)
[ 854435.773] -> [email protected](1, "wl_compositor", 4)
[ 854435.824] -> [email protected](2, "wl_subcompositor", 1)
[ 854435.848] -> [email protected](3, "wp_viewporter", 1)
[ 854435.870] -> [email protected](4, "zxdg_output_manager_v1", 2)
[ 854435.894] -> [email protected](5, "wp_presentation", 1)
[ 854435.917] -> [email protected](6, "zwp_relative_pointer_manager_v1", 1)
[ 854435.940] -> [email protected](7, "zwp_pointer_constraints_v1", 1)
[ 854435.962] -> [email protected](8, "zwp_input_timestamps_manager_v1", 1)
[ 854435.987] -> [email protected](9, "wl_data_device_manager", 3)
[ 854436.009] -> [email protected](10, "wl_shm", 1)
[ 854436.034] -> [email protected](11, "mali_buffer_sharing", 4)
[ 854436.058] -> [email protected](12, "wl_seat", 7)
[ 854436.081] -> [email protected](13, "zwp_linux_dmabuf_v1", 3)
[ 854436.103] -> [email protected](14, "weston_direct_display_v1", 1)
[ 854436.125] -> [email protected](15, "wl_output", 3)
[ 854436.148] -> [email protected](16, "wl_output", 3)
[ 854436.172] -> [email protected](17, "xdg_wm_base", 3)
[ 854436.195] -> [email protected](18, "weston_screenshooter", 1)
[ 854436.342] [email protected](1, "wl_compositor", 4)
[ 854436.403] -> [email protected](1, "wl_compositor", 1, new id [unknown]@3)
[ 854436.447] [email protected](2, "wl_subcompositor", 1)
[ 854436.511] -> [email protected](2, "wl_subcompositor", 1, new id [unknown]@4)
[ 854436.548] [email protected](3, "wp_viewporter", 1)
[ 854436.604] [email protected](4, "zxdg_output_manager_v1", 2)
[ 854436.647] [email protected](5, "wp_presentation", 1)
[ 854436.699] [email protected](6, "zwp_relative_pointer_manager_v1", 1)
[ 854436.741] [email protected](7, "zwp_pointer_constraints_v1", 1)
[ 854436.771] [email protected](8, "zwp_input_timestamps_manager_v1", 1)
[ 854436.799] [email protected](9, "wl_data_device_manager", 3)
[ 854436.856] [email protected](10, "wl_shm", 1)
[ 854436.919] -> [email protected](10, "wl_shm", 1, new id [unknown]@5)
[ 854437.105] -> [email protected]_pool(new id wl_shm_pool@6, fd 5, 4096)
[ 854437.881] -> [email protected](8832)
[ 854438.011] -> [email protected](18624)
[ 854438.077] [email protected](11, "mali_buffer_sharing", 4)
[ 854438.139] [email protected](12, "wl_seat", 7)
[ 854438.188] -> [email protected](12, "wl_seat", 1, new id [unknown]@7)
[ 854438.263] [email protected](13, "zwp_linux_dmabuf_v1", 3)
[ 854438.317] [email protected](14, "weston_direct_display_v1", 1)
[ 854438.361] [email protected](15, "wl_output", 3)
[ 854438.412] [email protected](16, "wl_output", 3)
[ 854438.461] [email protected](17, "xdg_wm_base", 3)
[ 854438.501] -> [email protected](17, "xdg_wm_base", 3, new id [unknown]@8)
[ 854438.575] [email protected](18, "weston_screenshooter", 1)
[ 854438.620] -> [email protected](new id wl_callback@9)
[ 854438.757] [email protected](1, "wl_compositor", 1, new id [unknown]@3)
[ 854438.888] [email protected](2, "wl_subcompositor", 1, new id [unknown]@4)
[ 854438.955] [email protected](10, "wl_shm", 1, new id [unknown]@5)
[ 854438.997] -> [email protected](0)
[ 854439.026] -> [email protected](1)
[ 854439.048] -> [email protected](909199186)
[ 854439.084] -> [email protected](842093913)
[ 854439.105] -> [email protected](842094158)
[ 854439.118] -> [email protected](909203022)
[ 854439.130] -> [email protected](1448695129)
[ 854439.159] -> [email protected](1448434008)
[ 854439.194] -> [email protected](808665665)
[ 854439.221] -> [email protected](808665688)
[ 854439.244] [email protected]_pool(new id wl_shm_pool@6, fd 48, 4096)
[ 854439.373] [email protected](8832)
[ 854439.436] [email protected](18624)
[ 854439.483] [email protected](12, "wl_seat", 1, new id [unknown]@7)
[ 854439.573] -> [email protected](6)
[ 854439.608] [email protected](17, "xdg_wm_base", 3, new id [unknown]@8)
[ 854439.700] [email protected](new id wl_callback@9)
[ 854439.725] -> [email protected](4)
[ 854439.752] -> [email protected]_id(9)
[ 854439.866] [email protected]_id(9)
[ 854439.915] [email protected](0)
[ 854439.942] [email protected](1)
[ 854439.973] [email protected](909199186)
[ 854440.002] [email protected](842093913)
[ 854440.020] [email protected](842094158)
[ 854440.033] [email protected](909203022)
[ 854440.057] [email protected](1448695129)
[ 854440.073] [email protected](1448434008)
[ 854440.102] [email protected](808665665)
[ 854440.120] [email protected](808665688)
[ 854440.132] [email protected](6)
[ 854440.157] -> [email protected]_keyboard(new id wl_keyboard@10)
[ 854440.192] -> [email protected]_touch(new id wl_touch@11)
[ 854440.217] [email protected](4)
[ 854440.350] -> [email protected]_surface(new id wl_surface@9)
[ 854440.398] -> [email protected]_xdg_surface(new id xdg_surface@12, wl_surface@9)
[ 854440.453] -> [email protected]_toplevel(new id xdg_toplevel@13)
[ 854440.490] -> [email protected]_title("Window Title")
[ 854440.519] -> [email protected]_app_id("Window Title")
[ 854440.547] -> [email protected]()
[ 854440.616] -> [email protected]_pool(new id wl_shm_pool@14, fd 6, 1536000)
[ 854440.691] -> [email protected]_buffer(new id wl_buffer@15, 0, 800, 480, 3200, 0)
[ 854462.682] -> [email protected](0, 0, 800, 480)
[ 854462.948] [email protected]_keyboard(new id wl_keyboard@10)
[ 854463.240] -> [email protected](1, fd 51, 48967)
[ 854463.337] [email protected]_touch(new id wl_touch@11)
[ 854463.385] [email protected]_surface(new id wl_surface@9)
[ 854463.436] [email protected]_xdg_surface(new id xdg_surface@12, wl_surface@9)
[ 854463.495] [email protected]_toplevel(new id xdg_toplevel@13)
[ 854463.543] [email protected]_title("Window Title")
[ 854463.583] [email protected]_app_id("Window Title")
[ 854463.617] [email protected]()
[ 854463.679] [email protected]_pool(new id wl_shm_pool@14, fd 49, 1536000)
[ 854463.780] [email protected]_buffer(new id wl_buffer@15, 0, 800, 480, 3200, 0)
[ 854463.849] [email protected](0, 0, 800, 480)
[ 854463.908] -> [email protected](720, 1280, array[4])
[ 854463.948] -> [email protected](5)
[ 854468.038] [email protected](1, fd 6, 48967)
[ 854478.215] [email protected](720, 1280, array[4])
[ 854478.301] [email protected](5)
[ 854478.320] -> [email protected]_configure(5)
[ 854478.339] -> [email protected](wl_buffer@15, 0, 0)
[ 854478.386] -> [email protected]()
[ 854478.531] [email protected]_configure(5)
[ 854478.604] [email protected](wl_buffer@15, 0, 0)
[ 854478.686] [email protected]()
[13:39:11.613] xdg_surface geometry (800 x 480) is larger than the configured fullscreen state (720 x 1280)[ 854481.880] -> [email protected](6, wl_surface@21)
[ 854481.953] -> [email protected](7, wl_surface@9, array[0])
[ 854482.028] -> [email protected](7, 0, 0, 0, 0)
[ 854482.129] -> [email protected](720, 1280, array[8])
[ 854482.201] -> [email protected](8)
[ 854482.238] -> [email protected](1920, 1080, array[4])
[ 854482.287] -> [email protected](9)
[ 854499.026] [email protected](7, wl_surface@9, array[0])
[ 854499.145] [email protected](7, 0, 0, 0, 0)
[ 854499.257] [email protected](720, 1280, array[8])
[ 854499.292] [email protected](8)
[ 854499.310] -> [email protected]_configure(8)
[ 854503.715] [email protected](new id wl_callback@31)
[ 854503.778] -> [email protected](9)
[ 854503.810] -> [email protected]_id(31)
[ 854503.836] [email protected]_window_geometry(0, 0, 1920, 1080)
[ 854503.915] [email protected]_min_size(0, 0)
[ 854503.958] [email protected]_max_size(0, 0)
[ 854504.033] [email protected]_configure(9)
[ 854504.052] [email protected](new id wl_callback@30)
[ 854506.571] -> [email protected]()
[ 854515.834] [email protected](new id wl_callback@31)
[ 854515.899] -> [email protected](9)
[ 854515.948] -> [email protected]_id(31)
[ 854515.974] [email protected](wl_buffer@29, 0, 0)
[ 854516.012] [email protected](0, 0, 2147483647, 2147483647)
[ 854516.073] [email protected]()
[ 854516.128] -> [email protected]()
[ 854518.033] -> [email protected](554926)
[ 854518.080] -> [email protected]_id(30)
[ 854519.945] [email protected]()
[ 854519.988] -> [email protected]()
[ 854520.170] -> [email protected](3686400)
[ 854520.235] -> [email protected]_buffer(new id wl_buffer@16, 0, 720, 1280, 2880, 0)
[ 854531.068] [email protected]_configure(8)
[ 854531.194] [email protected]()
[ 854531.258] -> [email protected]_id(15)
[ 854531.365] [email protected](3686400)
[ 854531.644] [email protected]_buffer(new id wl_buffer@16, 0, 720, 1280, 2880, 0)
[ 854538.898] -> [email protected](0, 0, 720, 533)
[ 854541.451] -> [email protected](0, 533, 720, 533)
[ 854542.765] -> [email protected](0, 1066, 720, 214)
[ 854542.897] -> [email protected](wl_buffer@16, 0, 0)
[ 854542.992] -> [email protected]()
[ 854543.162] [email protected](0, 0, 720, 533)
[ 854543.522] [email protected](0, 533, 720, 533)
[ 854543.784] [email protected](0, 1066, 720, 214)
[ 854543.906] [email protected](wl_buffer@16, 0, 0)
[ 854544.304] [email protected]()
[ 854555.626] -> [email protected]()
[ 854564.729] [email protected]_id(15)
[ 854564.796] [email protected]()
[ 854570.256] -> [email protected](572, 185, 110, 46)
[ 854570.332] -> [email protected](wl_buffer@16, 0, 0)
[ 854570.414] -> [email protected]()
[ 854570.565] [email protected](572, 185, 110, 46)
[ 854570.666] [email protected](wl_buffer@16, 0, 0)
[ 854570.718] [email protected]()
[ 854572.269] -> [email protected]()
[ 854581.056] [email protected]()
[ 854591.880] -> [email protected](572, 185, 110, 46)
[ 854591.984] -> [email protected](wl_buffer@16, 0, 0)
[ 854592.079] -> [email protected]()
[ 854592.232] [email protected](572, 185, 110, 46)
[ 854592.379] [email protected](wl_buffer@16, 0, 0)
[ 854592.439] [email protected]()
[ 854594.091] -> [email protected]()
[ 854602.975] [email protected]()
[ 903844.951] [email protected](new id wl_callback@30)
[ 903854.355] [email protected](new id wl_callback@31)
[ 903854.540] -> [email protected](9)
[ 903854.729] -> [email protected]_id(31)
[ 903854.841] [email protected](wl_buffer@27, 0, 0)
[ 903855.158] [email protected](0, 0, 2147483647, 2147483647)
[ 903855.737] [email protected]()
[ 903856.043] -> [email protected]()
[ 903862.831] -> [email protected](604276)
[ 903862.941] -> [email protected]_id(30)

@arilink
Copy link
Author

arilink commented May 29, 2024

I think this problem is about window geometry

@etag4048
Copy link
Contributor

etag4048 commented May 29, 2024

@arilink Yes it is indeed, this is a different problem that is also apparent when running older versions of the wayland driver on weston.. The flush occurs before the buffers are resized.

It looks like weston runs the application in fullscreen right at the beginning. Upon the configure event the compositor communicates the size it wants the client app to have:

[ 854478.215] [[email protected]] [email protected](720, 1280, array[4])

In this case 720*1280

As a workaround, try passing these values to the lv_wayland_create_window function in your main.c file so that it matches the expectations of weston

This issue is fixed in the opened PR.

BR

@arilink
Copy link
Author

arilink commented May 31, 2024

@etag4048
I found a way to do it, which is as follows:
1.lvgl seems to prefer to display on the main display
2. I designated DSI as the primary monitor and HDMI as the secondary monitor
3. Run Qt program on the secondary monitor Qt can be specified by set_geometry on HDMI display
4. Run lvgl's demo on the main display
5. It seems to be working well and there is no tear. The photos are as follows:
img_v3_02bc_6e3db5b0-e63b-43b9-a2f2-4c39677dadbg

In theory, lvgl should call xdg_surface_set_window_geometry to specify the display location, but when I try, I'm told that xdg_surface must have a role. I think this is related to the way I call, could you please help confirm the correct calling method, the specific log is as follows:
[13:45:23.809] libwayland: error in client communication (pid 3277)
xdg_surface@12: error 1: xdg_surface must have a role

@etag4048
Copy link
Contributor

etag4048 commented Jun 1, 2024

@arilink
A xdg surface can have a top-level role or popup role.
Before sending any request related to a surface the role needs to be set, the get_xdg_surface request assigns the top-level role to a wl_surface, So you need to 'paste' the function after get_xdg_surface in create_window.

However, sending a xdg_surface_set_window_geometry request to weston, won't solve this issue. The book on wayland explains the purpose of this request better than the official spec https://wayland-book.com/xdg-shell-basics/xdg-surface.html

' ...is used primarily for applications using client-side decorations, to distinguish the parts of their surface which are considered a part of the window, and the parts which are not. Most commonly, this is used to exclude client-side drop-shadows rendered behind the window from being considered a part of it.'

There are no decorations and no windowing in the above screenshot, both apps are running in full screen.

The proper solution to this is to resize the underlining SHM buffers before the first flush occurs.

BR

@arilink
Copy link
Author

arilink commented Jun 3, 2024

@etag4048
As you said, set_window_geometry doesn't work. How do I resize the shm?

@etag4048
Copy link
Contributor

etag4048 commented Jun 3, 2024

@arilink You can attempt to backport 092610c to release/v8.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants