Skip to content

Commit dcfb100

Browse files
kleinermBen Skeggs
authored andcommitted
drm/nv50-/mc: fix kms pageflip events by reordering irq handling order.
Whenever a single nouveau_mc_intr() main gpu irq-handler invocation was responsible for calling both, the vblank-irq handler (display engine irq) and kms-pageflip completion handler (from fifo irq), the order of invocation was wrong. nouveau_finish_flip() was called before drm_handle_vblank() for the vblank of pageflip completion, so the emitted pageflip event contained stale vblank count and timestamp from previous vblank. This caused failure in userspace to timestamp properly. Reorder order of invocation of engine irq handlers: Put NVDEV_ENGINE_DISP always on top, and thereby before NVDEV_ENGINE_FIFO, so that drm_handle_vblank() gets called to update vblank timestamps and count before potential pageflip events make use of that information. This works on nv-50 and later, where kms-pageflip completion triggers an irq either after a separate vblank irq, or both pageflip and vblank trigger one common irq invocation, but never before vblank irqs. v2 (Ben): - removed mods for nv04-nv40, it doesn't help there anyway - this is considered a hack, and a better solution should be found 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 e291af3 commit dcfb100

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
const struct nouveau_mc_intr
2828
nv50_mc_intr[] = {
29+
{ 0x04000000, NVDEV_ENGINE_DISP }, /* DISP before FIFO, so pageflip-timestamping works! */
2930
{ 0x00000001, NVDEV_ENGINE_MPEG },
3031
{ 0x00000100, NVDEV_ENGINE_FIFO },
3132
{ 0x00001000, NVDEV_ENGINE_GR },
@@ -34,7 +35,6 @@ nv50_mc_intr[] = {
3435
{ 0x00020000, NVDEV_ENGINE_VP }, /* NV84- */
3536
{ 0x00100000, NVDEV_SUBDEV_TIMER },
3637
{ 0x00200000, NVDEV_SUBDEV_GPIO },
37-
{ 0x04000000, NVDEV_ENGINE_DISP },
3838
{ 0x10000000, NVDEV_SUBDEV_BUS },
3939
{ 0x80000000, NVDEV_ENGINE_SW },
4040
{ 0x0002d101, NVDEV_SUBDEV_FB },

drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
static const struct nouveau_mc_intr
2828
nv98_mc_intr[] = {
29+
{ 0x04000000, NVDEV_ENGINE_DISP }, /* DISP first, so pageflip timestamps work */
2930
{ 0x00000001, NVDEV_ENGINE_PPP },
3031
{ 0x00000100, NVDEV_ENGINE_FIFO },
3132
{ 0x00001000, NVDEV_ENGINE_GR },
@@ -37,7 +38,6 @@ nv98_mc_intr[] = {
3738
{ 0x00100000, NVDEV_SUBDEV_TIMER },
3839
{ 0x00200000, NVDEV_SUBDEV_GPIO },
3940
{ 0x00400000, NVDEV_ENGINE_COPY0 }, /* NVA3- */
40-
{ 0x04000000, NVDEV_ENGINE_DISP },
4141
{ 0x10000000, NVDEV_SUBDEV_BUS },
4242
{ 0x80000000, NVDEV_ENGINE_SW },
4343
{ 0x0042d101, NVDEV_SUBDEV_FB },

drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
const struct nouveau_mc_intr
2828
nvc0_mc_intr[] = {
29+
{ 0x04000000, NVDEV_ENGINE_DISP }, /* DISP first, so pageflip timestamps work. */
2930
{ 0x00000001, NVDEV_ENGINE_PPP },
3031
{ 0x00000020, NVDEV_ENGINE_COPY0 },
3132
{ 0x00000040, NVDEV_ENGINE_COPY1 },
@@ -40,7 +41,6 @@ nvc0_mc_intr[] = {
4041
{ 0x00200000, NVDEV_SUBDEV_GPIO },
4142
{ 0x01000000, NVDEV_SUBDEV_PWR },
4243
{ 0x02000000, NVDEV_SUBDEV_LTCG },
43-
{ 0x04000000, NVDEV_ENGINE_DISP },
4444
{ 0x08000000, NVDEV_SUBDEV_FB },
4545
{ 0x10000000, NVDEV_SUBDEV_BUS },
4646
{ 0x40000000, NVDEV_SUBDEV_IBUS },

0 commit comments

Comments
 (0)