aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Compositor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Compositor.cpp')
-rw-r--r--src/Compositor.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index eda5b5ed..42ba9b5f 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -127,13 +127,26 @@ void CCompositor::initServer() {
throwError("wlr_backend_autocreate() failed!");
}
- m_iDRMFD = wlr_backend_get_drm_fd(m_sWLRBackend);
- if (m_iDRMFD < 0) {
- Debug::log(CRIT, "Couldn't query the DRM FD!");
- throwError("wlr_backend_get_drm_fd() failed!");
- }
+ bool isHeadlessOnly = true;
+ wlr_multi_for_each_backend(
+ m_sWLRBackend,
+ [](wlr_backend* backend, void* isHeadlessOnly) {
+ if (!wlr_backend_is_headless(backend))
+ *(bool*)isHeadlessOnly = false;
+ },
+ &isHeadlessOnly);
- m_sWLRRenderer = wlr_gles2_renderer_create_with_drm_fd(m_iDRMFD);
+ if (isHeadlessOnly) {
+ m_sWLRRenderer = wlr_renderer_autocreate(m_sWLRBackend);
+ } else {
+ m_iDRMFD = wlr_backend_get_drm_fd(m_sWLRBackend);
+ if (m_iDRMFD < 0) {
+ Debug::log(CRIT, "Couldn't query the DRM FD!");
+ throwError("wlr_backend_get_drm_fd() failed!");
+ }
+
+ m_sWLRRenderer = wlr_gles2_renderer_create_with_drm_fd(m_iDRMFD);
+ }
if (!m_sWLRRenderer) {
Debug::log(CRIT, "m_sWLRRenderer was NULL! This usually means wlroots could not find a GPU or enountered some issues.");