nouveau: adapt to recent gallium changes
authorBen Skeggs <skeggsb@gmail.com>
Sun, 30 Mar 2008 10:32:22 +0000 (20:32 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 30 Mar 2008 10:40:27 +0000 (20:40 +1000)
22 files changed:
src/gallium/drivers/nouveau/nouveau_push.h
src/gallium/drivers/nouveau/nouveau_stateobj.h
src/gallium/drivers/nouveau/nouveau_winsys.h
src/gallium/drivers/nv10/nv10_context.c
src/gallium/drivers/nv10/nv10_state.c
src/gallium/drivers/nv30/nv30_context.c
src/gallium/drivers/nv30/nv30_query.c
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv30/nv30_vbo.c
src/gallium/drivers/nv40/nv40_context.c
src/gallium/drivers/nv40/nv40_draw.c
src/gallium/drivers/nv40/nv40_query.c
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_state_emit.c
src/gallium/drivers/nv40/nv40_vbo.c
src/gallium/drivers/nv50/nv50_context.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/winsys/dri/nouveau/nouveau_context.c
src/gallium/winsys/dri/nouveau/nouveau_winsys.c
src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c

index 225c17744ad33089c53816dc15bce1d6d5c434f6..54ef1c1291e27156f70a712e3c77fe40eb8b4da1 100644 (file)
@@ -27,7 +27,7 @@
 #define BEGIN_RING(obj,mthd,size) do {                                         \
        NOUVEAU_PUSH_CONTEXT(pc);                                              \
        if (pc->nvws->channel->pushbuf->remaining < ((size) + 1))              \
-               pc->nvws->push_flush(pc->nvws, ((size) + 1));                  \
+               pc->nvws->push_flush(pc->nvws, ((size) + 1), NULL);            \
        OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd));             \
        pc->nvws->channel->pushbuf->remaining -= ((size) + 1);                 \
 } while(0)
@@ -36,9 +36,9 @@
        BEGIN_RING(obj, (mthd) | 0x40000000, (size));                          \
 } while(0)
 
-#define FIRE_RING() do {                                                       \
+#define FIRE_RING(fence) do {                                                  \
        NOUVEAU_PUSH_CONTEXT(pc);                                              \
-       pc->nvws->push_flush(pc->nvws, 0);                                     \
+       pc->nvws->push_flush(pc->nvws, 0, fence);                              \
 } while(0)
 
 #define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
@@ -73,7 +73,7 @@
 #define OUT_RELOCm(bo, flags, obj, mthd, size) do {                            \
        NOUVEAU_PUSH_CONTEXT(pc);                                              \
        if (pc->nvws->channel->pushbuf->remaining < ((size) + 1))              \
-               pc->nvws->push_flush(pc->nvws->channel, ((size) + 1));         \
+               pc->nvws->push_flush(pc->nvws->channel, ((size) + 1), NULL);   \
        OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd),      \
                   (flags), 0, 0);                                             \
        pc->nvws->channel->pushbuf->remaining -= ((size) + 1);                 \
index d465223748aaec62cfebca85e6c7f6f1f274794e..d501b76b51ef2b6db9e5a0e6aae5905203215911 100644 (file)
@@ -99,7 +99,7 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
 
        nr = so->cur - so->push;
        if (pb->remaining < nr)
-               nvws->push_flush(nvws, nr);
+               nvws->push_flush(nvws, nr, NULL);
        pb->remaining -= nr;
 
        memcpy(pb->cur, so->push, nr * 4);
@@ -120,7 +120,7 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
 
        i = so->cur_reloc << 1;
        if (nvws->channel->pushbuf->remaining < i)
-               nvws->push_flush(nvws, i);
+               nvws->push_flush(nvws, i, NULL);
        nvws->channel->pushbuf->remaining -= i;
 
        for (i = 0; i < so->cur_reloc; i++) {
index 7fa7cc0910c4f05ef0f8ee9feb8a0222f2fd0492..2a5305f7ce4eddcde5a25c4109422989254559fa 100644 (file)
@@ -27,7 +27,8 @@ struct nouveau_winsys {
        int  (*push_reloc)(struct nouveau_winsys *, void *ptr,
                           struct pipe_buffer *, uint32_t data,
                           uint32_t flags, uint32_t vor, uint32_t tor);
-       int  (*push_flush)(struct nouveau_winsys *, unsigned size);
+       int  (*push_flush)(struct nouveau_winsys *, unsigned size,
+                          struct pipe_fence_handle **fence);
                               
        int       (*grobj_alloc)(struct nouveau_winsys *, int grclass,
                                 struct nouveau_grobj **);
index 2599acf28618e24896a079253efbc8539a4dabe8..14042fb2fbbfa5e4a2b287ba6f8f59edba29fce0 100644 (file)
@@ -7,10 +7,10 @@
 #include "nv10_screen.h"
 
 static void
-nv10_flush(struct pipe_context *pipe, unsigned flags)
+nv10_flush(struct pipe_context *pipe, unsigned flags,
+          struct pipe_fence_handle **fence)
 {
        struct nv10_context *nv10 = nv10_context(pipe);
-       struct nouveau_winsys *nvws = nv10->nvws;
 
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
                BEGIN_RING(celsius, 0x1fd8, 1);
@@ -19,18 +19,7 @@ nv10_flush(struct pipe_context *pipe, unsigned flags)
                OUT_RING  (1);
        }
 
-       if (flags & PIPE_FLUSH_WAIT) {
-               nvws->notifier_reset(nv10->sync, 0);
-               BEGIN_RING(celsius, 0x104, 1);
-               OUT_RING  (0);
-               BEGIN_RING(celsius, 0x100, 1);
-               OUT_RING  (0);
-       }
-
-       FIRE_RING();
-
-       if (flags & PIPE_FLUSH_WAIT)
-               nvws->notifier_wait(nv10->sync, 0, 0, 2000);
+       FIRE_RING(fence);
 }
 
 static void
@@ -253,7 +242,7 @@ nv10_init_hwctx(struct nv10_context *nv10, int celsius_class)
        OUT_RING  (1);
 
 
-       FIRE_RING ();
+       FIRE_RING (NULL);
        return TRUE;
 }
 
index d7c445f1b3921ac8ca0fb01a1c928381ea8655b2..1ff01de1060b0aba001a80b02109098600ed8a24 100644 (file)
@@ -633,24 +633,22 @@ nv10_set_viewport_state(struct pipe_context *pipe,
 }
 
 static void
-nv10_set_vertex_buffer(struct pipe_context *pipe, unsigned index,
-                      const struct pipe_vertex_buffer *vb)
+nv10_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
+                       const struct pipe_vertex_buffer *vb)
 {
        struct nv10_context *nv10 = nv10_context(pipe);
 
-       nv10->vtxbuf[index] = *vb;
-
+       memcpy(nv10->vtxbuf, vb, sizeof(*vb) * count);
        nv10->dirty |= NV10_NEW_ARRAYS;
 }
 
 static void
-nv10_set_vertex_element(struct pipe_context *pipe, unsigned index,
-                       const struct pipe_vertex_element *ve)
+nv10_set_vertex_elements(struct pipe_context *pipe, unsigned count,
+                        const struct pipe_vertex_element *ve)
 {
        struct nv10_context *nv10 = nv10_context(pipe);
 
-       nv10->vtxelt[index] = *ve;
-
+       memcpy(nv10->vtxelt, ve, sizeof(*ve) * count);
        nv10->dirty |= NV10_NEW_ARRAYS;
 }
 
@@ -693,7 +691,7 @@ nv10_init_state_functions(struct nv10_context *nv10)
        nv10->pipe.set_scissor_state = nv10_set_scissor_state;
        nv10->pipe.set_viewport_state = nv10_set_viewport_state;
 
-       nv10->pipe.set_vertex_buffer = nv10_set_vertex_buffer;
-       nv10->pipe.set_vertex_element = nv10_set_vertex_element;
+       nv10->pipe.set_vertex_buffers = nv10_set_vertex_buffers;
+       nv10->pipe.set_vertex_elements = nv10_set_vertex_elements;
 }
 
index cdd662a9f195e58a43d863120f847794ffa60491..1e729d789bd4ef1ed8b60400df2d0ea7e6117c47 100644 (file)
@@ -7,10 +7,10 @@
 #include "nv30_screen.h"
 
 static void
-nv30_flush(struct pipe_context *pipe, unsigned flags)
+nv30_flush(struct pipe_context *pipe, unsigned flags,
+          struct pipe_fence_handle **fence)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
-       struct nouveau_winsys *nvws = nv30->nvws;
        
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
                BEGIN_RING(rankine, 0x1fd8, 1);
@@ -19,18 +19,7 @@ nv30_flush(struct pipe_context *pipe, unsigned flags)
                OUT_RING  (1);
        }
 
-       if (flags & PIPE_FLUSH_WAIT) {
-               nvws->notifier_reset(nv30->sync, 0);
-               BEGIN_RING(rankine, 0x104, 1);
-               OUT_RING  (0);
-               BEGIN_RING(rankine, 0x100, 1);
-               OUT_RING  (0);
-       }
-
-       FIRE_RING();
-
-       if (flags & PIPE_FLUSH_WAIT)
-               nvws->notifier_wait(nv30->sync, 0, 0, 2000);
+       FIRE_RING(fence);
 }
 
 static void
@@ -144,7 +133,7 @@ nv30_init_hwctx(struct nv30_context *nv30, int rankine_class)
        BEGIN_RING(rankine, 0x1e94, 1);
        OUT_RING  (0x13);
 
-       FIRE_RING ();
+       FIRE_RING (NULL);
        return TRUE;
 }
 
index 71fdcfa24dfa962c408fb4d852828ac79ef363ea..e19cb455dceb5381240615230126dfd38b405f1e 100644 (file)
@@ -67,7 +67,7 @@ nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
        BEGIN_RING(rankine, NV34TCL_QUERY_GET, 1);
        OUT_RING  ((0x01 << NV34TCL_QUERY_GET_UNK24_SHIFT) |
                   ((q->object->start * 32) << NV34TCL_QUERY_GET_OFFSET_SHIFT));
-       FIRE_RING();
+       FIRE_RING(NULL);
 }
 
 static boolean
index b0055892aeb7761dd3deadef6ae1a0498b226ad5..983638adccbb1f4db6b54fbefddd85ac436c29ad 100644 (file)
@@ -710,24 +710,22 @@ nv30_set_viewport_state(struct pipe_context *pipe,
 }
 
 static void
-nv30_set_vertex_buffer(struct pipe_context *pipe, unsigned index,
-                      const struct pipe_vertex_buffer *vb)
+nv30_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
+                       const struct pipe_vertex_buffer *vb)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
 
-       nv30->vtxbuf[index] = *vb;
-
+       memcpy(nv30->vtxbuf, vb, sizeof(*vb) * count);
        nv30->dirty |= NV30_NEW_ARRAYS;
 }
 
 static void
-nv30_set_vertex_element(struct pipe_context *pipe, unsigned index,
-                       const struct pipe_vertex_element *ve)
+nv30_set_vertex_elements(struct pipe_context *pipe, unsigned count,
+                        const struct pipe_vertex_element *ve)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
 
-       nv30->vtxelt[index] = *ve;
-
+       memcpy(nv30->vtxelt, ve, sizeof(*ve) * count);
        nv30->dirty |= NV30_NEW_ARRAYS;
 }
 
@@ -770,7 +768,7 @@ nv30_init_state_functions(struct nv30_context *nv30)
        nv30->pipe.set_scissor_state = nv30_set_scissor_state;
        nv30->pipe.set_viewport_state = nv30_set_viewport_state;
 
-       nv30->pipe.set_vertex_buffer = nv30_set_vertex_buffer;
-       nv30->pipe.set_vertex_element = nv30_set_vertex_element;
+       nv30->pipe.set_vertex_buffers = nv30_set_vertex_buffers;
+       nv30->pipe.set_vertex_elements = nv30_set_vertex_elements;
 }
 
index a62462f7bc5a77dc91315580c93634e66035e766..b18a407ec5a085eaf6dbe6ba1b671b712f163862 100644 (file)
@@ -229,7 +229,7 @@ nv30_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
        BEGIN_RING(rankine, NV34TCL_VERTEX_BEGIN_END, 1);
        OUT_RING  (0);
 
-       pipe->flush(pipe, 0);
+       pipe->flush(pipe, 0, NULL);
        return TRUE;
 }
 
@@ -418,7 +418,7 @@ nv30_draw_elements(struct pipe_context *pipe,
                                          mode, start, count);
        }
 
-       pipe->flush(pipe, 0);
+       pipe->flush(pipe, 0, NULL);
        return TRUE;
 }
 
index 7fcf8b86197c42dfca9e6ff3d317539f9a427878..f9c93f7a2d7c84d6a301f66714c0e3b3557a5024 100644 (file)
@@ -7,10 +7,10 @@
 #include "nv40_screen.h"
 
 static void
-nv40_flush(struct pipe_context *pipe, unsigned flags)
+nv40_flush(struct pipe_context *pipe, unsigned flags,
+          struct pipe_fence_handle **fence)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
-       struct nouveau_winsys *nvws = nv40->nvws;
        
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
                BEGIN_RING(curie, 0x1fd8, 1);
