mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
backend: create DRM backend monitor when WLR_BACKENDS is used
This commit is contained in:
parent
3874577d3c
commit
2849712356
1 changed files with 8 additions and 11 deletions
|
@ -197,18 +197,18 @@ static struct wlr_backend *attempt_headless_backend(
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WLR_HAS_DRM_BACKEND
|
#if WLR_HAS_DRM_BACKEND
|
||||||
static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
static bool attempt_drm_backend(struct wl_display *display,
|
||||||
struct wlr_backend *backend, struct wlr_session *session) {
|
struct wlr_backend *backend, struct wlr_session *session) {
|
||||||
struct wlr_device *gpus[8];
|
struct wlr_device *gpus[8];
|
||||||
ssize_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
|
ssize_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
|
||||||
if (num_gpus < 0) {
|
if (num_gpus < 0) {
|
||||||
wlr_log(WLR_ERROR, "Failed to find GPUs");
|
wlr_log(WLR_ERROR, "Failed to find GPUs");
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_gpus == 0) {
|
if (num_gpus == 0) {
|
||||||
wlr_log(WLR_ERROR, "Found 0 GPUs, cannot create backend");
|
wlr_log(WLR_ERROR, "Found 0 GPUs, cannot create backend");
|
||||||
return NULL;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_INFO, "Found %zu GPUs", num_gpus);
|
wlr_log(WLR_INFO, "Found %zu GPUs", num_gpus);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,9 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return primary_drm;
|
drm_backend_monitor_create(backend, primary_drm, session);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -268,8 +270,7 @@ static bool attempt_backend_by_name(struct wl_display *display,
|
||||||
} else {
|
} else {
|
||||||
#if WLR_HAS_DRM_BACKEND
|
#if WLR_HAS_DRM_BACKEND
|
||||||
// attempt_drm_backend adds the multi drm backends itself
|
// attempt_drm_backend adds the multi drm backends itself
|
||||||
return attempt_drm_backend(display, multi,
|
return attempt_drm_backend(display, multi, *session_ptr);
|
||||||
*session_ptr) != NULL;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -379,14 +380,10 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WLR_HAS_DRM_BACKEND
|
#if WLR_HAS_DRM_BACKEND
|
||||||
struct wlr_backend *primary_drm =
|
if (!attempt_drm_backend(display, multi, session)) {
|
||||||
attempt_drm_backend(display, multi, session);
|
|
||||||
if (!primary_drm) {
|
|
||||||
wlr_log(WLR_ERROR, "Failed to open any DRM device");
|
wlr_log(WLR_ERROR, "Failed to open any DRM device");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_backend_monitor_create(multi, primary_drm, session);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
success:
|
success:
|
||||||
|
|
Loading…
Reference in a new issue