Re-enable backend autoselection

This commit is contained in:
Drew DeVault 2017-08-12 19:55:40 -04:00
parent 234b2104e4
commit 60d1131df2
2 changed files with 62 additions and 63 deletions

View File

@ -7,10 +7,10 @@
#include <libinput.h> #include <libinput.h>
#include <wlr/backend/session.h> #include <wlr/backend/session.h>
#include <wlr/backend/interface.h> #include <wlr/backend/interface.h>
//#include <wlr/backend/drm.h> #include <wlr/backend/drm.h>
//#include <wlr/backend/libinput.h> #include <wlr/backend/libinput.h>
#include <wlr/backend/wayland.h> #include <wlr/backend/wayland.h>
//#include <wlr/backend/multi.h> #include <wlr/backend/multi.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/udev.h" #include "backend/udev.h"
@ -75,65 +75,60 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
return backend; return backend;
} }
} }
if (getenv("DISPLAY")) {
wlr_log(L_ERROR, "X11 backend is not implemented"); // TODO
return NULL; return NULL;
}
// if (getenv("DISPLAY")) { // Attempt DRM+libinput
// wlr_log(L_ERROR, "X11 backend is not implemented"); // TODO
// return NULL; struct wlr_session *session = wlr_session_start(display);
// } if (!session) {
// wlr_log(L_ERROR, "Failed to start a DRM session");
// // Attempt DRM+libinput return NULL;
// }
// struct wlr_session *session = wlr_session_start(display);
// if (!session) { struct wlr_udev *udev = wlr_udev_create(display);
// wlr_log(L_ERROR, "Failed to start a DRM session"); if (!udev) {
// return NULL; wlr_log(L_ERROR, "Failed to start udev");
// } goto error_session;
// }
// struct wlr_udev *udev = wlr_udev_create(display);
// if (!udev) { int gpu = wlr_udev_find_gpu(udev, session);
// wlr_log(L_ERROR, "Failed to start udev"); if (gpu == -1) {
// goto error_session; wlr_log(L_ERROR, "Failed to open DRM device");
// } goto error_udev;
// }
// int gpu = wlr_udev_find_gpu(udev, session);
// if (gpu == -1) { backend = wlr_multi_backend_create(session, udev);
// wlr_log(L_ERROR, "Failed to open DRM device"); if (!backend) {
// goto error_udev; goto error_gpu;
// } }
//
// backend = wlr_multi_backend_create(session, udev); struct wlr_backend *libinput = wlr_libinput_backend_create(display, session, udev);
// if (!backend) { if (!libinput) {
// goto error_gpu; goto error_multi;
// } }
//
// struct wlr_backend *libinput = wlr_libinput_backend_create(display, session, udev); struct wlr_backend *drm = wlr_drm_backend_create(display, session, udev, gpu);
// if (!libinput) { if (!drm) {
// goto error_multi; goto error_libinput;
// } }
//
// struct wlr_backend *drm = wlr_drm_backend_create(display, session, udev, gpu); wlr_multi_backend_add(backend, libinput);
// if (!drm) { wlr_multi_backend_add(backend, drm);
// goto error_libinput; return backend;
// }
// error_libinput:
// wlr_multi_backend_add(backend, libinput); wlr_backend_destroy(libinput);
// wlr_multi_backend_add(backend, drm); error_multi:
// return backend; wlr_backend_destroy(backend);
// error_gpu:
//error_libinput: wlr_session_close_file(session, gpu);
// wlr_backend_destroy(libinput); error_udev:
//error_multi: wlr_udev_destroy(udev);
// wlr_backend_destroy(backend); error_session:
//error_gpu: wlr_session_finish(session);
// wlr_session_close_file(session, gpu); return NULL;
//error_udev:
// wlr_udev_destroy(udev);
//error_session:
// wlr_session_finish(session);
// return NULL;
} }
//struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev) {
// return dev->state->handle;
//}

View File

@ -146,3 +146,7 @@ error_backend:
free(backend); free(backend);
return NULL; return NULL;
} }
struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev) {
return dev->state->handle;
}