Skip to content

Commit

Permalink
core: Add legacy wayland drm option (#2485)
Browse files Browse the repository at this point in the history
This can be used to work around broken drivers that accelerate the desktop
but not the wayland clients.
  • Loading branch information
soreau authored Oct 4, 2024
1 parent 6796b08 commit d5b0d27
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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 @@ -84,6 +84,7 @@ extern "C"
#define static
#include <wlr/backend.h>
#include <wlr/backend/drm.h>
#include <wlr/types/wlr_drm.h>
#if WLR_HAS_X11_BACKEND
#include <wlr/backend/x11.h>
#endif
Expand Down
7 changes: 7 additions & 0 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ void wf::compositor_core_impl_t::init()
/* Needed for subsurfaces */
wlr_subcompositor_create(display);

/* Legacy DRM */
if (runtime_config.legacy_wl_drm &&
wlr_renderer_get_dmabuf_texture_formats(renderer))
{
wlr_drm_create(display, renderer);
}

protocols.data_device = wlr_data_device_manager_create(display);
protocols.primary_selection_v1 =
wlr_primary_selection_v1_device_manager_create(display);
Expand Down
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ int main(int argc, char *argv[])
{"debug", optional_argument, NULL, 'd'},
{"damage-debug", no_argument, NULL, 'D'},
{"damage-rerender", no_argument, NULL, 'R'},
{"legacy-wl-drm", no_argument, NULL, 'l'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{0, 0, NULL, 0}
Expand All @@ -282,7 +283,7 @@ int main(int argc, char *argv[])
std::vector<std::string> extended_debug_categories;

int c, i;
while ((c = getopt_long(argc, argv, "c:B:d::DhRv", opts, &i)) != -1)
while ((c = getopt_long(argc, argv, "c:B:d::DhRlv", opts, &i)) != -1)
{
switch (c)
{
Expand All @@ -302,6 +303,10 @@ int main(int argc, char *argv[])
runtime_config.no_damage_track = true;
break;

case 'l':
runtime_config.legacy_wl_drm = true;
break;

case 'h':
print_help();
break;
Expand Down
1 change: 1 addition & 0 deletions src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
extern struct wf_runtime_config
{
bool no_damage_track = false;
bool legacy_wl_drm = false;
bool damage_debug = false;
} runtime_config;

Expand Down

0 comments on commit d5b0d27

Please sign in to comment.