summaryrefslogtreecommitdiff
path: root/src/nv30_exa.c
diff options
context:
space:
mode:
authorStuart Bennett <sb476@cam.ac.uk>2008-10-22 02:15:06 +0100
committerStuart Bennett <sb476@cam.ac.uk>2008-10-22 14:12:36 +0100
commit1cedb8e49c832890efd12904e78dfd8ab5855691 (patch)
treef0751fb8ac9f4de2fd1a50e244a2b6770dcd7a01 /src/nv30_exa.c
parent9e2c08937b0d1bfed71997b2b16bded91830af71 (diff)
downloadxorg-driver-xf86-video-nouveau-1cedb8e49c832890efd12904e78dfd8ab5855691.tar.gz
Do frag prog allocation and shader upload in TCL init
Similar in spirit to the nv50 inplementation. Removes many dependencies on state stored in static variables, which in turn makes reinitializing shaders on resume / server regeneration tractable.
Diffstat (limited to 'src/nv30_exa.c')
-rw-r--r--src/nv30_exa.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/nv30_exa.c b/src/nv30_exa.c
index bc7d1f9..b5cbbdf 100644
--- a/src/nv30_exa.c
+++ b/src/nv30_exa.c
@@ -607,7 +607,7 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
struct nouveau_channel *chan = pNv->chan;
struct nouveau_grobj *rankine;
uint32_t class = 0, chipset;
- int i;
+ int next_hw_offset = 0, i;
if (!nv40_fp_map_a8[0])
NV30EXAHackupA8Shaders(pScrn);
@@ -640,6 +640,22 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
}
rankine = pNv->Nv3D;
+ if (!pNv->shader_mem) {
+ if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_PIN,
+ 0, 0x1000, &pNv->shader_mem)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't alloc fragprog buffer!\n");
+ nouveau_grobj_free(&pNv->Nv3D);
+ return FALSE;
+ }
+ if (nouveau_bo_map(pNv->shader_mem, NOUVEAU_BO_RDWR)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't map fragprog buffer!\n");
+ nouveau_grobj_free(&pNv->Nv3D);
+ return FALSE;
+ }
+ }
+
BEGIN_RING(chan, rankine, NV34TCL_DMA_TEXTURE0, 3);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->gart->handle);
@@ -833,6 +849,12 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
OUT_RING (chan, 4096<<16);
OUT_RING (chan, 4096<<16);
+ for (i = 0; i < NV30EXA_FPID_MAX; i++) {
+ NV30_UploadFragProg(pNv, nv40_fp_map[i], &next_hw_offset);
+ NV30_UploadFragProg(pNv, nv40_fp_map_a8[i], &next_hw_offset);
+ }
+ NV30_UploadFragProg(pNv, &nv30_fp_yv12_bicubic, &next_hw_offset);
+ NV30_UploadFragProg(pNv, &nv30_fp_yv12_bilinear, &next_hw_offset);
+
return TRUE;
}
-