aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-03-20 23:53:49 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-03-22 03:17:40 -0400
commitd5316e251230c4e54a157349a362229c3d4daa32 (patch)
treea5371432d01ac0ef54c4c402c901a0fc1f2d2323 /drivers/gpu
parentb08abd4e9a11d637d3c2ff52b2ebbc1b3f686d06 (diff)
drm/nvc0-/disp: reimplement flip completion method as fifo method
Removes need for M2MF subchannel usage on NVC0+. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c14
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h1
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_fifo.c36
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_graph.c9
4 files changed, 42 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 35acc92f647b..ab447275da28 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -438,15 +438,19 @@ nouveau_page_flip_emit(struct nouveau_channel *chan,
438 goto fail; 438 goto fail;
439 439
440 /* Emit the pageflip */ 440 /* Emit the pageflip */
441 ret = RING_SPACE(chan, 2); 441 ret = RING_SPACE(chan, 3);
442 if (ret) 442 if (ret)
443 goto fail; 443 goto fail;
444 444
445 if (dev_priv->card_type < NV_C0) 445 if (dev_priv->card_type < NV_C0) {
446 BEGIN_RING(chan, NvSubSw, NV_SW_PAGE_FLIP, 1); 446 BEGIN_RING(chan, NvSubSw, NV_SW_PAGE_FLIP, 1);
447 else 447 OUT_RING (chan, 0x00000000);
448 BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0500, 1); 448 OUT_RING (chan, 0x00000000);
449 OUT_RING (chan, 0); 449 } else {
450 BEGIN_NVC0(chan, 2, 0, NV10_SUBCHAN_REF_CNT, 1);
451 OUT_RING (chan, ++chan->fence.sequence);
452 BEGIN_NVC0(chan, 8, 0, NVSW_SUBCHAN_PAGE_FLIP, 0x0000);
453 }
450 FIRE_RING (chan); 454 FIRE_RING (chan);
451 455
452 ret = nouveau_fence_new(chan, pfence, true); 456 ret = nouveau_fence_new(chan, pfence, true);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index eaf9872f9ee2..3dd620fc7837 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -1775,6 +1775,7 @@ nv44_graph_class(struct drm_device *dev)
1775#define NV84_SUBCHAN_NOTIFY_INTR 0x00000020 1775#define NV84_SUBCHAN_NOTIFY_INTR 0x00000020
1776#define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024 1776#define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024
1777#define NV10_SUBCHAN_REF_CNT 0x00000050 1777#define NV10_SUBCHAN_REF_CNT 0x00000050
1778#define NVSW_SUBCHAN_PAGE_FLIP 0x00000054
1778#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060 1779#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
1779#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064 1780#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
1780#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068 1781#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
diff --git a/drivers/gpu/drm/nouveau/nvc0_fifo.c b/drivers/gpu/drm/nouveau/nvc0_fifo.c
index dcbe0d5d0241..50d68a7a1379 100644
--- a/drivers/gpu/drm/nouveau/nvc0_fifo.c
+++ b/drivers/gpu/drm/nouveau/nvc0_fifo.c
@@ -436,6 +436,24 @@ nvc0_fifo_isr_vm_fault(struct drm_device *dev, int unit)
436 printk(" on channel 0x%010llx\n", (u64)inst << 12); 436 printk(" on channel 0x%010llx\n", (u64)inst << 12);
437} 437}
438 438
439static int
440nvc0_fifo_page_flip(struct drm_device *dev, u32 chid)
441{
442 struct drm_nouveau_private *dev_priv = dev->dev_private;
443 struct nouveau_channel *chan = NULL;
444 unsigned long flags;
445 int ret = -EINVAL;
446
447 spin_lock_irqsave(&dev_priv->channels.lock, flags);
448 if (likely(chid >= 0 && chid < dev_priv->engine.fifo.channels)) {
449 chan = dev_priv->channels.ptr[chid];
450 if (likely(chan))
451 ret = nouveau_finish_page_flip(chan, NULL);
452 }
453 spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
454 return ret;
455}
456
439static void 457static void
440nvc0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) 458nvc0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit)
441{ 459{
@@ -445,11 +463,21 @@ nvc0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit)
445 u32 chid = nv_rd32(dev, 0x040120 + (unit * 0x2000)) & 0x7f; 463 u32 chid = nv_rd32(dev, 0x040120 + (unit * 0x2000)) & 0x7f;
446 u32 subc = (addr & 0x00070000); 464 u32 subc = (addr & 0x00070000);
447 u32 mthd = (addr & 0x00003ffc); 465 u32 mthd = (addr & 0x00003ffc);
466 u32 show = stat;
448 467
449 NV_INFO(dev, "PSUBFIFO %d:", unit); 468 if (stat & 0x00200000) {
450 nouveau_bitfield_print(nvc0_fifo_subfifo_intr, stat); 469 if (mthd == 0x0054) {
451 NV_INFO(dev, "PSUBFIFO %d: ch %d subc %d mthd 0x%04x data 0x%08x\n", 470 if (!nvc0_fifo_page_flip(dev, chid))
452 unit, chid, subc, mthd, data); 471 show &= ~0x00200000;
472 }
473 }
474
475 if (show) {
476 NV_INFO(dev, "PFIFO%d:", unit);
477 nouveau_bitfield_print(nvc0_fifo_subfifo_intr, show);
478 NV_INFO(dev, "PFIFO%d: ch %d subc %d mthd 0x%04x data 0x%08x\n",
479 unit, chid, subc, mthd, data);
480 }
453 481
454 nv_wr32(dev, 0x0400c0 + (unit * 0x2000), 0x80600008); 482 nv_wr32(dev, 0x0400c0 + (unit * 0x2000), 0x80600008);
455 nv_wr32(dev, 0x040108 + (unit * 0x2000), stat); 483 nv_wr32(dev, 0x040108 + (unit * 0x2000), stat);
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index 8ee3963f9030..9066102d1159 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -333,14 +333,6 @@ nvc0_graph_fini(struct drm_device *dev, int engine, bool suspend)
333 return 0; 333 return 0;
334} 334}
335 335
336static int
337nvc0_graph_mthd_page_flip(struct nouveau_channel *chan,
338 u32 class, u32 mthd, u32 data)
339{
340 nouveau_finish_page_flip(chan, NULL);
341 return 0;
342}
343
344static void 336static void
345nvc0_graph_init_obj418880(struct drm_device *dev) 337nvc0_graph_init_obj418880(struct drm_device *dev)
346{ 338{
@@ -889,7 +881,6 @@ nvc0_graph_create(struct drm_device *dev)
889 881
890 NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ 882 NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */
891 NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ 883 NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */
892 NVOBJ_MTHD (dev, 0x9039, 0x0500, nvc0_graph_mthd_page_flip);
893 NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ 884 NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */
894 if (fermi >= 0x9197) 885 if (fermi >= 0x9197)
895 NVOBJ_CLASS(dev, 0x9197, GR); /* 3D (NVC1-) */ 886 NVOBJ_CLASS(dev, 0x9197, GR); /* 3D (NVC1-) */