Commit e8bf4efc authored by Tomasz Figa's avatar Tomasz Figa Committed by Emil Velikov
Browse files

llvmpipe: Always return some fence in flush (v2)

If there is no last fence, due to no rendering happening yet, just
create a new signaled fence and return it, to match the expectations of
the EGL sync fence API.

Fixes random "Could not create sync fence 0x3003" assertion failures from
Skia on Android, coming from the following code:

Reproducible especially with thread count >= 4.

One could make the driver always keep the reference to the last fence,

 - the driver seems to explicitly destroy the fence whenever a rendering
   pass completes and changing that would require a significant functional
   change to the code. (Specifically, in lp_scene_end_rasterization().)

 - it still wouldn't solve the problem of an EGL sync fence being created
   and waited on without any rendering happening at all, which is
   also likely to happen with Android code pointed to in the commit.

Therefore, the simple approach of always creating a fence is taken,
similarly to other drivers, such as radeonsi.

Tested with piglit llvmpipe suite with no regressions and following
tests fixed:


 - remove the useless lp_fence_reference() dance (Nicolai),
 - explain why creating the dummy fence is the right approach.
Signed-off-by: Tomasz Figa's avatarTomasz Figa <>
Reviewed-by: default avatarRoland Scheidegger <>
parent 591955d8
......@@ -361,6 +361,8 @@ lp_setup_flush( struct lp_setup_context *setup,
if (fence) {
lp_fence_reference((struct lp_fence **)fence, setup->last_fence);
if (!*fence)
*fence = (struct pipe_fence_handle *)lp_fence_create(0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment