From: Chia-I Wu Date: Wed, 25 Feb 2015 22:06:15 +0000 (-0700) Subject: intel: fix waiting of present fences X-Git-Tag: sdk-0.1.0~433 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bda4f62ba71f7ca6f699ae29bf8cb174fab4e5bf;p=platform%2Fupstream%2FVulkan-LoaderAndValidationLayers.git intel: fix waiting of present fences For presentation fences, we should wait until the server has submitted the presentation command to the kernel _and_ the GPU has executed the command. We failed to wait for the latter until this fix. --- diff --git a/icd/intel/fence.c b/icd/intel/fence.c index 75c2843..debcd7e 100644 --- a/icd/intel/fence.c +++ b/icd/intel/fence.c @@ -81,36 +81,41 @@ void intel_fence_set_seqno(struct intel_fence *fence, void intel_fence_set_x11(struct intel_fence *fence, struct intel_wsi_x11 *x11, struct intel_wsi_x11_window *win, - uint32_t serial) + uint32_t serial, + struct intel_bo *seqno_bo) { - if (fence->seqno_bo) { - intel_bo_unreference(fence->seqno_bo); - fence->seqno_bo = NULL; - } - #ifdef ENABLE_WSI_X11 fence->x11 = x11; fence->x11_win = win; fence->x11_serial = serial; #endif + + if (fence->seqno_bo) + intel_bo_unreference(fence->seqno_bo); + + fence->seqno_bo = seqno_bo; + intel_bo_reference(fence->seqno_bo); } XGL_RESULT intel_fence_wait(struct intel_fence *fence, int64_t timeout_ns) { - if (fence->seqno_bo) { - return (intel_bo_wait(fence->seqno_bo, timeout_ns)) ? - XGL_NOT_READY : XGL_SUCCESS; - } - #ifdef ENABLE_WSI_X11 if (fence->x11) { const bool wait = (timeout_ns != 0); + XGL_RESULT ret; - return intel_wsi_x11_wait(fence->x11, fence->x11_win, + ret = intel_wsi_x11_wait(fence->x11, fence->x11_win, fence->x11_serial, wait); + if (ret != XGL_SUCCESS) + return ret; } #endif + if (fence->seqno_bo) { + return (intel_bo_wait(fence->seqno_bo, timeout_ns)) ? + XGL_NOT_READY : XGL_SUCCESS; + } + return XGL_ERROR_UNAVAILABLE; } diff --git a/icd/intel/fence.h b/icd/intel/fence.h index 70b4f2a..3ed450b 100644 --- a/icd/intel/fence.h +++ b/icd/intel/fence.h @@ -70,6 +70,7 @@ void intel_fence_set_seqno(struct intel_fence *fence, void intel_fence_set_x11(struct intel_fence *fence, struct intel_wsi_x11 *x11, struct intel_wsi_x11_window *win, - uint32_t serial); + uint32_t serial, + struct intel_bo *seqno_bo); #endif /* FENCE_H */ diff --git a/icd/intel/wsi_x11.c b/icd/intel/wsi_x11.c index c8dfd0a..582aa70 100644 --- a/icd/intel/wsi_x11.c +++ b/icd/intel/wsi_x11.c @@ -639,8 +639,12 @@ ICD_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent( if (ret != XGL_SUCCESS) return ret; - if (fence) - intel_fence_set_x11(fence, x11, win, win->local.serial); + if (fence) { + struct intel_img *img = intel_img(pPresentInfo->srcImage); + + intel_fence_set_x11(fence, x11, win, win->local.serial, + img->obj.mem->bo); + } return XGL_SUCCESS; }