diff --git a/src/api/wayfire/core.hpp b/src/api/wayfire/core.hpp index 911d8651c..1dd7103ee 100644 --- a/src/api/wayfire/core.hpp +++ b/src/api/wayfire/core.hpp @@ -139,6 +139,7 @@ class compositor_core_t : public wf::object_base_t, public signal::provider_t wlr_presentation *presentation; wlr_primary_selection_v1_device_manager *primary_selection_v1; wlr_viewporter *viewporter; + wlr_drm_lease_v1_manager *drm_v1; wlr_xdg_foreign_registry *foreign_registry; wlr_xdg_foreign_v1 *foreign_v1; diff --git a/src/api/wayfire/nonstd/wlroots-full.hpp b/src/api/wayfire/nonstd/wlroots-full.hpp index 357512977..ca309fb8b 100644 --- a/src/api/wayfire/nonstd/wlroots-full.hpp +++ b/src/api/wayfire/nonstd/wlroots-full.hpp @@ -101,6 +101,7 @@ extern "C" #endif #include #include +#include // Input #include diff --git a/src/api/wayfire/nonstd/wlroots.hpp b/src/api/wayfire/nonstd/wlroots.hpp index 7c9c7fbeb..e44aeb670 100644 --- a/src/api/wayfire/nonstd/wlroots.hpp +++ b/src/api/wayfire/nonstd/wlroots.hpp @@ -37,6 +37,7 @@ extern "C" struct wlr_text_input_manager_v3; struct wlr_presentation; struct wlr_primary_selection_v1_device_manager; + struct wlr_drm_lease_v1_manager; struct wlr_xdg_foreign_v1; struct wlr_xdg_foreign_v2; diff --git a/src/core/core-impl.hpp b/src/core/core-impl.hpp index 004b7e779..69658d892 100644 --- a/src/core/core-impl.hpp +++ b/src/core/core-impl.hpp @@ -76,6 +76,7 @@ class compositor_core_impl_t : public compositor_core_t wf::wl_listener_wrapper input_inhibit_deactivated; wf::wl_listener_wrapper pointer_constraint_added; wf::wl_listener_wrapper idle_inhibitor_created; + wf::wl_listener_wrapper drm_lease_request; std::shared_ptr scene_root; compositor_state_t state = compositor_state_t::UNKNOWN; diff --git a/src/core/core.cpp b/src/core/core.cpp index a02dfbfa8..0e557456c 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -117,6 +117,23 @@ void wf::compositor_core_impl_t::init() protocols.export_dmabuf = wlr_export_dmabuf_manager_v1_create(display); protocols.output_manager = wlr_xdg_output_manager_v1_create(display, output_layout->get_handle()); + protocols.drm_v1 = wlr_drm_lease_v1_manager_create(display, backend); + drm_lease_request.set_callback([&] (void *data) + { + auto req = static_cast(data); + struct wlr_drm_lease_v1 *lease = wlr_drm_lease_request_v1_grant(req); + if (!lease) + { + wlr_drm_lease_request_v1_reject(req); + } + }); + if (protocols.drm_v1) + { + drm_lease_request.connect(&protocols.drm_v1->events.request); + } else + { + LOGE("Failed to create wlr_drm_lease_device_v1; VR will not be available!"); + } /* input-inhibit setup */ protocols.input_inhibit = wlr_input_inhibit_manager_create(display); diff --git a/src/core/output-layout.cpp b/src/core/output-layout.cpp index b556f5be3..4afa5a7ae 100644 --- a/src/core/output-layout.cpp +++ b/src/core/output-layout.cpp @@ -1083,6 +1083,18 @@ class output_layout_t::impl LOGI("new output: ", output->name, " (\"", output->make, " ", output->model, " ", output->serial, "\")"); + if (output->non_desktop) + { + LOGD("Non-desktop output ", output->name, " found"); + if (get_core().protocols.drm_v1) + { + LOGD("Drm lease offered to ", output->name); + wlr_drm_lease_v1_manager_offer_output(get_core().protocols.drm_v1, output); + } + + return; + } + if (!wlr_output_init_render(output, get_core().allocator, get_core().renderer)) {