[Mesa-dev] [PATCH] llvmpipe: Always return some fence in flush

Michel Dänzer michel at daenzer.net
Thu Aug 16 09:43:24 UTC 2018


On 2018-08-16 11:34 AM, Tomasz Figa wrote:
> 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:
> 
> https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp#427
> 
> Reproducible especially with thread count >= 4.
> 
> Signed-off-by: Tomasz Figa <tfiga at chromium.org>
> ---
>  src/gallium/drivers/llvmpipe/lp_setup.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
> index b087369473..a6f1b54d69 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
> @@ -360,7 +360,13 @@ lp_setup_flush( struct lp_setup_context *setup,
>     set_scene_state( setup, SETUP_FLUSHED, reason );
>  
>     if (fence) {
> -      lp_fence_reference((struct lp_fence **)fence, setup->last_fence);
> +      struct lp_fence *lp_fence = NULL;
> +
> +      lp_fence_reference(&lp_fence, setup->last_fence);
> +      if (!lp_fence)
> +         lp_fence = lp_fence_create(0);
> +      lp_fence_reference((struct lp_fence **)fence, lp_fence);
> +      lp_fence_reference(&lp_fence, NULL);
>     }
>  }
>  
> 

Other drivers keep around a reference to the last fence in the context,
and return that if there's no new work to flush.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list