backend/drm: rename crtc_pageflip to crtc_commit

Also add a flags argument.

The commit function will also be used for disabling the CRTC.
master
Simon Ser 5 years ago
parent 70883fd10b
commit c608fc89d8

@ -144,8 +144,8 @@ error:
atom->failed = true; atom->failed = true;
} }
static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm, static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn) { struct wlr_drm_connector *conn, uint32_t flags) {
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
bool modeset = crtc->pending & WLR_DRM_CRTC_MODE; 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) { if (modeset) {
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
} else { } 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 = { const struct wlr_drm_interface atomic_iface = {
.conn_enable = atomic_conn_enable, .conn_enable = atomic_conn_enable,
.crtc_pageflip = atomic_crtc_pageflip, .crtc_commit = atomic_crtc_commit,
.crtc_set_cursor = atomic_crtc_set_cursor, .crtc_set_cursor = atomic_crtc_set_cursor,
.crtc_get_gamma_size = atomic_crtc_get_gamma_size, .crtc_get_gamma_size = atomic_crtc_get_gamma_size,
}; };

@ -345,7 +345,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
return false; 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; crtc->pending = 0;

@ -6,8 +6,8 @@
#include "backend/drm/iface.h" #include "backend/drm/iface.h"
#include "backend/drm/util.h" #include "backend/drm/util.h"
static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm, static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn) { struct wlr_drm_connector *conn, uint32_t flags) {
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
struct wlr_drm_plane *cursor = crtc->cursor; struct wlr_drm_plane *cursor = crtc->cursor;
@ -42,10 +42,13 @@ static bool legacy_crtc_pageflip(struct wlr_drm_backend *drm,
return false; return false;
} }
if (drmModePageFlip(drm->fd, crtc->id, fb_id, DRM_MODE_PAGE_FLIP_EVENT, drm)) { 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); wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name);
return false; return false;
} }
}
return true; 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 = { const struct wlr_drm_interface legacy_iface = {
.conn_enable = legacy_conn_enable, .conn_enable = legacy_conn_enable,
.crtc_pageflip = legacy_crtc_pageflip, .crtc_commit = legacy_crtc_commit,
.crtc_set_cursor = legacy_crtc_set_cursor, .crtc_set_cursor = legacy_crtc_set_cursor,
.crtc_get_gamma_size = legacy_crtc_get_gamma_size, .crtc_get_gamma_size = legacy_crtc_get_gamma_size,
}; };

@ -16,9 +16,9 @@ struct wlr_drm_interface {
// Enable or disable DPMS for connector // Enable or disable DPMS for connector
bool (*conn_enable)(struct wlr_drm_backend *drm, bool (*conn_enable)(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn, bool enable); struct wlr_drm_connector *conn, bool enable);
// Pageflip on crtc. // Commit al pending changes on a CRTC.
bool (*crtc_pageflip)(struct wlr_drm_backend *drm, bool (*crtc_commit)(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn); struct wlr_drm_connector *conn, uint32_t flags);
// Enable the cursor buffer on crtc. Set bo to NULL to disable // Enable the cursor buffer on crtc. Set bo to NULL to disable
bool (*crtc_set_cursor)(struct wlr_drm_backend *drm, bool (*crtc_set_cursor)(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, struct gbm_bo *bo); struct wlr_drm_crtc *crtc, struct gbm_bo *bo);

Loading…
Cancel
Save