aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv50_graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_graph.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_graph.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c
index 33d5711a918d..2698d80c8eb2 100644
--- a/drivers/gpu/drm/nouveau/nv50_graph.c
+++ b/drivers/gpu/drm/nouveau/nv50_graph.c
@@ -28,7 +28,6 @@
28#include "drm.h" 28#include "drm.h"
29#include "nouveau_drv.h" 29#include "nouveau_drv.h"
30#include "nouveau_ramht.h" 30#include "nouveau_ramht.h"
31#include "nouveau_grctx.h"
32#include "nouveau_dma.h" 31#include "nouveau_dma.h"
33#include "nouveau_vm.h" 32#include "nouveau_vm.h"
34#include "nv50_evo.h" 33#include "nv50_evo.h"
@@ -229,7 +228,6 @@ nv50_graph_context_new(struct nouveau_channel *chan, int engine)
229 struct nouveau_gpuobj *ramin = chan->ramin; 228 struct nouveau_gpuobj *ramin = chan->ramin;
230 struct nouveau_gpuobj *grctx = NULL; 229 struct nouveau_gpuobj *grctx = NULL;
231 struct nv50_graph_engine *pgraph = nv_engine(dev, engine); 230 struct nv50_graph_engine *pgraph = nv_engine(dev, engine);
232 struct nouveau_grctx ctx = {};
233 int hdr, ret; 231 int hdr, ret;
234 232
235 NV_DEBUG(dev, "ch%d\n", chan->id); 233 NV_DEBUG(dev, "ch%d\n", chan->id);
@@ -248,11 +246,7 @@ nv50_graph_context_new(struct nouveau_channel *chan, int engine)
248 nv_wo32(ramin, hdr + 0x10, 0); 246 nv_wo32(ramin, hdr + 0x10, 0);
249 nv_wo32(ramin, hdr + 0x14, 0x00010000); 247 nv_wo32(ramin, hdr + 0x14, 0x00010000);
250 248
251 ctx.dev = chan->dev; 249 nv50_grctx_fill(dev, grctx);
252 ctx.mode = NOUVEAU_GRCTX_VALS;
253 ctx.data = grctx;
254 nv50_grctx_init(&ctx);
255
256 nv_wo32(grctx, 0x00000, chan->ramin->vinst >> 12); 250 nv_wo32(grctx, 0x00000, chan->ramin->vinst >> 12);
257 251
258 dev_priv->engine.instmem.flush(dev); 252 dev_priv->engine.instmem.flush(dev);
@@ -996,28 +990,21 @@ nv50_graph_create(struct drm_device *dev)
996{ 990{
997 struct drm_nouveau_private *dev_priv = dev->dev_private; 991 struct drm_nouveau_private *dev_priv = dev->dev_private;
998 struct nv50_graph_engine *pgraph; 992 struct nv50_graph_engine *pgraph;
999 struct nouveau_grctx ctx = {};
1000 int ret; 993 int ret;
1001 994
1002 pgraph = kzalloc(sizeof(*pgraph),GFP_KERNEL); 995 pgraph = kzalloc(sizeof(*pgraph),GFP_KERNEL);
1003 if (!pgraph) 996 if (!pgraph)
1004 return -ENOMEM; 997 return -ENOMEM;
1005 998
1006 ctx.dev = dev; 999 ret = nv50_grctx_init(dev, pgraph->ctxprog, ARRAY_SIZE(pgraph->ctxprog),
1007 ctx.mode = NOUVEAU_GRCTX_PROG; 1000 &pgraph->ctxprog_size,
1008 ctx.data = pgraph->ctxprog; 1001 &pgraph->grctx_size);
1009 ctx.ctxprog_max = ARRAY_SIZE(pgraph->ctxprog);
1010
1011 ret = nv50_grctx_init(&ctx);
1012 if (ret) { 1002 if (ret) {
1013 NV_ERROR(dev, "PGRAPH: ctxprog build failed\n"); 1003 NV_ERROR(dev, "PGRAPH: ctxprog build failed\n");
1014 kfree(pgraph); 1004 kfree(pgraph);
1015 return 0; 1005 return 0;
1016 } 1006 }
1017 1007
1018 pgraph->grctx_size = ctx.ctxvals_pos * 4;
1019 pgraph->ctxprog_size = ctx.ctxprog_len;
1020
1021 pgraph->base.destroy = nv50_graph_destroy; 1008 pgraph->base.destroy = nv50_graph_destroy;
1022 pgraph->base.init = nv50_graph_init; 1009 pgraph->base.init = nv50_graph_init;
1023 pgraph->base.fini = nv50_graph_fini; 1010 pgraph->base.fini = nv50_graph_fini;