Skip to content

Commit

Permalink
drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
Browse files Browse the repository at this point in the history
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+
  • Loading branch information
Mario Kleiner authored and Ben Skeggs committed Jun 10, 2014
1 parent dcfb100 commit af4870e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/gpu/drm/nouveau/nouveau_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
struct drm_device *dev = drm->dev;
struct nouveau_page_flip_state *s;
unsigned long flags;
int crtcid = -1;

spin_lock_irqsave(&dev->event_lock, flags);

Expand All @@ -808,8 +809,13 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
}

s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
if (s->event)
drm_send_vblank_event(dev, s->crtc, s->event);
if (s->event) {
/* Vblank timestamps/counts are only correct on >= NV-50 */
if (nv_device(drm->device)->card_type >= NV_50)
crtcid = s->crtc;

drm_send_vblank_event(dev, crtcid, s->event);
}

list_del(&s->head);
if (ps)
Expand Down

0 comments on commit af4870e

Please sign in to comment.