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;
}
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 */
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;
}