From 32879e14610906c23b3ca874ba7234370132d76c Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 26 Feb 2008 09:19:27 +0100 Subject: [PATCH] [intel] Handle -EAGAINs correctly in execbuffer. Dont stop on fence creation errors. --- src/mesa/drivers/dri/intel/intel_ioctl.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c index c8f70ae4786..66e36102b9d 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c @@ -155,6 +155,7 @@ intel_exec_ioctl(struct intel_context *intel, { struct drm_i915_execbuffer execbuf; dri_fence *fo; + int ret; assert(intel->locked); assert(used); @@ -179,13 +180,27 @@ intel_exec_ioctl(struct intel_context *intel, execbuf.ops_list = (unsigned long)start; // TODO execbuf.fence_arg.flags = DRM_FENCE_FLAG_SHAREABLE | DRM_I915_FENCE_FLAG_FLUSHED; - if (drmCommandWriteRead(intel->driFd, DRM_I915_EXECBUFFER, &execbuf, - sizeof(execbuf))) { + do { + ret = drmCommandWriteRead(intel->driFd, DRM_I915_EXECBUFFER, &execbuf, + sizeof(execbuf)); + } while (ret == -EAGAIN); + + if (ret != 0) { fprintf(stderr, "DRM_I915_EXECBUFFER: %d\n", -errno); UNLOCK_HARDWARE(intel); exit(1); } + if (execbuf.fence_arg.error != 0) { + + /* + * Fence creation has failed, but the GPU has been + * idled by the kernel. Safe to continue. + */ + + *fence = NULL; + return; + } fo = intel_ttm_fence_create_from_arg(intel->bufmgr, "fence buffers", &execbuf.fence_arg); -- 2.30.2