@@ -19,18 +19,7 @@ nv40_flush(struct pipe_context *pipe, unsigned flags)
                OUT_RING  (1);
        }
 
-       if (flags & PIPE_FLUSH_WAIT) {
-               nvws->notifier_reset(nv40->screen->sync, 0);
-               BEGIN_RING(curie, 0x104, 1);
-               OUT_RING  (0);
-               BEGIN_RING(curie, 0x100, 1);
-               OUT_RING  (0);
-       }
-
-       FIRE_RING();
-
-       if (flags & PIPE_FLUSH_WAIT)
-               nvws->notifier_wait(nv40->screen->sync, 0, 0, 2000);
+       FIRE_RING(fence);
 }
 
 static void
index d05e5ad19360c2e3cc1e788eda1e334e2a18ff1e..9cd8fa6a497ae5ac40538ba02106b4e99d523f56 100644 (file)
@@ -89,7 +89,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
                        NOUVEAU_ERR("AIII, missed flush\n");
                        assert(0);
                }
-               FIRE_RING();
+               FIRE_RING(NULL);
                nv40_state_emit(nv40);
        }
 
@@ -275,7 +275,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
                ws->buffer_unmap(ws, nv40->constbuf[PIPE_SHADER_VERTEX]);
 
        draw_flush(nv40->draw);
-       pipe->flush(pipe, 0);
+       pipe->flush(pipe, 0, NULL);
 
        return TRUE;
 }
index 15961591b96a7f466294240d83bd860cfdb861b0..57f39cfab0cbfe8e343b876beb9a90a95bf16c62 100644 (file)
@@ -75,7 +75,7 @@ nv40_query_end(struct pipe_context *pipe, struct pipe_query *pq)
        BEGIN_RING(curie, NV40TCL_QUERY_GET, 1);
        OUT_RING  ((0x01 << NV40TCL_QUERY_GET_UNK24_SHIFT) |
                   ((q->object->start * 32) << NV40TCL_QUERY_GET_OFFSET_SHIFT));
-       FIRE_RING();
+       FIRE_RING(NULL);
 }
 
 static boolean
index 75b965bb9d1a83a28f2824d2bc5dc3bb4875a94f..e98005f749f24fb0abd8e04779bf603ba6da97d4 100644 (file)
@@ -266,7 +266,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
 
        so_emit(nvws, so);
        so_ref(NULL, &so);
-       nvws->push_flush(nvws, 0);
+       nvws->push_flush(nvws, 0, NULL);
 
        screen->pipe.winsys = ws;
        screen->pipe.destroy = nv40_screen_destroy;
index 3eafbece309f979f78ab3a05e37c84635c553233..1417c95e758216209db57b4da496c6f929794eda 100644 (file)
@@ -660,26 +660,26 @@ nv40_set_viewport_state(struct pipe_context *pipe,
 }
 
 static void
-nv40_set_vertex_buffer(struct pipe_context *pipe, unsigned index,
-                      const struct pipe_vertex_buffer *vb)
+nv40_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
+                       const struct pipe_vertex_buffer *vb)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       draw_set_vertex_buffer(nv40->draw, index, vb);
+       draw_set_vertex_buffers(nv40->draw, count, vb);
 
-       nv40->vtxbuf[index] = *vb;
+       memcpy(nv40->vtxbuf, vb, sizeof(*vb) * count);
        nv40->dirty |= NV40_NEW_ARRAYS;
 }
 
 static void
-nv40_set_vertex_element(struct pipe_context *pipe, unsigned index,
-                       const struct pipe_vertex_element *ve)
+nv40_set_vertex_elements(struct pipe_context *pipe, unsigned count,
+                        const struct pipe_vertex_element *ve)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       draw_set_vertex_element(nv40->draw, index, ve);
+       draw_set_vertex_elements(nv40->draw, count, ve);
 
-       nv40->vtxelt[index] = *ve;
+       memcpy(nv40->vtxelt, ve, sizeof(*ve) * count);
        nv40->dirty |= NV40_NEW_ARRAYS;
 }
 
@@ -722,7 +722,7 @@ nv40_init_state_functions(struct nv40_context *nv40)
        nv40->pipe.set_scissor_state = nv40_set_scissor_state;
        nv40->pipe.set_viewport_state = nv40_set_viewport_state;
 
