History

drm/nv40: allocate ctxprog with kmalloc

Some archs defconfigs have CONFIG_FRAME_WARN set to 1024, which lead to this warning: drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c: warning: the frame size of 1184 bytes is larger than 1024 bytes

Marcin Slusarz committed 14 years ago

Commit 1f150b31 parent 41130143 files · +13 −5Browse files

Unified · Split

3 files
  1. drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c +9 −3
  2. drivers/gpu/drm/nouveau/core/engine/graph/nv40.c +3 −1
  3. drivers/gpu/drm/nouveau/core/engine/graph/nv40.h +1 −1
drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c+9−3
@@ -669,21 +669,27 @@ nv40_grctx_fill(struct nouveau_device *device, struct nouveau_gpuobj *mem) · 668 unmodified lines
669669 });
670670 }
671671
672−void
672+int
673673 nv40_grctx_init(struct nouveau_device *device, u32 *size)
674674 {
675− u32 ctxprog[256], i;
675+ u32 *ctxprog = kmalloc(256 * 4, GFP_KERNEL), i;
676676 struct nouveau_grctx ctx = {
677677 .device = device,
678678 .mode = NOUVEAU_GRCTX_PROG,
679679 .data = ctxprog,
680− .ctxprog_max = ARRAY_SIZE(ctxprog)
680+ .ctxprog_max = 256,
681681 };
682682
683+ if (!ctxprog)
684+ return -ENOMEM;
685+
683686 nv40_grctx_generate(&ctx);
684687
685688 nv_wr32(device, 0x400324, 0);
686689 for (i = 0; i < ctx.ctxprog_len; i++)
687690 nv_wr32(device, 0x400328, ctxprog[i]);
688691 *size = ctx.ctxvals_pos * 4;
692+
693+ kfree(ctxprog);
694+ return 0;
689695 }
drivers/gpu/drm/nouveau/core/engine/graph/nv40.c+3−1
@@ -346,7 +346,9 @@ nv40_graph_init(struct nouveau_object *object) · 345 unmodified lines
346346 return ret;
347347
348348 /* generate and upload context program */
349− nv40_grctx_init(nv_device(priv), &priv->size);
349+ ret = nv40_grctx_init(nv_device(priv), &priv->size);
350+ if (ret)
351+ return ret;
350352
351353 /* No context present currently */
352354 nv_wr32(priv, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
drivers/gpu/drm/nouveau/core/engine/graph/nv40.h+1−1
@@ -15,7 +15,7 @@ nv44_graph_class(void *priv) · 14 unmodified lines
1515 return !(0x0baf & (1 << (device->chipset & 0x0f)));
1616 }
1717
18−void nv40_grctx_init(struct nouveau_device *, u32 *size);
18+int nv40_grctx_init(struct nouveau_device *, u32 *size);
1919 void nv40_grctx_fill(struct nouveau_device *, struct nouveau_gpuobj *);
2020
2121 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t