diff options
author | Mario Kleiner <mario.kleiner.de@gmail.com> | 2014-05-26 05:39:50 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-06-24 19:21:53 +1000 |
commit | 096fb1ebc10b14ba1b747832efe378369bcf44e6 (patch) | |
tree | a57007842a987384cfad06b353c9b0ada47ef545 | |
parent | 4771ff5c668047a2dc56e4c6131175eed837e757 (diff) |
dri2: Add support for handling more than 2 crtc's
Need to use the DRM_VBLANK_HIGH_CRTC bits to allow
selecting crtc's with id > 1 on latest gpu's with
up to four display engines.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | src/nouveau_dri2.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c index adb0b22..7446122 100644 --- a/src/nouveau_dri2.c +++ b/src/nouveau_dri2.c @@ -584,7 +584,23 @@ nouveau_wait_vblank(DrawablePtr draw, int type, CARD64 msc, event->s = data; } - vbl.request.type = type | (crtcs == 2 ? DRM_VBLANK_SECONDARY : 0); + /* Select crtc with smallest index from bitmask of crtcs */ + crtcs = ffs(crtcs) - 1; + + if (crtcs == 1) + type |= DRM_VBLANK_SECONDARY; + else if (crtcs > 1) +#ifdef DRM_VBLANK_HIGH_CRTC_SHIFT + type |= (crtcs << DRM_VBLANK_HIGH_CRTC_SHIFT) & + DRM_VBLANK_HIGH_CRTC_MASK; +#else + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Wait for VBlank failed: Called for CRTC %d > 1, but " + "DRM_VBLANK_HIGH_CRTC_SHIFT not defined at build time.\n", + crtcs); +#endif + + vbl.request.type = type; vbl.request.sequence = msc; vbl.request.signal = (unsigned long)token; @@ -630,11 +646,11 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame, draw->width, draw->height); - /* Whenever first crtc is involved, choose it as reference, as - * its vblank event triggered this swap. + /* Choose crtc with smallest index as reference, as its + * vblank event triggered this swap. ref_crtc_hw_id is + * a bit field (crtc 0 = bit 0, crtc 1 = bit 1 ...) */ - if (ref_crtc_hw_id & 1) - ref_crtc_hw_id = 1; + ref_crtc_hw_id = 1 << (ffs(ref_crtc_hw_id) - 1); /* Update frontbuffer pixmap and name: Could have changed due to * window (un)redirection as part of compositing. |