-       nv40->pipe.set_vertex_buffer = nv40_set_vertex_buffer;
-       nv40->pipe.set_vertex_element = nv40_set_vertex_element;
+       nv40->pipe.set_vertex_buffers = nv40_set_vertex_buffers;
+       nv40->pipe.set_vertex_elements = nv40_set_vertex_elements;
 }
 
index a9a9abc92200fc78c6fa63fecaf14f1499b10992..74feb6d4bfc5c7b42ae071105aaf2a0972491a1f 100644 (file)
@@ -123,7 +123,7 @@ nv40_state_validate(struct nv40_context *nv40)
                        return FALSE;
 
                /* Attempt to go to hwtnl again */
-               nv40->pipe.flush(&nv40->pipe, 0);
+               nv40->pipe.flush(&nv40->pipe, 0, NULL);
                nv40->dirty |= (NV40_NEW_VIEWPORT |
                                NV40_NEW_VERTPROG |
                                NV40_NEW_ARRAYS |
@@ -147,7 +147,7 @@ nv40_state_validate_swtnl(struct nv40_context *nv40)
        /* Setup for swtnl */
        if (nv40->render_mode == HW) {
                NOUVEAU_ERR("hw->swtnl 0x%08x\n", nv40->fallback_swtnl);
-               nv40->pipe.flush(&nv40->pipe, 0);
+               nv40->pipe.flush(&nv40->pipe, 0, NULL);
                nv40->dirty |= (NV40_NEW_VIEWPORT |
                                NV40_NEW_VERTPROG |
                                NV40_NEW_ARRAYS |
index 4fae10f74b4e8dac039572984064f3f5fa7416ef..b66bf26afb33d416948e11d2bd28a815ea99d3ba 100644 (file)
@@ -209,7 +209,7 @@ nv40_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
        BEGIN_RING(curie, NV40TCL_BEGIN_END, 1);
        OUT_RING  (0);
 
-       pipe->flush(pipe, 0);
+       pipe->flush(pipe, 0, NULL);
        return TRUE;
 }
 
@@ -384,7 +384,7 @@ nv40_draw_elements(struct pipe_context *pipe,
                                          mode, start, count);
        }
 
-       pipe->flush(pipe, 0);
+       pipe->flush(pipe, 0, NULL);
        return TRUE;
 }
 
index 980d066c8443d65ea0ec5f6b18f5390b7be13b82..e822d863945ad0db2d0248fd98be5cf66389d01c 100644 (file)
@@ -7,24 +7,12 @@
 #include "nv50_screen.h"
 
 static void
-nv50_flush(struct pipe_context *pipe, unsigned flags)
+nv50_flush(struct pipe_context *pipe, unsigned flags,
+          struct pipe_fence_handle **fence)
 {
        struct nv50_context *nv50 = (struct nv50_context *)pipe;
-       struct nv50_screen *screen = nv50->screen;
-       struct nouveau_winsys *nvws = screen->nvws;
        
-       if (flags & PIPE_FLUSH_WAIT) {
-               nvws->notifier_reset(screen->sync, 0);
-               BEGIN_RING(tesla, 0x104, 1);
-               OUT_RING  (0);
-               BEGIN_RING(tesla, 0x100, 1);
-               OUT_RING  (0);
-       }
-
-       FIRE_RING();
-
-       if (flags & PIPE_FLUSH_WAIT)
-               nvws->notifier_wait(screen->sync, 0, 0, 2000);
+       FIRE_RING(fence);
 }
 
 static void
index ff4aca81a5a5c93e18c2387055ae90d3516dfafc..586373a5c4bcfa41aaf375cca8e89272c4f3c26f 100644 (file)
@@ -171,7 +171,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
 
        so_emit(nvws, so);
        so_ref(NULL, &so);
-       nvws->push_flush(nvws, 0);
+       nvws->push_flush(nvws, 0, NULL);
 
        screen->pipe.winsys = ws;
 
index b096a2583d793f28b5f5844c4e2ac462dcfd79d2..a614ea033587bd63ca6ae168688f3cfd290f2d28 100644 (file)
@@ -422,14 +422,14 @@ nv50_set_viewport_state(struct pipe_context *pipe,
 }
 
 static void
-nv50_set_vertex_buffer(struct pipe_context *pipe, unsigned index,
-                      const struct pipe_vertex_buffer *vb)
+nv50_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
+                       const struct pipe_vertex_buffer *vb)
 {
 }
 
 static void
-nv50_set_vertex_element(struct pipe_context *pipe, unsigned index,
-                       const struct pipe_vertex_element *ve)
+nv50_set_vertex_elements(struct pipe_context *pipe, unsigned count,
+                        const struct pipe_vertex_element *ve)
 {
 }
 
