From c608fc89d8cb850b9c53c3fa84e7c08ea3c0e30a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 7 May 2020 19:20:56 +0200 Subject: backend/drm: rename crtc_pageflip to crtc_commit Also add a flags argument. The commit function will also be used for disabling the CRTC. --- backend/drm/atomic.c | 7 +++---- backend/drm/drm.c | 2 +- backend/drm/legacy.c | 15 +++++++++------ include/backend/drm/iface.h | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index c1b1229c..0b2cf8b3 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -144,8 +144,8 @@ error: atom->failed = true; } -static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm, - struct wlr_drm_connector *conn) { +static bool atomic_crtc_commit(struct wlr_drm_backend *drm, + struct wlr_drm_connector *conn, uint32_t flags) { struct wlr_drm_crtc *crtc = conn->crtc; bool modeset = crtc->pending & WLR_DRM_CRTC_MODE; @@ -179,7 +179,6 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm, } } - uint32_t flags = DRM_MODE_PAGE_FLIP_EVENT; if (modeset) { flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; } else { @@ -267,7 +266,7 @@ static size_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm, const struct wlr_drm_interface atomic_iface = { .conn_enable = atomic_conn_enable, - .crtc_pageflip = atomic_crtc_pageflip, + .crtc_commit = atomic_crtc_commit, .crtc_set_cursor = atomic_crtc_set_cursor, .crtc_get_gamma_size = atomic_crtc_get_gamma_size, }; diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0d7f3f25..9c397752 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -345,7 +345,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) { return false; } - bool ok = drm->iface->crtc_pageflip(drm, conn); + bool ok = drm->iface->crtc_commit(drm, conn, DRM_MODE_PAGE_FLIP_EVENT); crtc->pending = 0; diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index 46a0309e..4ca9d57c 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -6,8 +6,8 @@ #include "backend/drm/iface.h" #include "backend/drm/util.h" -static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm, - struct wlr_drm_connector *conn) { +static bool legacy_crtc_commit(struct wlr_drm_backend *drm, + struct wlr_drm_connector *conn, uint32_t flags) { struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_plane *cursor = crtc->cursor; @@ -42,9 +42,12 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm, return false; } - if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, drm)) { - wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name); - return false; + if (flags & DRM_MODE_PAGE_FLIP_EVENT) { + if (drmModePageFlip(drm->fd, crtc->id, fb_id, + DRM_MODE_PAGE_FLIP_EVENT, drm)) { + wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name); + return false; + } } return true; @@ -114,7 +117,7 @@ static size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm, const struct wlr_drm_interface legacy_iface = { .conn_enable = legacy_conn_enable, - .crtc_pageflip = legacy_crtc_pageflip, + .crtc_commit = legacy_crtc_commit, .crtc_set_cursor = legacy_crtc_set_cursor, .crtc_get_gamma_size = legacy_crtc_get_gamma_size, }; diff --git a/include/backend/drm/iface.h b/include/backend/drm/iface.h index b99262b8..6498bb73 100644 --- a/include/backend/drm/iface.h +++ b/include/backend/drm/iface.h @@ -16,9 +16,9 @@ struct wlr_drm_interface { // Enable or disable DPMS for connector bool (*conn_enable)(struct wlr_drm_backend *drm, struct wlr_drm_connector *conn, bool enable); - // Pageflip on crtc. - bool (*crtc_pageflip)(struct wlr_drm_backend *drm, - struct wlr_drm_connector *conn); + // Commit al pending changes on a CRTC. + bool (*crtc_commit)(struct wlr_drm_backend *drm, + struct wlr_drm_connector *conn, uint32_t flags); // Enable the cursor buffer on crtc. Set bo to NULL to disable bool (*crtc_set_cursor)(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc, struct gbm_bo *bo); -- cgit v1.2.3