From: Chris Wilson Date: Mon, 25 Mar 2019 22:32:12 +0000 (+0000) Subject: iris: Reorganise execbuf to have a single point of failure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b8125646991fb7e923821bafea9bec3ba355b42;p=mesa.git iris: Reorganise execbuf to have a single point of failure Propagate the failure from GEM_EXECBUFFER2, cleanup then report failure if need be. We retain the current behaviour to abort() at the first sign of trouble -- for a non-robustness context, arguably this is the right thing to do as the client cannot recover, and the system state is lost. How to properly integrate with KHR_robustness and reset-strategy is left as a future exercise. Reviewed-by: Kenneth Graunke --- diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 2e349891fbd..d2b4fc88fe6 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -491,17 +491,10 @@ submit_batch(struct iris_batch *batch) (uintptr_t)util_dynarray_begin(&batch->exec_fences); } - int ret = batch->screen->no_hw ? 0 : drm_ioctl(batch->screen->fd, - DRM_IOCTL_I915_GEM_EXECBUFFER2, - &execbuf); - if (ret != 0) { + int ret = 0; + if (!batch->screen->no_hw && + drm_ioctl(batch->screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf)) ret = -errno; - DBG("execbuf FAILED: errno = %d\n", -ret); - fprintf(stderr, "execbuf FAILED: errno = %d\n", -ret); - abort(); - } else { - DBG("execbuf succeeded\n"); - } for (int i = 0; i < batch->exec_count; i++) { struct iris_bo *bo = batch->exec_bos[i]; @@ -569,23 +562,6 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line) int ret = submit_batch(batch); - if (ret >= 0) { - //if (iris->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB) - //iris_check_for_reset(ice); - - if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) { - dbg_printf("waiting for idle\n"); - iris_bo_wait_rendering(batch->bo); - } - } else { -#ifdef DEBUG - const bool color = INTEL_DEBUG & DEBUG_COLOR; - fprintf(stderr, "%siris: Failed to submit batchbuffer: %-80s%s\n", - color ? "\e[1;41m" : "", strerror(-ret), color ? "\e[0m" : ""); - abort(); -#endif - } - batch->exec_count = 0; batch->aperture_space = 0; @@ -599,8 +575,25 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line) util_dynarray_clear(&batch->exec_fences); + if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) { + dbg_printf("waiting for idle\n"); + iris_bo_wait_rendering(batch->bo); /* if execbuf failed; this is a nop */ + } + /* Start a new batch buffer. */ iris_batch_reset(batch); + + if (ret >= 0) { + //if (iris->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB) + //iris_check_for_reset(ice); + } else { +#ifdef DEBUG + const bool color = INTEL_DEBUG & DEBUG_COLOR; + fprintf(stderr, "%siris: Failed to submit batchbuffer: %-80s%s\n", + color ? "\e[1;41m" : "", strerror(-ret), color ? "\e[0m" : ""); +#endif + abort(); + } } /**