summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-03-05 21:23:54 +0100
committerMarek Olšák <maraeo@gmail.com>2011-03-08 23:52:37 +0100
commitb39bccbd4ed71e9585da4cf5acf7b887b2e90899 (patch)
tree8aafddda49b4d4e4cdf19ec76350583b7c4d41b4
parent5257a6dbc65d742e6d0fcf4278a4157b2f39fdf7 (diff)
gallium: add timeout parameter to fence_finish
This is a follow-up to the ARB_sync patch for st/mesa and completes the ARB_sync implementation.
-rw-r--r--src/gallium/auxiliary/util/u_simple_screen.h3
-rw-r--r--src/gallium/drivers/cell/ppu/cell_fence.c7
-rw-r--r--src/gallium/drivers/cell/ppu/cell_fence.h7
-rw-r--r--src/gallium/drivers/galahad/glhd_screen.c6
-rw-r--r--src/gallium/drivers/i915/i915_screen.c3
-rw-r--r--src/gallium/drivers/i965/brw_screen.c3
-rw-r--r--src/gallium/drivers/identity/id_screen.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/rbug/rbug_screen.c6
-rw-r--r--src/gallium/drivers/softpipe/sp_fence.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c3
-rw-r--r--src/gallium/drivers/svga/svga_context.c3
-rw-r--r--src/gallium/drivers/svga/svga_screen.c3
-rw-r--r--src/gallium/drivers/trace/tr_screen.c6
-rw-r--r--src/gallium/include/pipe/p_defines.h2
-rw-r--r--src/gallium/include/pipe/p_screen.h4
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c2
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_sync.c2
-rw-r--r--src/gallium/state_trackers/egl/common/native_helper.c2
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c3
-rw-r--r--src/gallium/state_trackers/vega/api_context.c3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c6
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c3
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c3
-rw-r--r--src/mesa/state_tracker/st_cb_syncobj.c4
29 files changed, 71 insertions, 36 deletions
diff --git a/src/gallium/auxiliary/util/u_simple_screen.h b/src/gallium/auxiliary/util/u_simple_screen.h
index 7139aaabc5..7caeb75cd2 100644
--- a/src/gallium/auxiliary/util/u_simple_screen.h
+++ b/src/gallium/auxiliary/util/u_simple_screen.h
@@ -159,7 +159,8 @@ struct pipe_winsys
*/
int (*fence_finish)( struct pipe_winsys *ws,
struct pipe_fence_handle *fence,
- unsigned flag );
+ unsigned flags,
+ uint64_t timeout );
};
diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c
index e7c9fc46d9..3014a8a7b8 100644
--- a/src/gallium/drivers/cell/ppu/cell_fence.c
+++ b/src/gallium/drivers/cell/ppu/cell_fence.c
@@ -47,7 +47,8 @@ cell_fence_init(struct cell_fence *fence)
boolean
cell_fence_signalled(const struct cell_context *cell,
- const struct cell_fence *fence)
+ const struct cell_fence *fence,
+ unsigned flags)
{
uint i;
for (i = 0; i < cell->num_spus; i++) {
@@ -61,7 +62,9 @@ cell_fence_signalled(const struct cell_context *cell,
void
cell_fence_finish(const struct cell_context *cell,
- const struct cell_fence *fence)
+ const struct cell_fence *fence,
+ unsigned flags,
+ uint64_t timeout)
{
while (!cell_fence_signalled(cell, fence)) {
usleep(10);
diff --git a/src/gallium/drivers/cell/ppu/cell_fence.h b/src/gallium/drivers/cell/ppu/cell_fence.h
index 536b4ba411..3ef6cf7bbc 100644
--- a/src/gallium/drivers/cell/ppu/cell_fence.h
+++ b/src/gallium/drivers/cell/ppu/cell_fence.h
@@ -36,12 +36,15 @@ cell_fence_init(struct cell_fence *fence);
extern boolean
cell_fence_signalled(const struct cell_context *cell,
- const struct cell_fence *fence);
+ const struct cell_fence *fence,
+ unsigned flags);
extern void
cell_fence_finish(const struct cell_context *cell,
- const struct cell_fence *fence);
+ const struct cell_fence *fence,
+ unsigned flags,
+ uint64_t timeout);
diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c
index b4825bef66..fbe19bf324 100644
--- a/src/gallium/drivers/galahad/glhd_screen.c
+++ b/src/gallium/drivers/galahad/glhd_screen.c
@@ -292,14 +292,16 @@ galahad_screen_fence_signalled(struct pipe_screen *_screen,
static int
galahad_screen_fence_finish(struct pipe_screen *_screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct galahad_screen *glhd_screen = galahad_screen(_screen);
struct pipe_screen *screen = glhd_screen->screen;
return screen->fence_finish(screen,
fence,
- flags);
+ flags,
+ timeout);
}
struct pipe_screen *
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 64c4bbab39..39f65f8c8f 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -331,7 +331,8 @@ i915_fence_signalled(struct pipe_screen *screen,
static int
i915_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct i915_screen *is = i915_screen(screen);
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index bf805fd080..367581a6b4 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -376,7 +376,8 @@ brw_fence_signalled(struct pipe_screen *screen,
static int
brw_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
return 0;
}
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 644481bb74..b289c1e5d1 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -258,14 +258,16 @@ identity_screen_fence_signalled(struct pipe_screen *_screen,
static int
identity_screen_fence_finish(struct pipe_screen *_screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
return screen->fence_finish(screen,
fence,
- flags);
+ flags,
+ timeout);
}
struct pipe_screen *
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index 849db06acd..6118164b20 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -92,7 +92,7 @@ llvmpipe_finish( struct pipe_context *pipe,
struct pipe_fence_handle *fence = NULL;
llvmpipe_flush(pipe, 0, &fence, reason);
if (fence) {
- pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_finish(pipe->screen, fence, 0, PIPE_TIMEOUT_INFINITE);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index edcfbfcfac..c600144a2d 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -365,7 +365,8 @@ llvmpipe_fence_signalled(struct pipe_screen *screen,
static int
llvmpipe_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence_handle,
- unsigned flag)
+ unsigned flag,
+ uint64_t timeout)
{
struct lp_fence *f = (struct lp_fence *) fence_handle;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index e6cd3064c9..3111bef7a2 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -165,7 +165,8 @@ nouveau_screen_fence_signalled(struct pipe_screen *screen,
static int
nouveau_screen_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *pfence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
return !nouveau_fence_wait(nouveau_fence(pfence));
}
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 2c7bca8627..18ed0356ca 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -434,7 +434,8 @@ static int r300_fence_signalled(struct pipe_screen *screen,
static int r300_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct r300_winsys_screen *rws = r300_screen(screen)->rws;
struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence;
diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
index d635ce575c..d8d23bcb9c 100644
--- a/src/gallium/drivers/rbug/rbug_screen.c
+++ b/src/gallium/drivers/rbug/rbug_screen.c
@@ -256,14 +256,16 @@ rbug_screen_fence_signalled(struct pipe_screen *_screen,
static int
rbug_screen_fence_finish(struct pipe_screen *_screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct rbug_screen *rb_screen = rbug_screen(_screen);
struct pipe_screen *screen = rb_screen->screen;
return screen->fence_finish(screen,
fence,
- flags);
+ flags,
+ timeout);
}
boolean
diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c
index 66c5214113..40d0b5970e 100644
--- a/src/gallium/drivers/softpipe/sp_fence.c
+++ b/src/gallium/drivers/softpipe/sp_fence.c
@@ -54,7 +54,8 @@ softpipe_fence_signalled(struct pipe_screen *screen,
static int
softpipe_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
assert(!fence);
return 0;
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 6f7addd441..00a2fafdfa 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -162,7 +162,8 @@ softpipe_flush_resource(struct pipe_context *pipe,
* This is for illustrative purposes only, as softpipe does not
* have fences.
*/
- pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_finish(pipe->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
}
} else {
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index f0f875b2b2..e64dc94b9d 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -241,7 +241,8 @@ void svga_context_flush( struct svga_context *svga,
if (SVGA_DEBUG & DEBUG_SYNC) {
if (fence)
- svga->pipe.screen->fence_finish( svga->pipe.screen, fence, 0);
+ svga->pipe.screen->fence_finish( svga->pipe.screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
}
if(pfence)
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index ef1d3098d5..f4029c7e36 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -425,7 +425,8 @@ svga_fence_signalled(struct pipe_screen *screen,
static int
svga_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flag)
+ unsigned flag,
+ uint64_t timeout)
{
struct svga_winsys_screen *sws = svga_screen(screen)->sws;
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 7cfaab060f..17f87cb906 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -421,7 +421,8 @@ trace_screen_fence_signalled(struct pipe_screen *_screen,
static int
trace_screen_fence_finish(struct pipe_screen *_screen,
struct pipe_fence_handle *fence,
- unsigned flags)
+ unsigned flags,
+ uint64_t timeout)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen;
@@ -432,8 +433,9 @@ trace_screen_fence_finish(struct pipe_screen *_screen,
trace_dump_arg(ptr, screen);
trace_dump_arg(ptr, fence);
trace_dump_arg(uint, flags);
+ trace_dump_arg(uint, timeout);
- result = screen->fence_finish(screen, fence, flags);
+ result = screen->fence_finish(screen, fence, flags, timeout);
trace_dump_ret(int, result);
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index edbaaae334..9350a755d7 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -426,6 +426,8 @@ enum pipe_transfer_usage {
#define PIPE_SWIZZLE_ONE 5
+#define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
+
/**
* Implementation capabilities/limits which are queried through
* pipe_screen::get_param() and pipe_screen::get_paramf().
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 850eb84a3c..8e77e77db3 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -193,11 +193,13 @@ struct pipe_screen {
/**
* Wait for the fence to finish.
* \param flags driver-specific meaning
+ * \param timeout in nanoseconds
* \return zero on success.
*/
int (*fence_finish)( struct pipe_screen *screen,
struct pipe_fence_handle *fence,
- unsigned flags );
+ unsigned flags,
+ uint64_t timeout );
};
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 2068256dff..61619886c3 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -689,7 +689,7 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if (fence) {
- screen->fence_finish(screen, fence, 0);
+ screen->fence_finish(screen, fence, 0, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &fence, NULL);
}
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
index 4e6d944c15..020c696238 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c
@@ -109,7 +109,7 @@ egl_g3d_wait_fence_sync(struct egl_g3d_sync *gsync, EGLTimeKHR timeout)
_eglUnlockMutex(&dpy->Mutex);
/* no timed finish? */
- screen->fence_finish(screen, fence, 0x0);
+ screen->fence_finish(screen, fence, 0x0, PIPE_TIMEOUT_INFINITE);
ret = EGL_CONDITION_SATISFIED_KHR;
_eglLockMutex(&dpy->Mutex);
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
index be6713d03a..aaccee3e1d 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -333,7 +333,7 @@ resource_surface_throttle(struct resource_surface *rsurf)
struct pipe_fence_handle *fence = swap_fences_pop_front(rsurf);
if (fence) {
- (void) screen->fence_finish(screen, fence, 0);
+ (void) screen->fence_finish(screen, fence, 0, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &fence, NULL);
return TRUE;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 7c47a25ceb..506d6ecda8 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1227,7 +1227,8 @@ void XMesaFlush( XMesaContext c )
c->st->flush(c->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if (fence) {
- xmdpy->screen->fence_finish(xmdpy->screen, fence, 0);
+ xmdpy->screen->fence_finish(xmdpy->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
xmdpy->screen->fence_reference(xmdpy->screen, &fence, NULL);
}
XFlush( c->xm_visual->display );
diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
index d6bbda5e07..5fba56fd21 100644
--- a/src/gallium/state_trackers/vega/api_context.c
+++ b/src/gallium/state_trackers/vega/api_context.c
@@ -74,7 +74,8 @@ void vegaFinish(void)
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if (fence) {
- pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_finish(pipe->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
}
}
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 17c34b7eac..6fc3e6514c 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -362,7 +362,8 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
if (extents->x1 == 0 && extents->y1 == 0 &&
extents->x2 == pDraw->width && extents->y2 == pDraw->height) {
- ms->screen->fence_finish(ms->screen, dst_priv->fence, 0);
+ ms->screen->fence_finish(ms->screen, dst_priv->fence, 0,
+ PIPE_TIMEOUT_INFINITE);
ms->screen->fence_reference(ms->screen, &dst_priv->fence, NULL);
}
}
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 33bcacdcc2..9c890ff086 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -334,7 +334,8 @@ drv_cleanup_fences(ScrnInfoPtr pScrn)
for (i = 0; i < XORG_NR_FENCES; i++) {
if (ms->fence[i]) {
- ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
+ ms->screen->fence_finish(ms->screen, ms->fence[i], 0,
+ PIPE_TIMEOUT_INFINITE);
ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
}
}
@@ -555,7 +556,8 @@ void xorg_flush(ScreenPtr pScreen)
if (ms->dirtyThrottling) {
if (ms->fence[0])
ms->ctx->screen->fence_finish(ms->ctx->screen,
- ms->fence[0], 0);
+ ms->fence[0], 0,
+ PIPE_TIMEOUT_INFINITE);
/* The amount of rendering generated by a block handler can be
* quite small. Let us get a fair way ahead of hardware before
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 718a345393..38d67d1b0b 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -1084,7 +1084,8 @@ void xorg_exa_finish(struct exa_context *exa)
xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, &fence);
- exa->pipe->screen->fence_finish(exa->pipe->screen, fence, 0);
+ exa->pipe->screen->fence_finish(exa->pipe->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
exa->pipe->screen->fence_reference(exa->pipe->screen, &fence, NULL);
}
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 5a2343d3ae..35ab00f6d0 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -103,7 +103,8 @@ void st_finish( struct st_context *st )
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if(fence) {
- st->pipe->screen->fence_finish(st->pipe->screen, fence, 0);
+ st->pipe->screen->fence_finish(st->pipe->screen, fence, 0,
+ PIPE_TIMEOUT_INFINITE);
st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
index 69a8678a7c..85aad08cc7 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -96,8 +96,8 @@ static void st_client_wait_sync(struct gl_context *ctx,
/* 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);
+ if (so->fence &&
+ screen->fence_finish(screen, so->fence, 0, timeout) == 0) {
screen->fence_reference(screen, &so->fence, NULL);
so->b.StatusFlag = GL_TRUE;
}