#include "egl_dri2.h"
#include "egl_dri2_fallbacks.h"
#include "loader.h"
+#include "util/debug.h"
static __DRIimage*
surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
};
static bool
-surfaceless_probe_device(_EGLDisplay *dpy)
+surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
{
struct dri2_egl_display *dri2_dpy = dpy->DriverData;
const int limit = 64;
if (fd < 0)
continue;
- dri2_dpy->driver_name = loader_get_driver_for_fd(fd);
+ if (swrast)
+ dri2_dpy->driver_name = strdup("kms_swrast");
+ else
+ dri2_dpy->driver_name = loader_get_driver_for_fd(fd);
if (!dri2_dpy->driver_name) {
close(fd);
continue;
{
struct dri2_egl_display *dri2_dpy;
const char* err;
- int driver_loaded = 0;
+ bool driver_loaded = false;
loader_set_logger(_eglLog);
dri2_dpy->fd = -1;
disp->DriverData = (void *) dri2_dpy;
- if (!surfaceless_probe_device(disp)) {
+
+ if (!env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) {
+ driver_loaded = surfaceless_probe_device(disp, false);
+ if (!driver_loaded)
+ _eglLog(_EGL_WARNING,
+ "No hardware driver found, falling back to software rendering");
+ }
+
+ if (!driver_loaded && !surfaceless_probe_device(disp, true)) {
err = "DRI2: failed to load driver";
goto cleanup;
}