backend/drm: don't unset mode/CRTC when disabling output

Closes: https://github.com/swaywm/wlroots/issues/2203
This commit is contained in:
Simon Ser 2020-05-18 15:37:19 +02:00
parent dcae6f1431
commit bfd7625813
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
4 changed files with 36 additions and 37 deletions

View file

@ -14,8 +14,24 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc = conn->crtc;
struct wlr_drm_plane *cursor = crtc->cursor;
bool enabled = output->enabled;
if (output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
enabled = output->pending.enabled;
}
if (output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
uint32_t dpms = output->pending.enabled ?
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
dpms) != 0) {
wlr_log_errno(WLR_ERROR, "%s: failed to set DPMS property",
conn->output.name);
return false;
}
}
uint32_t fb_id = 0;
if (crtc->pending.active) {
if (enabled) {
struct wlr_drm_fb *fb = plane_get_next_fb(crtc->primary);
struct gbm_bo *bo = drm_fb_acquire(fb, drm, &crtc->primary->mgpu_surf);
if (!bo) {
@ -38,15 +54,6 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
mode = &crtc->pending.mode->drm_mode;
}
uint32_t dpms = crtc->pending.active ?
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
dpms) != 0) {
wlr_log_errno(WLR_ERROR, "%s: failed to set DPMS property",
conn->output.name);
return false;
}
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
conns, conns_len, mode)) {
wlr_log_errno(WLR_ERROR, "%s: failed to set CRTC",