From a9c9d0efc3e9ed3f8e3119db42a73a419a83e0a3 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 1 Jun 2019 19:06:07 -0700 Subject: [PATCH] Try using the udev or linuxraw input drivers for khr_display. When using vulkan with a khr_display context while the x input driver is set RA will fail to start. This changes it to try setting the udev and then linuxraw input drivers in such cases. This code is copied from gfx/drivers_context/drm_ctx.c --- gfx/drivers_context/khr_display_ctx.c | 36 ++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/gfx/drivers_context/khr_display_ctx.c b/gfx/drivers_context/khr_display_ctx.c index 7967b6de86..28c4eb5270 100644 --- a/gfx/drivers_context/khr_display_ctx.c +++ b/gfx/drivers_context/khr_display_ctx.c @@ -14,6 +14,7 @@ */ #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -154,9 +155,42 @@ error: } static void gfx_ctx_khr_display_input_driver(void *data, - const char *name, + const char *joypad_name, const input_driver_t **input, void **input_data) { +#ifdef HAVE_X11 + settings_t *settings = config_get_ptr(); + + /* We cannot use the X11 input driver for DRM/KMS */ + if (string_is_equal(settings->arrays.input_driver, "x")) + { +#ifdef HAVE_UDEV + { + /* Try to set it to udev instead */ + void *udev = input_udev.init(joypad_name); + if (udev) + { + *input = &input_udev; + *input_data = udev; + return; + } + } +#endif +#if defined(__linux__) && !defined(ANDROID) + { + /* Try to set it to linuxraw instead */ + void *linuxraw = input_linuxraw.init(joypad_name); + if (linuxraw) + { + *input = &input_linuxraw; + *input_data = linuxraw; + return; + } + } +#endif + } +#endif + *input = NULL; *input_data = NULL; }