Commit 4f232990 authored by Lyude Paul's avatar Lyude Paul Committed by Karol Herbst

drm/nouveau/kms/nv50-: Check vbl count after CRC context flip

While I haven't seen us take too long in nv50_crc_ctx_flip_work() outside
of users with kernel logging on a serial port, it probably would be a good
idea to check how long we take just in case we need to go faster in the
future.

Cc: Martin Peres <martin.peres@free.fr>
Cc: Jeremy Cline <jcline@redhat.com>
Cc: Simon Ser <contact@emersion.fr>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10
parent bc4c7fa0
...@@ -86,6 +86,8 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base) ...@@ -86,6 +86,8 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base)
struct drm_crtc *crtc = &head->base.base; struct drm_crtc *crtc = &head->base.base;
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct nv50_disp *disp = nv50_disp(dev); struct nv50_disp *disp = nv50_disp(dev);
const uint64_t start_vbl = drm_crtc_vblank_count(crtc);
uint64_t end_vbl;
u8 new_idx = crc->ctx_idx ^ 1; u8 new_idx = crc->ctx_idx ^ 1;
/* /*
...@@ -94,9 +96,7 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base) ...@@ -94,9 +96,7 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base)
*/ */
if (!mutex_trylock(&disp->mutex)) { if (!mutex_trylock(&disp->mutex)) {
drm_dbg_kms(dev, "Lock contended, delaying CRC ctx flip for %s\n", crtc->name); drm_dbg_kms(dev, "Lock contended, delaying CRC ctx flip for %s\n", crtc->name);
drm_vblank_work_schedule(work, drm_vblank_work_schedule(work, start_vbl + 1, true);
drm_crtc_vblank_count(crtc) + 1,
true);
return; return;
} }
...@@ -107,6 +107,12 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base) ...@@ -107,6 +107,12 @@ static void nv50_crc_ctx_flip_work(struct kthread_work *base)
nv50_crc_program_ctx(head, &crc->ctx[new_idx]); nv50_crc_program_ctx(head, &crc->ctx[new_idx]);
mutex_unlock(&disp->mutex); mutex_unlock(&disp->mutex);
end_vbl = drm_crtc_vblank_count(crtc);
if (unlikely(end_vbl != start_vbl))
NV_ERROR(nouveau_drm(dev),
"Failed to flip CRC context on %s on time (%llu > %llu)\n",
crtc->name, end_vbl, start_vbl);
spin_lock_irq(&crc->lock); spin_lock_irq(&crc->lock);
crc->ctx_changed = true; crc->ctx_changed = true;
spin_unlock_irq(&crc->lock); spin_unlock_irq(&crc->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment