nouveau: call notifier/grobj etc funcs directly
[mesa.git] / src / gallium / drivers / nv40 / nv40_vertprog.c
index ff988e6a5f4164cc5b6fa3f6213504d552bdf844..f32d4d690ce5cfbb21905d17fb79b997bbe319ac 100644 (file)
@@ -571,7 +571,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
        case TGSI_OPCODE_RET:
                break;
        case TGSI_OPCODE_RSQ:
-               arith(vpc, 1, OP_RSQ, dst, mask, none, none, src[0]);
+               arith(vpc, 1, OP_RSQ, dst, mask, none, none, abs(src[0]));
                break;
        case TGSI_OPCODE_SGE:
                arith(vpc, 0, OP_SGE, dst, mask, src[0], src[1], none);
@@ -784,7 +784,7 @@ nv40_vertprog_translate(struct nv40_context *nv40,
 
                        imm = &parse.FullToken.FullImmediate;
                        assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
-//                     assert(imm->Immediate.Size == 4);
+                       assert(imm->Immediate.NrTokens == 4 + 1);
                        vpc->imm[vpc->nr_imm++] =
                                constant(vpc, -1,
                                         imm->u.ImmediateFloat32[0].Float,
@@ -855,7 +855,6 @@ out_err:
 static boolean
 nv40_vertprog_validate(struct nv40_context *nv40)
 { 
-       struct nouveau_winsys *nvws = nv40->nvws;
        struct pipe_winsys *ws = nv40->pipe.winsys;
        struct nouveau_grobj *curie = nv40->screen->curie;
        struct nv40_vertex_program *vp;
@@ -895,15 +894,15 @@ check_gpu_resources:
                struct nouveau_stateobj *so;
                uint vplen = vp->nr_insns;
 
-               if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) {
+               if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
                        while (heap->next && heap->size < vplen) {
                                struct nv40_vertex_program *evict;
                                
                                evict = heap->next->priv;
-                               nvws->res_free(&evict->exec);
+                               nouveau_resource_free(&evict->exec);
                        }
 
-                       if (nvws->res_alloc(heap, vplen, vp, &vp->exec))
+                       if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec))
                                assert(0);
                }
 
@@ -916,6 +915,7 @@ check_gpu_resources:
                so_method(so, curie,  NV40TCL_CLIP_PLANE_ENABLE, 1);
                so_data  (so, vp->clip_ctrl);
                so_ref(so, &vp->so);
+               so_ref(NULL, &so);
 
                upload_code = TRUE;
        }
@@ -924,15 +924,15 @@ check_gpu_resources:
        if (vp->nr_consts && !vp->data) {
                struct nouveau_resource *heap = nv40->screen->vp_data_heap;
 
-               if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) {
+               if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
                        while (heap->next && heap->size < vp->nr_consts) {
                                struct nv40_vertex_program *evict;
                                
                                evict = heap->next->priv;
-                               nvws->res_free(&evict->data);
+                               nouveau_resource_free(&evict->data);
                        }
 
-                       if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data))
+                       if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data))
                                assert(0);
                }
 
@@ -1034,8 +1034,6 @@ check_gpu_resources:
 void
 nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp)
 {
-       struct nouveau_winsys *nvws = nv40->screen->nvws;
-
        vp->translated = FALSE;
 
        if (vp->nr_insns) {
@@ -1050,9 +1048,9 @@ nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp)
                vp->nr_consts = 0;
        }
 
-       nvws->res_free(&vp->exec);
+       nouveau_resource_free(&vp->exec);
        vp->exec_start = 0;
-       nvws->res_free(&vp->data);
+       nouveau_resource_free(&vp->data);
        vp->data_start = 0;
        vp->data_start_min = 0;