[PATCH 1/6] compositor-drm: Handle more than two output crtcs per card

Mario Kleiner mario.kleiner.de at gmail.com
Wed Apr 1 22:10:49 PDT 2015


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 <mario.kleiner.de at gmail.com>
---
 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 43197a8..fe59811 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -593,6 +593,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)
@@ -664,8 +675,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
-- 
1.9.1



More information about the wayland-devel mailing list