diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 939e828d475..d5d18dc0d0e 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -858,6 +858,21 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line) int ret = submit_batch(batch); + /* When batch submission fails, our end-of-batch syncobj remains + * unsignalled, and in fact is not even considered submitted. + * + * In the hang recovery case (-EIO) or -ENOMEM, we recreate our context and + * attempt to carry on. In that case, we need to signal our syncobj, + * dubiously claiming that this batch completed, because future batches may + * depend on it. If we don't, then execbuf would fail with -EINVAL for + * those batches, because they depend on a syncobj that's considered to be + * "never submitted". This would lead to an abort(). So here, we signal + * the failing batch's syncobj to try and allow further progress to be + * made, knowing we may have broken our dependency tracking. + */ + if (ret < 0) + iris_syncobj_signal(screen->bufmgr, iris_batch_get_signal_syncobj(batch)); + batch->exec_count = 0; batch->aperture_space = 0; diff --git a/src/gallium/drivers/iris/iris_fence.c b/src/gallium/drivers/iris/iris_fence.c index a7dffe58912..d9e58fe4fee 100644 --- a/src/gallium/drivers/iris/iris_fence.c +++ b/src/gallium/drivers/iris/iris_fence.c @@ -87,6 +87,21 @@ iris_syncobj_destroy(struct iris_bufmgr *bufmgr, struct iris_syncobj *syncobj) free(syncobj); } +void +iris_syncobj_signal(struct iris_bufmgr *bufmgr, struct iris_syncobj *syncobj) +{ + int fd = iris_bufmgr_get_fd(bufmgr); + struct drm_syncobj_array args = { + .handles = (uintptr_t)&syncobj->handle, + .count_handles = 1, + }; + + if (intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &args)) { + fprintf(stderr, "failed to signal syncobj %"PRIu32"\n", + syncobj->handle); + } +} + /** * Add a sync-point to the batch, with the given flags. * diff --git a/src/gallium/drivers/iris/iris_fence.h b/src/gallium/drivers/iris/iris_fence.h index 1332e55ec92..d28c59ce5e8 100644 --- a/src/gallium/drivers/iris/iris_fence.h +++ b/src/gallium/drivers/iris/iris_fence.h @@ -39,7 +39,8 @@ struct iris_syncobj { }; struct iris_syncobj *iris_create_syncobj(struct iris_bufmgr *bufmgr); -void iris_syncobj_destroy(struct iris_bufmgr*, struct iris_syncobj *); +void iris_syncobj_destroy(struct iris_bufmgr *, struct iris_syncobj *); +void iris_syncobj_signal(struct iris_bufmgr *, struct iris_syncobj *); void iris_batch_add_syncobj(struct iris_batch *batch, struct iris_syncobj *syncobj,