|
@@ -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;
|
|
|
}
|