diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2020-01-24 19:31:39 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-01-24 19:43:51 +0100 |
commit | f0594fb732259606c0652f5fb1b847b86a746b35 (patch) | |
tree | 58268fa79e4913ff6945a8547ecfc21ee86fda80 /backend | |
parent | 1f722f5c800b1e422ffa480710d7af7c1e7dc0c4 (diff) |
backend/drm: add env variable to disable modifiers
In some cases modesets fail if the planes are initialized with
modifiers. Since in this case possibly all planes need to reinitialized,
which is not possible in the current wlroots design, add an environment
variable for affected users.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index db6f0207..f8812b4e 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -603,21 +603,41 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn, int height = mode->wlr_mode.height; uint32_t format = drm->renderer.gbm_format; - if (!init_drm_plane_surfaces(plane, drm, width, height, format, true) || + bool modifiers = true; + const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS"); + if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) { + wlr_log(WLR_DEBUG, + "WLR_DRM_NO_MODIFIERS set, initializing planes without modifiers"); + modifiers = false; + } + + if (!init_drm_plane_surfaces(plane, drm, width, height, format, modifiers) || !drm_connector_pageflip_renderer(conn, mode)) { // If page-flipping with modifiers enabled doesn't work, retry without // modifiers - wlr_log(WLR_INFO, "Page-flip failed with primary FB modifiers enabled, " - "retrying without modifiers"); finish_drm_surface(&plane->surf); finish_drm_surface(&plane->mgpu_surf); - if (!init_drm_plane_surfaces(plane, drm, width, height, format, false)) { + + if (!modifiers) { + wlr_log(WLR_ERROR, "Failed to initialize renderer " + "on connector '%s': initial page-flip failed", + conn->output.name); + return false; + } + wlr_log(WLR_INFO, "Page-flip failed with primary FB modifiers enabled, " + "retrying without modifiers"); + modifiers = false; + + if (!init_drm_plane_surfaces(plane, drm, width, height, format, + modifiers)) { return false; } if (!drm_connector_pageflip_renderer(conn, mode)) { wlr_log(WLR_ERROR, "Failed to initialize renderer " "on connector '%s': initial page-flip failed", conn->output.name); + finish_drm_surface(&plane->surf); + finish_drm_surface(&plane->mgpu_surf); return false; } } |