Module: Mesa
Branch: master
Commit: 4112ca54e3769ca2ceeb4d82a4e2bc3dc52cc134
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4112ca54e3769ca2ceeb4d82a4e2bc3dc52cc134

Author: Ben Skeggs <[email protected]>
Date:   Tue Jun 21 12:55:01 2011 +1000

nvfx: nasty hack to make glFinish() actually finish..

Signed-off-by: Ben Skeggs <[email protected]>

---

 src/gallium/drivers/nvfx/nvfx_context.c |   16 ++++++++++++++--
 src/gallium/drivers/nvfx/nvfx_screen.c  |    7 +++++++
 src/gallium/drivers/nvfx/nvfx_screen.h  |    1 +
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_context.c 
b/src/gallium/drivers/nvfx/nvfx_context.c
index 2b15102..98603be 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.c
+++ b/src/gallium/drivers/nvfx/nvfx_context.c
@@ -24,9 +24,21 @@ nvfx_flush(struct pipe_context *pipe,
                OUT_RING(chan, 1);
         }*/
 
-       FIRE_RING(chan);
-       if (fence)
+       if (fence) {
+               /* horrific hack to make glFinish() work in the absence of
+                * having proper fences in nvfx.  a pending rewrite will
+                * fix this properly, but may be a while off.
+                */
+               MARK_RING(chan, 1, 1);
+               OUT_RELOC(chan, screen->fence, 0, NOUVEAU_BO_WR |
+                               NOUVEAU_BO_DUMMY, 0, 0);
+               FIRE_RING(chan);
+               nouveau_bo_map(screen->fence, NOUVEAU_BO_RDWR);
+               nouveau_bo_unmap(screen->fence);
                *fence = NULL;
+       } else {
+               FIRE_RING(chan);
+       }
 }
 
 static void
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c 
b/src/gallium/drivers/nvfx/nvfx_screen.c
index 475138c..7a013a9 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -304,6 +304,7 @@ nvfx_screen_destroy(struct pipe_screen *pscreen)
        nouveau_notifier_free(&screen->sync);
        nouveau_grobj_free(&screen->eng3d);
        nvfx_screen_surface_takedown(pscreen);
+       nouveau_bo_ref(NULL, &screen->fence);
 
        nouveau_screen_fini(&screen->base);
 
@@ -468,6 +469,12 @@ nvfx_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
        pscreen->is_format_supported = nvfx_screen_is_format_supported;
        pscreen->context_create = nvfx_create;
 
+       ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 4096, &screen->fence);
+       if (ret) {
+               nvfx_screen_destroy(pscreen);
+               return NULL;
+       }
+
        switch (dev->chipset & 0xf0) {
        case 0x30:
                if (NV30_3D_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h 
b/src/gallium/drivers/nvfx/nvfx_screen.h
index b1f0718..02e7c5d 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -11,6 +11,7 @@ struct nvfx_screen {
        struct nouveau_screen base;
 
        struct nouveau_winsys *nvws;
+       struct nouveau_bo *fence;
 
        struct nvfx_context *cur_ctx;
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to