@@ -472,7 +472,7 @@ nv50_init_state_functions(struct nv50_context *nv50)
        nv50->pipe.set_scissor_state = nv50_set_scissor_state;
        nv50->pipe.set_viewport_state = nv50_set_viewport_state;
 
-       nv50->pipe.set_vertex_buffer = nv50_set_vertex_buffer;
-       nv50->pipe.set_vertex_element = nv50_set_vertex_element;
+       nv50->pipe.set_vertex_buffers = nv50_set_vertex_buffers;
+       nv50->pipe.set_vertex_elements = nv50_set_vertex_elements;
 }
 
index 336dd65847b79c36d0843944f5732cb53fc586d5..cf1d83b18f40c6f988fed960dd15879300254e81 100644 (file)
@@ -282,7 +282,7 @@ nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
 
        assert(nv);
 
-       st_flush(nv->st, PIPE_FLUSH_WAIT);
+       st_finish(nv->st);
        st_destroy_context(nv->st);
 
        if (nv->pctx_id >= 0) {
@@ -337,7 +337,7 @@ nouveau_context_unbind(__DRIcontextPrivate *driContextPriv)
        struct nouveau_context *nv = driContextPriv->driverPrivate;
        (void)nv;
 
-       st_flush(nv->st, 0);
+       st_flush(nv->st, 0, NULL);
        return GL_TRUE;
 }
 
index bf1afce5d9daf6658cb054c8937b0b8d952867be..60fdbb8dfdf03fdae721fb1f108d519bce0f4841 100644 (file)
@@ -69,8 +69,18 @@ nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr,
 }
 
 static int
-nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size)
+nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size,
+                       struct pipe_fence_handle **fence)
 {
+       if (fence) {
+               struct nouveau_pushbuf *pb = nvws->channel->pushbuf;
+               struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(pb);
+               struct nouveau_fence *ref = NULL;
+
+               nouveau_fence_ref(nvpb->fence, &ref);
+               *fence = (struct pipe_fence_handle *)ref;
+       }
+
        return nouveau_pushbuf_flush(nvws->channel, size);
 }
 
index e1a9271395b21e558433f5ac23eebbd6a41a9e49..453b3623f4ab65662bf2084b2627d94cb3e10dd8 100644 (file)
@@ -164,6 +164,44 @@ nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
        nouveau_bo_unmap(nvbuf->bo);
 }
 
+static INLINE struct nouveau_fence *
+nouveau_pipe_fence(struct pipe_fence_handle *pfence)
+{
+       return (struct nouveau_fence *)pfence;
+}
+
+static void
+nouveau_pipe_fence_reference(struct pipe_winsys *ws,
+                            struct pipe_fence_handle **ptr,
+                            struct pipe_fence_handle *pfence)
+{
+       nouveau_fence_ref((void *)pfence, (void *)ptr);
+}
+
+static int
+nouveau_pipe_fence_signalled(struct pipe_winsys *ws,
+                            struct pipe_fence_handle *pfence, unsigned flag)
+{
+       struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)ws;
+       struct nouveau_fence *fence = nouveau_pipe_fence(pfence);
+
+       if (nouveau_fence(fence)->signalled == 0)
+               nouveau_fence_flush(nvpws->nv->nvc->channel);
+
+       return !nouveau_fence(fence)->signalled;
+}
+
+static int
+nouveau_pipe_fence_finish(struct pipe_winsys *ws,
+                         struct pipe_fence_handle *pfence, unsigned flag)
+{
+       struct nouveau_fence *fence = nouveau_pipe_fence(pfence);
+       struct nouveau_fence *ref = NULL;
+
+       nouveau_fence_ref(fence, &ref);
+       return nouveau_fence_wait(&ref);
+}
+
 struct pipe_winsys *
 nouveau_create_pipe_winsys(struct nouveau_context *nv)
 {
@@ -189,6 +227,10 @@ nouveau_create_pipe_winsys(struct nouveau_context *nv)
        pws->buffer_map = nouveau_pipe_bo_map;
        pws->buffer_unmap = nouveau_pipe_bo_unmap;
 
+       pws->fence_reference = nouveau_pipe_fence_reference;
+       pws->fence_signalled = nouveau_pipe_fence_signalled;
+       pws->fence_finish = nouveau_pipe_fence_finish;
+
        pws->get_name = nouveau_get_name;
 
        return &nvpws->pws;