aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-01 18:05:31 +0200
committerSimon Ser <contact@emersion.fr>2022-10-01 18:05:31 +0200
commit49738406a383d859ffb7d37738556b3936cacf15 (patch)
treeed1961195e8a79a9cd57c60c3c05efcfad096f68 /render
parentdb08004c231d54a77def8d97480fcc174788827f (diff)
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
Diffstat (limited to 'render')
-rw-r--r--render/wlr_renderer.c10
1 files changed, 9 insertions, 1 deletions
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");