summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-06-12 13:50:56 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-06-29 15:46:17 +1000
commitf700d6be6335a4d4394296891f783687b6f2d4f2 (patch)
tree728afaee4322c392a2c2beabfecd9e58c2a1d76d
parentab3d55e2e3578db8deba84dcf47a024071486bd8 (diff)
nv50: remove some cruft, don't upload program unless really needed
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c9
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c33
2 files changed, 10 insertions, 32 deletions
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 4c41e5a7c2..f71aa19312 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -1484,10 +1484,13 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
{
struct pipe_winsys *ws = nv50->pipe.winsys;
struct nv50_program_exec *e;
+ boolean upload = FALSE;
unsigned *map;
- if (!p->buffer)
+ if (!p->buffer) {
p->buffer = ws->buffer_create(ws, 0x100, 0, p->exec_size * 4);
+ upload = TRUE;
+ }
if (p->data && p->data->start != p->data_start) {
for (e = p->exec_head; e; e = e->next) {
@@ -1503,8 +1506,12 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
}
p->data_start = p->data->start;
+ upload = TRUE;
}
+ if (!upload)
+ return FALSE;
+
map = ws->buffer_map(ws, p->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
for (e = p->exec_head; e; e = e->next) {
#ifdef NV50_PROGRAM_DUMP
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 05395c6df7..5f2244e3e8 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -114,10 +114,10 @@ nv50_state_validate(struct nv50_context *nv50)
if (nv50->dirty & NV50_NEW_ZSA)
so_emit(nvws, nv50->zsa->so);
- if (nv50->dirty & NV50_NEW_VERTPROG)
+ if (nv50->dirty & (NV50_NEW_VERTPROG | NV50_NEW_VERTPROG_CB))
nv50_vertprog_validate(nv50);
- if (nv50->dirty & NV50_NEW_FRAGPROG)
+ if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_FRAGPROG_CB))
nv50_fragprog_validate(nv50);
if (nv50->dirty & NV50_NEW_RASTERIZER)
@@ -168,35 +168,6 @@ nv50_state_validate(struct nv50_context *nv50)
so_ref(NULL, &so);
}
- if (nv50->dirty & NV50_NEW_VERTPROG_CB) {
- so = so_new(4, 2);
- so_method(so, tesla, 0x1280, 3);
- so_reloc (so, nv50->constbuf[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_HIGH | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
- 0, 0);
- so_reloc (so, nv50->constbuf[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_LOW | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
- 0, 0);
- so_data (so, (NV50_CB_PVP << 16) | 0x1000);
- so_emit(nvws, so);
- so_ref(NULL, &so);
- }
-
- if (nv50->dirty & NV50_NEW_FRAGPROG_CB) {
- so = so_new(4, 2);
- so_method(so, tesla, 0x1280, 3);
- so_reloc (so, nv50->constbuf[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_HIGH | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
- 0, 0);
- so_reloc (so, nv50->constbuf[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_LOW | NOUVEAU_BO_RD | NOUVEAU_BO_VRAM,
- 0, 0);
- so_data (so, (NV50_CB_PFP << 16) | 0x1000);
- so_emit(nvws, so);
- so_ref(NULL, &so);
- }
-
-
if (nv50->dirty & NV50_NEW_ARRAYS)
nv50_vbo_validate(nv50);