diff options
author | Simon Ser <contact@emersion.fr> | 2023-08-23 15:55:25 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-10-06 09:10:31 +0000 |
commit | db7751f39ee58aff43ba9c63a70b4104ea7bed14 (patch) | |
tree | d9d7c6224079a5e03527a09abc03a96f14e2beda | |
parent | 86c30b87159b30663522405ef65f3a12134adb69 (diff) |
render: log error when requested renderer is compile-time disabled
It can be a bit confusing to debug when the user requests an
explicit renderer but it's disabled at build-time. Log an error
when that happens.
-rw-r--r-- | render/wlr_renderer.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index c4332ac0..d4043b43 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -366,12 +366,8 @@ static bool has_render_node(struct wlr_backend *backend) { static struct wlr_renderer *renderer_autocreate(struct wlr_backend *backend, int drm_fd) { const char *renderer_options[] = { "auto", -#if WLR_HAS_GLES2_RENDERER "gles2", -#endif -#if WLR_HAS_VULKAN_RENDERER "vulkan", -#endif "pixman", NULL }; @@ -381,14 +377,16 @@ static struct wlr_renderer *renderer_autocreate(struct wlr_backend *backend, int struct wlr_renderer *renderer = NULL; bool own_drm_fd = false; - (void)open_preferred_drm_fd; -#if WLR_HAS_GLES2_RENDERER - if (is_auto || strcmp(renderer_name, "gles2") == 0) { + if ((is_auto && WLR_HAS_GLES2_RENDERER) || strcmp(renderer_name, "gles2") == 0) { if (!open_preferred_drm_fd(backend, &drm_fd, &own_drm_fd)) { log_creation_failure(is_auto, "Cannot create GLES2 renderer: no DRM FD available"); } else { +#if WLR_HAS_GLES2_RENDERER renderer = wlr_gles2_renderer_create_with_drm_fd(drm_fd); +#else + wlr_log(WLR_ERROR, "Cannot create GLES renderer: disabled at compile-time"); +#endif if (renderer) { goto out; } else { @@ -396,14 +394,16 @@ static struct wlr_renderer *renderer_autocreate(struct wlr_backend *backend, int } } } -#endif -#if WLR_HAS_VULKAN_RENDERER if (strcmp(renderer_name, "vulkan") == 0) { if (!open_preferred_drm_fd(backend, &drm_fd, &own_drm_fd)) { log_creation_failure(is_auto, "Cannot create Vulkan renderer: no DRM FD available"); } else { +#if WLR_HAS_VULKAN_RENDERER renderer = wlr_vk_renderer_create_with_drm_fd(drm_fd); +#else + wlr_log(WLR_ERROR, "Cannot create Vulkan renderer: disabled at compile-time"); +#endif if (renderer) { goto out; } else { @@ -411,7 +411,6 @@ static struct wlr_renderer *renderer_autocreate(struct wlr_backend *backend, int } } } -#endif if ((is_auto && !has_render_node(backend)) || strcmp(renderer_name, "pixman") == 0) { renderer = wlr_pixman_renderer_create(); |