backend/drm: fix black screens when enabling output

This patch fixes this failure:

    01:57:16.642 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending
    01:57:16.684 [ERROR] [backend/drm/drm.c:732] Failed to initialize renderer on connector 'eDP-1': initial page-flip failed
    01:57:16.684 [ERROR] [backend/drm/drm.c:805] Failed to initialize renderer for plane
    01:57:16.684 [sway/config/output.c:423] Failed to commit output eDP-1

References: https://github.com/swaywm/sway/issues/5101
This commit is contained in:
Simon Ser 2020-06-03 10:49:30 +02:00 committed by Drew DeVault
parent e91417ea8d
commit 8f28f5b2f8
1 changed files with 5 additions and 1 deletions

View File

@ -356,7 +356,11 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) {
static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) { static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
if (conn->pageflip_pending) { // wlr_drm_interface.crtc_commit will perform either a non-blocking
// page-flip, either a blocking modeset. When performing a blocking modeset
// we'll wait for all queued page-flips to complete, so we don't need this
// safeguard.
if (conn->pageflip_pending && !crtc->pending_modeset) {
wlr_log(WLR_ERROR, "Failed to page-flip output '%s': " wlr_log(WLR_ERROR, "Failed to page-flip output '%s': "
"a page-flip is already pending", conn->output.name); "a page-flip is already pending", conn->output.name);
return false; return false;