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
This commit is contained in:
Simon Ser 2022-10-01 18:05:31 +02:00
parent db08004c23
commit 49738406a3

View file

@ -314,7 +314,15 @@ struct wlr_renderer *renderer_autocreate_with_drm_fd(int drm_fd) {
} }
#endif #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(); renderer = wlr_pixman_renderer_create();
if (!renderer) { if (!renderer) {
log_creation_failure(is_auto, "Failed to create a pixman renderer"); log_creation_failure(is_auto, "Failed to create a pixman renderer");