Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for wlr_drm_lease_v1 #2083

Merged
merged 4 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/wayfire/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/api/wayfire/nonstd/wlroots-full.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ extern "C"
#endif
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_drm_lease_v1.h>

// Input
#include <wlr/types/wlr_seat.h>
Expand Down
1 change: 1 addition & 0 deletions src/api/wayfire/nonstd/wlroots.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/core/core-impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_node_t> scene_root;

compositor_state_t state = compositor_state_t::UNKNOWN;
Expand Down
19 changes: 19 additions & 0 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,26 @@ 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<wlr_drm_lease_request_v1*>(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);
input_inhibit_activated.set_callback([&] (void*)
Expand Down
11 changes: 11 additions & 0 deletions src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,17 @@ 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))
{
Expand Down
Loading