FuriLabs / issue-tracker

FuriOS issue tracker
1 stars 0 forks source link

Kitty terminal emulator fails to start #5

Open psimovec opened 3 weeks ago

psimovec commented 3 weeks ago

Steps to reproduce: sudo apt install kitty && kitty

Seems like there is some openGL issue.

[0.802] [glfw error 65542]: EGL: No EGLConfigs returned
[0.802] [glfw error 65545]: EGL: Failed to find a suitable EGLConfig
[0.861] Traceback (most recent call last):
  File "/usr/bin/../lib/kitty/kitty/main.py", line 562, in main
    _main()
  File "/usr/bin/../lib/kitty/kitty/main.py", line 554, in _main
    run_app(opts, cli_opts, bad_lines)
  File "/usr/bin/../lib/kitty/kitty/main.py", line 297, in __call__
    _run_app(opts, args, bad_lines)
  File "/usr/bin/../lib/kitty/kitty/main.py", line 268, in _run_app
    window_id = create_os_window(
                ^^^^^^^^^^^^^^^^^
ValueError: Failed to create GLFWwindow
FakeShell commented 3 weeks ago

so the issue in reality is that phone GPUs don't support OpenGL, they support OpenGLES (GL embedded systems). this is a limitation with phones, thats what the Mali gpu (or any other arm64 gpu used in phones) supports (Android and IOS are all also GLES but their toolkits are built for GLES so this is transparent to them) usually toolkits provide 2 versions, one for GL, one for GLES. GTK (used in shell and most apps) has a GL renderer, and it has a GLES renderer which we use QT applications also have a GL version for the GUI library, and they have a GLES version looks like kitty which uses GLFW doesn't support GLES at all. one way to get around this is using GL4ES (which i have a custom branch which works on our device, will publish to my personal repository soon), but GL4ES is not very performant, it gives GL compatibility by translating calls, but it is also pretty slow If you really want to use that app, you can wait for me to release my version of GL4ES and use my (soon to be written) installation guide

psimovec commented 3 weeks ago

I see, that would kinda defeat some purpose of using GPU accellerated kitty, but it might be worth trying out of curiosity, I'll use some alternatives for now.

FakeShell commented 3 weeks ago

looks like glfw has support for gles but its not auto detected or enabled by default at all it can be forcefully enabled by exporting GLFW_CLIENT_API=GLFW_OPENGL_ES_API

psimovec commented 3 weeks ago

tried GLFW_CLIENT_API=GLFW_OPENGL_ES_API kitty or export GLFW_CLIENT_API=GLFW_OPENGL_ES_API; kitty and the error is the same. Do I need to install any requirements for this to work?

FakeShell commented 3 weeks ago

i tried it from a remote shell and it was fine ssh furios@10.15.19.82

DISPLAY=:0 GLFW_CLIENT_API=GLFW_OPENGL_ES_API kitty

and it ran fine i can look into how it can be integrated into the system so that this step is not required and glfw just works

psimovec commented 3 weeks ago

I tried to run it using ssh and that worked too, no success running it directly from the phone.

FakeShell commented 3 weeks ago

the issue is with WAYLAND_DISPLAY

unset WAYLAND_DISPLAY

forcing it to run in xwayland is a workaround for some reason on a wayland display it can't access egl configs

psimovec commented 2 weeks ago

that's weird, works for me after unsetting it

psimovec commented 2 weeks ago

So the workaround to be able to run it from desktop entry is:

cat /usr/share/applications/kitty.desktop | sed "s/^Exec=kitty/Exec=sh -c 'unset WAYLAND_DISPLAY; kitty'/" > ~/.local/share/applications/kitty.desktop

Perhaps the kitty package could be patched in similar way?

FakeShell commented 2 weeks ago

modifying the desktop file can work you can also open up kitty itself as its python and just del os.environ['WAYLAND_DISPLAY'] but the "right" solution is to figure out what is wrong with glfw3 when this is reached https://github.com/glfw/glfw/blob/master/src/platform.c#L95 and why eglconfig doesn't like GLFW_PLATFORM_WAYLAND