summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-06-02 13:01:09 +1000
committerBen Skeggs <[email protected]>2008-06-29 15:46:13 +1000
commit22e0acc466947b203574c88f4964f61ef46ae3fd (patch)
tree4b4253775401e9981c3ea9ee8d5376ca796b3866
parent207b7974723c6b88aacfa3703a1e049ff35db6a8 (diff)
nv50: split code/data upload out, fp will use it later on
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 12bd419f4cd..97e3eab906f 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -684,16 +684,37 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *p)
p->translated = TRUE;
}
+static void
+nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p)
+{
+ int i;
+
+ for (i = 0; i < p->immd_nr; i++) {
+ BEGIN_RING(tesla, 0x0f00, 2);
+ OUT_RING ((NV50_CB_PMISC << 16) | (i << 8));
+ OUT_RING (fui(p->immd[i]));
+ }
+}
+
+static void
+nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
+{
+ struct pipe_winsys *ws = nv50->pipe.winsys;
+ void *map;
+
+ if (!p->buffer)
+ p->buffer = ws->buffer_create(ws, 0x100, 0, p->insns_nr * 4);
+ map = ws->buffer_map(ws, p->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
+ memcpy(map, p->insns, p->insns_nr * 4);
+ ws->buffer_unmap(ws, p->buffer);
+}
+
void
nv50_vertprog_validate(struct nv50_context *nv50)
{
- struct pipe_winsys *ws = nv50->pipe.winsys;
- struct nouveau_winsys *nvws = nv50->screen->nvws;
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nv50_program *p = nv50->vertprog;
struct nouveau_stateobj *so;
- void *map;
- int i;
if (!p->translated) {
nv50_program_validate(nv50, p);
@@ -701,17 +722,8 @@ nv50_vertprog_validate(struct nv50_context *nv50)
assert(0);
}
- if (!p->buffer)
- p->buffer = ws->buffer_create(ws, 0x100, 0, p->insns_nr * 4);
- map = ws->buffer_map(ws, p->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
- memcpy(map, p->insns, p->insns_nr * 4);
- ws->buffer_unmap(ws, p->buffer);
-
- for (i = 0; i < p->immd_nr; i++) {
- BEGIN_RING(tesla, 0x0f00, 2);
- OUT_RING ((NV50_CB_PMISC << 16) | (i << 8));
- OUT_RING (fui(p->immd[i]));
- }
+ nv50_program_validate_data(nv50, p);
+ nv50_program_validate_code(nv50, p);
so = so_new(11, 2);
so_method(so, tesla, NV50TCL_VP_ADDRESS_HIGH, 2);