st/dri: fix a crash in server_wait_sync

Ported from i965 including the comment.

This fixes:
    dEQP-EGL.functional.reusable_sync.valid.wait_server

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Marek Olšák 2018-07-05 18:15:31 -04:00
parent b39bdb0716
commit 0eaf069679
1 changed files with 6 additions and 0 deletions

View File

@ -214,6 +214,12 @@ dri2_server_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags)
struct pipe_context *ctx = dri_context(_ctx)->st->pipe;
struct dri2_fence *fence = (struct dri2_fence*)_fence;
/* We might be called here with a NULL fence as a result of WaitSyncKHR
* on a EGL_KHR_reusable_sync fence. Nothing to do here in such case.
*/
if (!fence)
return;
if (ctx->fence_server_sync)
ctx->fence_server_sync(ctx, fence->pipe_fence);
}