nouveau: pass nouveau_bo instead of pipe_buffer to so_ calls
[mesa.git] / src / gallium / drivers / nv40 / nv40_fragprog.c
index 91dcbebda0d03723efbb6a4167b91e9a75452cf1..b45dfaa913d26613636464a1b7a0d1d2c49397a3 100644 (file)
@@ -917,6 +917,7 @@ nv40_fragprog_validate(struct nv40_context *nv40)
        struct nv40_fragment_program *fp = nv40->fragprog;
        struct pipe_buffer *constbuf =
                nv40->constbuf[PIPE_SHADER_FRAGMENT];
+       struct pipe_screen *screen = nv40->pipe.screen;
        struct pipe_winsys *ws = nv40->pipe.winsys;
        struct nouveau_stateobj *so;
        boolean new_consts = FALSE;
@@ -932,17 +933,19 @@ nv40_fragprog_validate(struct nv40_context *nv40)
                return FALSE;
        }
 
-       fp->buffer = ws->buffer_create(ws, 0x100, 0, fp->insn_len * 4);
+       fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4);
        nv40_fragprog_upload(nv40, fp);
 
        so = so_new(4, 1);
        so_method(so, nv40->screen->curie, NV40TCL_FP_ADDRESS, 1);
-       so_reloc (so, fp->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
-                 NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
-                 NV40TCL_FP_ADDRESS_DMA0, NV40TCL_FP_ADDRESS_DMA1);
+       so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM |
+                     NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
+                     NOUVEAU_BO_OR, NV40TCL_FP_ADDRESS_DMA0,
+                     NV40TCL_FP_ADDRESS_DMA1);
        so_method(so, nv40->screen->curie, NV40TCL_FP_CONTROL, 1);
        so_data  (so, fp->fp_control);
        so_ref(so, &fp->so);
+       so_ref(NULL, &so);
 
 update_constants:
        if (fp->nr_consts) {