From 49738406a383d859ffb7d37738556b3936cacf15 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 1 Oct 2022 18:05:31 +0200 Subject: [PATCH] render: don't fall back to Pixman if we have a render node If we have a render node, it means there is a GPU which could be used. We probably failed GL because of a kernel or Mesa issue. Instead of automatically falling back to Pixman, error out. This makes it more obvious to users when something goes wrong, instead of silently exposing a slow unaccelerated desktop. References: https://github.com/swaywm/sway/issues/7194 --- render/wlr_renderer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 931b07bf..55a5d989 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -314,7 +314,15 @@ struct wlr_renderer *renderer_autocreate_with_drm_fd(int drm_fd) { } #endif - if (!renderer && (is_auto || strcmp(renderer_name, "pixman") == 0)) { + bool has_render_node = false; + if (!renderer && is_auto && drm_fd >= 0) { + char *render_node = drmGetRenderDeviceNameFromFd(drm_fd); + has_render_node = render_node != NULL; + free(render_node); + } + + if (!renderer && ((is_auto && !has_render_node) || + strcmp(renderer_name, "pixman") == 0)) { renderer = wlr_pixman_renderer_create(); if (!renderer) { log_creation_failure(is_auto, "Failed to create a pixman renderer");