nv50: remove some cruft, don't upload program unless really needed
authorBen Skeggs <skeggsb@gmail.com>
Thu, 12 Jun 2008 03:50:56 +0000 (13:50 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 29 Jun 2008 05:46:17 +0000 (15:46 +1000)
src/gallium/drivers/nv50/nv50_program.c
src/gallium/drivers/nv50/nv50_state_validate.c

index 4c41e5a7c24cf335ee0026f77f49fbb56d413045..f71aa19312f872c4f6b9a779531f104661c4234c 100644 (file)
@@ -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
index 05395c6df7caf218467990bcd8391df717f72d66..5f2244e3e8048cda6ffc21b074fa7ea1d0fad42a 100644 (file)
@@ -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);