Re: [Mesa-dev] [PATCH 2/2] st/mesa: Refactor st_check_sync to use st_client_wait_sync

2016-10-12 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 12.10.2016 11:31, Michel Dänzer wrote:

From: Michel Dänzer 

Duplicate code cleanup, no functional change intended.

Signed-off-by: Michel Dänzer 
---
 src/mesa/state_tracker/st_cb_syncobj.c | 28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_syncobj.c 
b/src/mesa/state_tracker/st_cb_syncobj.c
index de01880..6e2cb26 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -76,29 +76,6 @@ static void st_fence_sync(struct gl_context *ctx, struct 
gl_sync_object *obj,
pipe->flush(pipe, >fence, PIPE_FLUSH_DEFERRED);
 }

-static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct st_sync_object *so = (struct st_sync_object*)obj;
-   struct pipe_fence_handle *fence = NULL;
-
-   screen->fence_reference(screen, , so->fence);
-
-   /* If the fence doesn't exist, assume it's signalled. */
-   if (!fence) {
-  so->b.StatusFlag = GL_TRUE;
-  return;
-   }
-
-   if (screen->fence_finish(screen, pipe, fence, 0)) {
-  screen->fence_reference(screen, >fence, NULL);
-  so->b.StatusFlag = GL_TRUE;
-   }
-
-   screen->fence_reference(screen, , NULL);
-}
-
 static void st_client_wait_sync(struct gl_context *ctx,
 struct gl_sync_object *obj,
 GLbitfield flags, GLuint64 timeout)
@@ -136,6 +113,11 @@ static void st_client_wait_sync(struct gl_context *ctx,
screen->fence_reference(screen, , NULL);
 }

+static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
+{
+   st_client_wait_sync(ctx, obj, 0, 0);
+}
+
 static void st_server_wait_sync(struct gl_context *ctx,
 struct gl_sync_object *obj,
 GLbitfield flags, GLuint64 timeout)


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] st/mesa: Refactor st_check_sync to use st_client_wait_sync

2016-10-12 Thread Michel Dänzer
From: Michel Dänzer 

Duplicate code cleanup, no functional change intended.

Signed-off-by: Michel Dänzer 
---
 src/mesa/state_tracker/st_cb_syncobj.c | 28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_syncobj.c 
b/src/mesa/state_tracker/st_cb_syncobj.c
index de01880..6e2cb26 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -76,29 +76,6 @@ static void st_fence_sync(struct gl_context *ctx, struct 
gl_sync_object *obj,
pipe->flush(pipe, >fence, PIPE_FLUSH_DEFERRED);
 }
 
-static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
-{
-   struct pipe_context *pipe = st_context(ctx)->pipe;
-   struct pipe_screen *screen = pipe->screen;
-   struct st_sync_object *so = (struct st_sync_object*)obj;
-   struct pipe_fence_handle *fence = NULL;
-
-   screen->fence_reference(screen, , so->fence);
-
-   /* If the fence doesn't exist, assume it's signalled. */
-   if (!fence) {
-  so->b.StatusFlag = GL_TRUE;
-  return;
-   }
-
-   if (screen->fence_finish(screen, pipe, fence, 0)) {
-  screen->fence_reference(screen, >fence, NULL);
-  so->b.StatusFlag = GL_TRUE;
-   }
-
-   screen->fence_reference(screen, , NULL);
-}
-
 static void st_client_wait_sync(struct gl_context *ctx,
 struct gl_sync_object *obj,
 GLbitfield flags, GLuint64 timeout)
@@ -136,6 +113,11 @@ static void st_client_wait_sync(struct gl_context *ctx,
screen->fence_reference(screen, , NULL);
 }
 
+static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
+{
+   st_client_wait_sync(ctx, obj, 0, 0);
+}
+  
 static void st_server_wait_sync(struct gl_context *ctx,
 struct gl_sync_object *obj,
 GLbitfield flags, GLuint64 timeout)
-- 
2.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev