summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-11-22 09:14:24 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2012-11-22 09:14:24 -1000
commit0e0f092ef0c474c3996c8e023d1724f4f72132ad (patch)
tree75dd885e2d2234fc3175951403fcf9754c617b30 /drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
parentef6c5be658f6a70c1256fbd18e18ee0dc24c3386 (diff)
parent452f19201f35d20a1a6c9009acbcfa6799163c6a (diff)
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie. Small fixes for (mostly Nouveau, some radeon) regressions. * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/nouveau: use the correct fence implementation for nv50 drm/radeon: add new SI pci id radeon: add AGPMode 1 quirk for RV250 drm/radeon: properly track the crtc not_enabled case evergreen_mc_stop() drm/nouveau/bios: fix DCB v1.5 parsing drm/nouveau: add missing pll_calc calls drm/nouveau: fix crash with noaccel=1 drm/nv40: allocate ctxprog with kmalloc drm/nvc0/disp: fix thinko in vblank regression fix..
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c')
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
index e45035efb8c..7bbb1e1b7a8 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
@@ -669,21 +669,27 @@ nv40_grctx_fill(struct nouveau_device *device, struct nouveau_gpuobj *mem)
});
}
-void
+int
nv40_grctx_init(struct nouveau_device *device, u32 *size)
{
- u32 ctxprog[256], i;
+ u32 *ctxprog = kmalloc(256 * 4, GFP_KERNEL), i;
struct nouveau_grctx ctx = {
.device = device,
.mode = NOUVEAU_GRCTX_PROG,
.data = ctxprog,
- .ctxprog_max = ARRAY_SIZE(ctxprog)
+ .ctxprog_max = 256,
};
+ if (!ctxprog)
+ return -ENOMEM;
+
nv40_grctx_generate(&ctx);
nv_wr32(device, 0x400324, 0);
for (i = 0; i < ctx.ctxprog_len; i++)
nv_wr32(device, 0x400328, ctxprog[i]);
*size = ctx.ctxvals_pos * 4;
+
+ kfree(ctxprog);
+ return 0;
}