Mesa (master): softpipe: add a better fake implementation of fences

Marek Olšák mareko at kemper.freedesktop.org
Thu Jun 2 14:53:02 UTC 2011


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Jun  2 00:50:45 2011 +0200

softpipe: add a better fake implementation of fences

The flush function, when asked for, should not return a NULL fence.

NULL can only be returned if fences are not implemented, and st/mesa
doesn't call any of the fence functions if it receives a NULL fence
(because some drivers don't even set the fence hooks).

ARB_sync is exposed if fence_finish is set.

---

 src/gallium/drivers/softpipe/sp_fence.c |    7 +++----
 src/gallium/drivers/softpipe/sp_flush.c |    4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c
index 7b79a0d..c2897ed 100644
--- a/src/gallium/drivers/softpipe/sp_fence.c
+++ b/src/gallium/drivers/softpipe/sp_fence.c
@@ -36,8 +36,7 @@ softpipe_fence_reference(struct pipe_screen *screen,
                          struct pipe_fence_handle **ptr,
                          struct pipe_fence_handle *fence)
 {
-   assert(!*ptr);
-   assert(!fence);
+   *ptr = fence;
 }
 
 
@@ -45,7 +44,7 @@ static boolean
 softpipe_fence_signalled(struct pipe_screen *screen,
                          struct pipe_fence_handle *fence)
 {
-   assert(!fence);
+   assert(fence);
    return TRUE;
 }
 
@@ -55,7 +54,7 @@ softpipe_fence_finish(struct pipe_screen *screen,
                       struct pipe_fence_handle *fence,
                       uint64_t timeout)
 {
-   assert(!fence);
+   assert(fence);
    return TRUE;
 }
 
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 720fea8..a2733e9 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -96,9 +96,9 @@ softpipe_flush( struct pipe_context *pipe,
       ++frame_no;
    }
 #endif
-   
+
    if (fence)
-      *fence = NULL;
+      *fence = (void*)(intptr_t)1;
 }
 
 void




More information about the mesa-commit mailing list