aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv50_mpeg.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-04-12 01:20:22 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-05-15 20:49:08 -0400
commit9548258fbce1e8d6fcd96bba299386f5666840ae (patch)
treeae3c0899d231359d4e40b67b5b26b92718bf551f /drivers/gpu/drm/nouveau/nv50_mpeg.c
parent93187450fade03e5de977af9a879683edda64a97 (diff)
drm/nv50: support PMPEG on original nv50
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_mpeg.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_mpeg.c59
1 files changed, 48 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_mpeg.c b/drivers/gpu/drm/nouveau/nv50_mpeg.c
index 82666bc69a2c..1dc5913f78c5 100644
--- a/drivers/gpu/drm/nouveau/nv50_mpeg.c
+++ b/drivers/gpu/drm/nouveau/nv50_mpeg.c
@@ -30,6 +30,19 @@ struct nv50_mpeg_engine {
30 struct nouveau_exec_engine base; 30 struct nouveau_exec_engine base;
31}; 31};
32 32
33static inline u32
34CTX_PTR(struct drm_device *dev, u32 offset)
35{
36 struct drm_nouveau_private *dev_priv = dev->dev_private;
37
38 if (dev_priv->chipset == 0x50)
39 offset += 0x0260;
40 else
41 offset += 0x0060;
42
43 return offset;
44}
45
33static int 46static int
34nv50_mpeg_context_new(struct nouveau_channel *chan, int engine) 47nv50_mpeg_context_new(struct nouveau_channel *chan, int engine)
35{ 48{
@@ -46,12 +59,12 @@ nv50_mpeg_context_new(struct nouveau_channel *chan, int engine)
46 if (ret) 59 if (ret)
47 return ret; 60 return ret;
48 61
49 nv_wo32(ramin, 0x60, 0x80190002); 62 nv_wo32(ramin, CTX_PTR(dev, 0x00), 0x80190002);
50 nv_wo32(ramin, 0x64, ctx->vinst + ctx->size - 1); 63 nv_wo32(ramin, CTX_PTR(dev, 0x04), ctx->vinst + ctx->size - 1);
51 nv_wo32(ramin, 0x68, ctx->vinst); 64 nv_wo32(ramin, CTX_PTR(dev, 0x08), ctx->vinst);
52 nv_wo32(ramin, 0x6c, 0); 65 nv_wo32(ramin, CTX_PTR(dev, 0x0c), 0);
53 nv_wo32(ramin, 0x70, 0); 66 nv_wo32(ramin, CTX_PTR(dev, 0x10), 0);
54 nv_wo32(ramin, 0x74, 0x00010000); 67 nv_wo32(ramin, CTX_PTR(dev, 0x14), 0x00010000);
55 68
56 nv_wo32(ctx, 0x70, 0x00801ec1); 69 nv_wo32(ctx, 0x70, 0x00801ec1);
57 nv_wo32(ctx, 0x7c, 0x0000037c); 70 nv_wo32(ctx, 0x7c, 0x0000037c);
@@ -83,8 +96,8 @@ nv50_mpeg_context_del(struct nouveau_channel *chan, int engine)
83 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000001); 96 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000001);
84 spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); 97 spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
85 98
86 for (i = 0x60; i <= 0x74; i += 4) 99 for (i = 0x00; i <= 0x14; i += 4)
87 nv_wo32(chan->ramin, i, 0x00000000); 100 nv_wo32(chan->ramin, CTX_PTR(dev, i), 0x00000000);
88 nouveau_gpuobj_ref(NULL, &ctx); 101 nouveau_gpuobj_ref(NULL, &ctx);
89 chan->engctx[engine] = NULL; 102 chan->engctx[engine] = NULL;
90} 103}
@@ -183,6 +196,19 @@ nv50_mpeg_isr(struct drm_device *dev)
183} 196}
184 197
185static void 198static void
199nv50_vpe_isr(struct drm_device *dev)
200{
201 if (nv_rd32(dev, 0x00b100))
202 nv50_mpeg_isr(dev);
203
204 if (nv_rd32(dev, 0x00b800)) {
205 u32 stat = nv_rd32(dev, 0x00b800);
206 NV_INFO(dev, "PMSRCH: 0x%08x\n", stat);
207 nv_wr32(dev, 0xb800, stat);
208 }
209}
210
211static void
186nv50_mpeg_destroy(struct drm_device *dev, int engine) 212nv50_mpeg_destroy(struct drm_device *dev, int engine)
187{ 213{
188 struct nv50_mpeg_engine *pmpeg = nv_engine(dev, engine); 214 struct nv50_mpeg_engine *pmpeg = nv_engine(dev, engine);
@@ -196,6 +222,7 @@ nv50_mpeg_destroy(struct drm_device *dev, int engine)
196int 222int
197nv50_mpeg_create(struct drm_device *dev) 223nv50_mpeg_create(struct drm_device *dev)
198{ 224{
225 struct drm_nouveau_private *dev_priv = dev->dev_private;
199 struct nv50_mpeg_engine *pmpeg; 226 struct nv50_mpeg_engine *pmpeg;
200 227
201 pmpeg = kzalloc(sizeof(*pmpeg), GFP_KERNEL); 228 pmpeg = kzalloc(sizeof(*pmpeg), GFP_KERNEL);
@@ -210,10 +237,20 @@ nv50_mpeg_create(struct drm_device *dev)
210 pmpeg->base.object_new = nv50_mpeg_object_new; 237 pmpeg->base.object_new = nv50_mpeg_object_new;
211 pmpeg->base.tlb_flush = nv50_mpeg_tlb_flush; 238 pmpeg->base.tlb_flush = nv50_mpeg_tlb_flush;
212 239
213 nouveau_irq_register(dev, 0, nv50_mpeg_isr); 240 if (dev_priv->chipset == 0x50) {
241 nouveau_irq_register(dev, 0, nv50_vpe_isr);
242 NVOBJ_ENGINE_ADD(dev, MPEG, &pmpeg->base);
243 NVOBJ_CLASS(dev, 0x3174, MPEG);
244#if 0
245 NVOBJ_ENGINE_ADD(dev, ME, &pme->base);
246 NVOBJ_CLASS(dev, 0x4075, ME);
247#endif
248 } else {
249 nouveau_irq_register(dev, 0, nv50_mpeg_isr);
250 NVOBJ_ENGINE_ADD(dev, MPEG, &pmpeg->base);
251 NVOBJ_CLASS(dev, 0x8274, MPEG);
252 }
214 253
215 NVOBJ_ENGINE_ADD(dev, MPEG, &pmpeg->base);
216 NVOBJ_CLASS(dev, 0x8274, MPEG);
217 return 0; 254 return 0;
218 255
219} 256}