From 2ab4f4e384a45172988f56b1708edd47f84fe038 Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Sun, 21 Jun 2015 21:25:13 +0200 Subject: [PATCH] compositor-drm: Handle more than two output crtcs per card Allow proper handling of output->pipe > 1 to support triple-head graphics cards etc. by using the "high-crtc" support introduced in Linux 2.6.39 and libdrm 2.4.25 around May 2011. Signed-off-by: Mario Kleiner Reviewed-By: Derek Foreman --- src/compositor-drm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index ad708079..aa6d010b 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -597,6 +597,17 @@ drm_output_set_gamma(struct weston_output *output_base, weston_log("set gamma failed: %m\n"); } +static unsigned int drm_waitvblank_pipe(struct drm_output *output) +{ + if (output->pipe > 1) + return (output->pipe << DRM_VBLANK_HIGH_CRTC_SHIFT) & + DRM_VBLANK_HIGH_CRTC_MASK; + else if (output->pipe > 0) + return DRM_VBLANK_SECONDARY; + else + return 0; +} + static int drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage) @@ -668,8 +679,7 @@ drm_output_repaint(struct weston_output *output_base, weston_log("setplane failed: %d: %s\n", ret, strerror(errno)); - if (output->pipe > 0) - vbl.request.type |= DRM_VBLANK_SECONDARY; + vbl.request.type |= drm_waitvblank_pipe(output); /* * Queue a vblank signal so we know when the surface