aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-02-08 00:16:23 -0500
committerBen Skeggs <bskeggs@redhat.com>2011-02-24 15:45:20 -0500
commitbd2f2037a42d4657ead3be2918db22e63626cd35 (patch)
treecfe251e758d02725101dd6210cc49f0e3748ed7b /drivers/gpu/drm
parentd7117e0d4e21034202833088e51fc21f8c8271f9 (diff)
drm/nvc0: support for sw methods + enable page flipping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_graph.c18
3 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index d6da139155d6..c42d84e26763 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -224,6 +224,7 @@ nouveau_page_flip_emit(struct nouveau_channel *chan,
224 struct nouveau_page_flip_state *s, 224 struct nouveau_page_flip_state *s,
225 struct nouveau_fence **pfence) 225 struct nouveau_fence **pfence)
226{ 226{
227 struct drm_nouveau_private *dev_priv = chan->dev->dev_private;
227 struct drm_device *dev = chan->dev; 228 struct drm_device *dev = chan->dev;
228 unsigned long flags; 229 unsigned long flags;
229 int ret; 230 int ret;
@@ -243,9 +244,12 @@ nouveau_page_flip_emit(struct nouveau_channel *chan,
243 if (ret) 244 if (ret)
244 goto fail; 245 goto fail;
245 246
246 BEGIN_RING(chan, NvSubSw, NV_SW_PAGE_FLIP, 1); 247 if (dev_priv->card_type < NV_C0)
247 OUT_RING(chan, 0); 248 BEGIN_RING(chan, NvSubSw, NV_SW_PAGE_FLIP, 1);
248 FIRE_RING(chan); 249 else
250 BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0500, 1);
251 OUT_RING (chan, 0);
252 FIRE_RING (chan);
249 253
250 ret = nouveau_fence_new(chan, pfence, true); 254 ret = nouveau_fence_new(chan, pfence, true);
251 if (ret) 255 if (ret)
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index e03cd3445466..43acfc2aded5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -1118,7 +1118,7 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data,
1118 getparam->value = 1; 1118 getparam->value = 1;
1119 break; 1119 break;
1120 case NOUVEAU_GETPARAM_HAS_PAGEFLIP: 1120 case NOUVEAU_GETPARAM_HAS_PAGEFLIP:
1121 getparam->value = (dev_priv->card_type < NV_C0) ? 1 : 0; 1121 getparam->value = 1;
1122 break; 1122 break;
1123 case NOUVEAU_GETPARAM_GRAPH_UNITS: 1123 case NOUVEAU_GETPARAM_GRAPH_UNITS:
1124 /* NV40 and NV50 versions are quite different, but register 1124 /* NV40 and NV50 versions are quite different, but register
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index afa7afe4ef92..3de9b721d8db 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -299,6 +299,14 @@ nvc0_graph_takedown(struct drm_device *dev)
299} 299}
300 300
301static int 301static int
302nvc0_graph_mthd_page_flip(struct nouveau_channel *chan,
303 u32 class, u32 mthd, u32 data)
304{
305 nouveau_finish_page_flip(chan, NULL);
306 return 0;
307}
308
309static int
302nvc0_graph_create(struct drm_device *dev) 310nvc0_graph_create(struct drm_device *dev)
303{ 311{
304 struct drm_nouveau_private *dev_priv = dev->dev_private; 312 struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -395,6 +403,7 @@ nvc0_graph_create(struct drm_device *dev)
395 nouveau_irq_register(dev, 25, nvc0_runk140_isr); 403 nouveau_irq_register(dev, 25, nvc0_runk140_isr);
396 NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ 404 NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */
397 NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ 405 NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */
406 NVOBJ_MTHD (dev, 0x9039, 0x0500, nvc0_graph_mthd_page_flip);
398 NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ 407 NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */
399 NVOBJ_CLASS(dev, 0x90c0, GR); /* COMPUTE */ 408 NVOBJ_CLASS(dev, 0x90c0, GR); /* COMPUTE */
400 return 0; 409 return 0;
@@ -728,9 +737,12 @@ nvc0_graph_isr(struct drm_device *dev)
728 u32 class = nv_rd32(dev, 0x404200 + (subc * 4)); 737 u32 class = nv_rd32(dev, 0x404200 + (subc * 4));
729 738
730 if (stat & 0x00000010) { 739 if (stat & 0x00000010) {
731 NV_INFO(dev, "PGRAPH: ILLEGAL_MTHD ch %d [0x%010llx] subc %d " 740 if (nouveau_gpuobj_mthd_call2(dev, chid, class, mthd, data)) {
732 "class 0x%04x mthd 0x%04x data 0x%08x\n", 741 NV_INFO(dev, "PGRAPH: ILLEGAL_MTHD ch %d [0x%010llx] "
733 chid, inst, subc, class, mthd, data); 742 "subc %d class 0x%04x mthd 0x%04x "
743 "data 0x%08x\n",
744 chid, inst, subc, class, mthd, data);
745 }
734 nv_wr32(dev, 0x400100, 0x00000010); 746 nv_wr32(dev, 0x400100, 0x00000010);
735 stat &= ~0x00000010; 747 stat &= ~0x00000010;
736 } 748 }