Skip to content

Commit

Permalink
nix/profiles/kiosk: force gles to fix hardware acceleration
Browse files Browse the repository at this point in the history
Running with GDK_DEBUG=opengl revealed it fails to create an EGL
context, probably due to the small GL version (<3.0) supported by Mesa
for this hardware:

```
Dec 21 23:35:16 fossbeamer cage[7386]: OpenGL vendor string: Broadcom
Dec 21 23:35:16 fossbeamer cage[7386]: OpenGL renderer string: VC4 V3D 2.1
Dec 21 23:35:16 fossbeamer cage[7386]: OpenGL version string: 2.1 Mesa 24.2.6
Dec 21 23:35:16 fossbeamer cage[7386]: OpenGL shading language version string: 1.20
```

```
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: EGL API version 1.4 found
                                                   - Vendor: Mesa Project
                                                   - Version: 1.4
                                                   - Client APIs: OpenGL OpenGL_ES
                                                   - Extensions:
                                                  	EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_present_opaque EGL_EXT_surface_compression EGL_EXT_swap_buffers_with_damage EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display EGL_WL_create_wayland_buffer_from_image
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: eglCreateContext failed, switching to legacy
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: eglCreateContext failed, switching to legacy
Dec 21 23:42:24 fossbeamer .fossbeamer-wra[8444]: Disabled hardware acceleration because GTK failed to initialize GL: Unable to create a GL context.
```

https://gitlab.gnome.org/GNOME/gtk/-/issues/2619 seems to be our
problem.

There's an open MR causing gtk3 to automatically fall back to GLES 2.0
after GL 3.0 fails, but it's been open for a year:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6449

Set GDK_GL=gles for now, which seems to get us hardware acceleration, at
least I was able to run some of the WebGL demos from webglsamples.org
with fps suggesting there's some hardware rendering involved now.

Accessing webkit://gpu in fossbeamer also now shows some GL support.
  • Loading branch information
flokli committed Dec 22, 2024
1 parent 0ea1f9b commit 8051b69
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nix/profiles/kiosk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
${pkgs.fossbeamer}/bin/fossbeamer --default-config=${../../default-config.json} https://wip.bar
'';
environment = {
GDK_GL = "gles";
GDK_DEBUG = "vulkan,opengl,dmabuf";
LIBGL_DEBUG = "verbose";
RUST_LOG = "debug";
};
Expand Down

0 comments on commit 8051b69

Please sign in to comment.