swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.72k stars 1.11k forks source link

Sway doesn't refresh screen on e-ink touch screen #7035

Open bjesus opened 2 years ago

bjesus commented 2 years ago

I'm working on a Sway-based desktop environment for e-readers, and currently running it on my e-reader, Kobo Clara HD with PostmarketOS. While X.Org WMs work just fine, Sway shows some very weird behavior when it comes to refreshing the screen. Simply put, it seems like changes are not displayed on the screen until I manually force the screen to refresh, usually by tapping it. For example, I can start some application, and only parts of it (or nothing at all) will show, until I tap the screen. I can then kill the app, and it will stay displayed until I touch the screen.

I can "force" a refresh without tapping the screen by changing some parameters of the output (e.g. swaymsg -s output Unknown-1 max_render_time 1), so it is clearly not related to the touch itself - I just need to force Sway to refresh. Also, the clock on the top right gets updated all the time without issues. When starting Sway, the top bar appears normally but the background doesn't appear until I tap the screen.

Here's a video the shows exactly how the issue looks like - my laptop on the left is connected via SSH: https://host.yoavmoshe.com/store/video.mp4

I do not know if this is an issue with Sway, wlroots or Wayland - but I'm assuming it's possible that this isn't a Sway issue actually.

puffnfresh commented 2 years ago

I can reproduce this but I'm using the same kernel and same device. I'm using NixOS so it's slightly different versions of everything else. It's not a sway specific issue since it happens for almost every wlroots based project.

The one exception I've found is dwl, which seems to work perfectly but touch doesn't work and it's missing a lot of Wayland protocols so it's not a viable option for me.

I'm not sure what dwl does differently to all the other wlroots projects. It would be good to identify.

hmpthcs commented 1 year ago

Same issue for me with a different kernel and device: sway + arch on my Pinenote. I am even seeing the same cyttsp5 error. Not sure either what that implies with respect to the refresh glitch. Though I will say my case has not been quite as severe as the posted video above.

Could it be a faulty interaction between the compositor and the display driver? E-ink screens require multiple refresh cycles for the pixels to change to their target state--it almost looks like the compositor is assuming prematurely that it's work is done.

Then again, I've noticed the behavior as well that a small tap producing a minor change on the output suddenly triggers a proper full refresh, almost like the refresh was withheld and then released in response to touch input. Odd.

Edit: considering @puffnfresh 's comment on dwl working great but not having touch support, I really do suspect this has something to do with the touch input.

bl4ckb0ne commented 1 year ago
00:00:00.013 [INFO] [wlr] [render/egl.c:180] Supported EGL client extensions: EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
00:00:00.016 [ERROR] [wlr] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
00:00:00.016 [ERROR] [wlr] [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
00:00:00.017 [DEBUG] [wlr] [render/egl.c:458] DRM device '/dev/dri/card0' has no render node, falling back to primary node
MESA-LOADER: failed to open mxc_epdc: Error loading shared library /usr/lib/xorg/modules/dri/mxc_epdc_dri.so: No such file or directory (search paths /usr/lib/xorg/modules/dri, suffix _dri)
failed to load driver: mxc_epdc
00:00:00.327 [ERROR] [wlr] [render/egl.c:291] Software rendering detected, please use the WLR_RENDERER_ALLOW_SOFTWARE environment variable to proceed
00:00:00.328 [ERROR] [wlr] [render/egl.c:521] Failed to initialize EGL context
00:00:00.328 [ERROR] [wlr] [EGL] command: eglMakeCurrent, error: EGL_NOT_INITIALIZED (0x3001), message: "eglMakeCurrent"
00:00:00.328 [ERROR] [wlr] [render/gles2/renderer.c:698] Could not initialize EGL
00:00:00.328 [DEBUG] [wlr] [render/wlr_renderer.c:303] Failed to create GLES2 renderer
00:00:00.328 [INFO] [wlr] [render/pixman/renderer.c:521] Creating pixman renderer

Maybe a pixman rendering issue, have you tried sway 1.8?

stacyharper commented 1 year ago

This still happen with sway 1.8.1, and with sway and wlroots master.

Emru1 commented 3 months ago

does it still occur?

bjesus commented 2 months ago

I just tested with Sway 1.9 - yes, the issue is still here. It seems to behave slightly different, perhaps a bit better, but 90% of the times the screen doesn't refresh until I touch it.

Nefsen402 commented 2 months ago

FWIW, sway 1.10 (or master currently) has rewritten all the rendering logic. The issue might have been fixed, but I kind of doubt it considering the behavior of a bug (maybe a weird interaction between sway/wlroots and the KMS driver)