X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_cb_syncobj.c;h=ec2687fba53010178de36be7a8f96e818c7e42f5;hb=d082c5324914212f76e45be497229c7a0681f706;hp=85aad08cc7013ac2c137dd58d0ec1afa308b2c23;hpb=b39bccbd4ed71e9585da4cf5acf7b887b2e90899;p=mesa.git diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index 85aad08cc70..ec2687fba53 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -60,7 +60,8 @@ static void st_delete_sync_object(struct gl_context *ctx, struct st_sync_object *so = (struct st_sync_object*)obj; screen->fence_reference(screen, &so->fence, NULL); - FREE(so); + free(so->b.Label); + free(so); } static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, @@ -72,7 +73,7 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); assert(so->fence == NULL); - pipe->flush(pipe, 0, &so->fence); + pipe->flush(pipe, &so->fence, 0); } static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) @@ -80,7 +81,13 @@ static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) struct pipe_screen *screen = st_context(ctx)->pipe->screen; struct st_sync_object *so = (struct st_sync_object*)obj; - if (so->fence && screen->fence_signalled(screen, so->fence, 0) == 0) { + /* If the fence doesn't exist, assume it's signalled. */ + if (!so->fence) { + so->b.StatusFlag = GL_TRUE; + return; + } + + if (screen->fence_finish(screen, so->fence, 0)) { screen->fence_reference(screen, &so->fence, NULL); so->b.StatusFlag = GL_TRUE; } @@ -93,11 +100,17 @@ static void st_client_wait_sync(struct gl_context *ctx, struct pipe_screen *screen = st_context(ctx)->pipe->screen; struct st_sync_object *so = (struct st_sync_object*)obj; + /* If the fence doesn't exist, assume it's signalled. */ + if (!so->fence) { + so->b.StatusFlag = GL_TRUE; + return; + } + /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is * already called when creating a fence. */ if (so->fence && - screen->fence_finish(screen, so->fence, 0, timeout) == 0) { + screen->fence_finish(screen, so->fence, timeout)) { screen->fence_reference(screen, &so->fence, NULL); so->b.StatusFlag = GL_TRUE; }