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
This commit is contained in:
orbea 2019-06-01 19:06:07 -07:00
parent 66ba0db249
commit a9c9d0efc3

View File

@ -14,6 +14,7 @@
*/
#include <compat/strl.h>
#include <string/stdstring.h>
#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;
}