Skip to content

Instantly share code, notes, and snippets.

@Consolatis
Created November 8, 2023 15:43
Show Gist options
  • Save Consolatis/0c48cabe0601de7049c688da0e49f778 to your computer and use it in GitHub Desktop.
Save Consolatis/0c48cabe0601de7049c688da0e49f778 to your computer and use it in GitHub Desktop.
diff --git a/src/output.c b/src/output.c
index f7f95ab1..435471a8 100644
--- a/src/output.c
+++ b/src/output.c
@@ -9,6 +9,7 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <strings.h>
+#include <wlr/backend/drm.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_output.h>
@@ -95,7 +96,7 @@ new_output_notify(struct wl_listener *listener, void *data)
* This is also useful for debugging the DRM parts of
* another compositor.
*/
- if (server->drm_lease_manager) {
+ if (server->drm_lease_manager && wlr_output_is_drm(wlr_output)) {
wlr_drm_lease_v1_manager_offer_output(
server->drm_lease_manager, wlr_output);
}
diff --git a/src/server.c b/src/server.c
index 29868e96..86145a06 100644
--- a/src/server.c
+++ b/src/server.c
@@ -3,6 +3,8 @@
#include "config.h"
#include <signal.h>
#include <sys/wait.h>
+#include <wlr/backend/headless.h>
+#include <wlr/backend/multi.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
@@ -251,6 +253,15 @@ server_init(struct server *server)
exit(EXIT_FAILURE);
}
+ struct wlr_backend *headless;
+ headless = wlr_headless_backend_create(server->wl_display);
+ if (!headless) {
+ wlr_log(WLR_ERROR, "failed to create headless backend");
+ } else {
+ wlr_multi_backend_add(server->backend, headless);
+ wlr_headless_add_output(headless, 1920, 1080);
+ }
+
/*
* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The
* user can also specify a renderer using the WLR_RENDERER env var.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment