backend: drm: switch to pageflip_handler_2

atomic and legacy now both pass the backend as the user data for the
pageflip event. We than retrieve the correct connector by matching on
the crtc_id passed to the page_flip_handler2.

Wlroots also requires the DRM_CRTC_IN_VBLANK_EVENT capability now.

Fixes #1297
This commit is contained in:
Rouven Czerwinski 2019-06-26 17:14:31 +02:00 committed by Scott Anderson
parent 0b1f9439ba
commit d10072e76c
3 changed files with 27 additions and 9 deletions

View file

@ -45,18 +45,20 @@ static bool atomic_end(int drm_fd, struct atomic *atom) {
static bool atomic_commit(int drm_fd, struct atomic *atom,
struct wlr_drm_connector *conn, uint32_t flags, bool modeset) {
struct wlr_drm_backend *drm =
get_drm_backend_from_backend(conn->output.backend);
if (atom->failed) {
return false;
}
int ret = drmModeAtomicCommit(drm_fd, atom->req, flags, conn);
int ret = drmModeAtomicCommit(drm_fd, atom->req, flags, drm);
if (ret) {
wlr_log_errno(WLR_ERROR, "%s: Atomic commit failed (%s)",
conn->output.name, modeset ? "modeset" : "pageflip");
// Try to commit without new changes
drmModeAtomicSetCursor(atom->req, atom->cursor);
if (drmModeAtomicCommit(drm_fd, atom->req, flags, conn)) {
if (drmModeAtomicCommit(drm_fd, atom->req, flags, drm)) {
wlr_log_errno(WLR_ERROR,
"%s: Atomic commit without new changes failed (%s)",
conn->output.name, modeset ? "modeset" : "pageflip");