Skip to content

Commit af4870e

Browse files
kleinermBen Skeggs
authored andcommitted
drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
Cards with nv04 display engine can't reliably use vblank counts and timestamps computed via drm_handle_vblank(), as the function gets invoked after sending the pageflip events. Fix this by defaulting to the old crtcid = -1 fallback path on <= NV-50 cards, and only using the precise path on NV-50 and later. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Cc: <stable@vger.kernel.org> # 3.13+
1 parent dcfb100 commit af4870e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_display.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
798798
struct drm_device *dev = drm->dev;
799799
struct nouveau_page_flip_state *s;
800800
unsigned long flags;
801+
int crtcid = -1;
801802

802803
spin_lock_irqsave(&dev->event_lock, flags);
803804

@@ -808,8 +809,13 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
808809
}
809810

810811
s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
811-
if (s->event)
812-
drm_send_vblank_event(dev, s->crtc, s->event);
812+
if (s->event) {
813+
/* Vblank timestamps/counts are only correct on >= NV-50 */
814+
if (nv_device(drm->device)->card_type >= NV_50)
815+
crtcid = s->crtc;
816+
817+
drm_send_vblank_event(dev, crtcid, s->event);
818+
}
813819

814820
list_del(&s->head);
815821
if (ps)

0 commit comments

Comments
 (0)