iris: signal the syncobj after a failed batch
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Tue, 31 Aug 2021 21:16:32 +0000 (14:16 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Sep 2021 19:03:03 +0000 (19:03 +0000)
commit26364c63471a714f4dc20615e8de19fcd4e7cee3
treebec5da9ba66c60d61f0716950bf2665771c37ca7
parentdb35acafa9c802efe4bd55e4bff920850664b2d6
iris: signal the syncobj after a failed batch

When a batch fails we either recreate our context (in case we got -EIO
or -ENOMEM) or we abort() (every other error). If we don't abort and a
later batch has a dependency on the batch that failed, then this newer
batch will fail with -EINVAL since it requires a syncobj that was
never submitted, which means we'll abort().

To avoid this problem, in this patch we simply signal syncobjs of
failed batches. This means we may be breaking our dependency tracking,
but IMHO it's better than simply letting it abort() later.

In other words, this moves the situation for some apps from "app
causes a GPU hang and then aborts" to "app causes a GPU hang but keeps
running".

Note: on some older Kernels (like today's Debian 5.10 Kernel) I see X
simply freezing after the GPU hang when the app doesn't decide to
abort(). Switching to a more recent Kernel fixes this issue for me, so
in case it happens to you make sure you have the most recent stable
trees.

v2:
  - Fix coding style (Ken).
  - Use the big comment block provided by Ken (Ken).
  - Adjust the commit message so avoid saying we retry (Ken).
  - Rebase after the syncobj ownership changes.
  - Drive-by add a missing white space in the header.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12657>
src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_fence.c
src/gallium/drivers/iris/iris_fence.h