#1041591 iris: Retry DRM_IOCTL_I915_GEM_EXECBUFFER2 on ENOMEM

Package:
libgl1-mesa-dri
Source:
libgl1-mesa-dri
Description:
free implementation of the OpenGL API -- DRI modules
Submitter:
SuperCat
Date:
2024-03-17 11:00:06 UTC
Severity:
normal
Tags:
#1041591#5
Date:
2023-07-21 06:18:48 UTC
From:
To:
Dear Maintainer,

Screen freeze because gnome-shell waits DRM_IOCTL_SYNCOBJ_WAIT forever in
Wayland mode when resource is tight. See
https://gitlab.freedesktop.org/drm/intel/-/issues/6851 for details.

This problem is already fixed by upstream with commit:
https://gitlab.freedesktop.org/mesa/mesa/-/commit/f2b262feefabe4745d19eb3b2d235dc3739466bc.
So it won't happen on unstable version (23.1.3-1).

#1041591#10
Date:
2023-08-03 13:10:07 UTC
From:
To:
I have backported this patch and applied it to my system. Tested for more
than 2 weeks and no crashes anymore.

diff --git a/src/gallium/drivers/iris/iris_batch.c
b/src/gallium/drivers/iris/iris_batch.c
index c7a08a0e1f5f0..deab85ce4aaf3 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -981,9 +981,14 @@ submit_batch(struct iris_batch *batch)
    }

    int ret = 0;
-   if (!batch->screen->devinfo.no_hw &&
-       intel_ioctl(batch->screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf))
-      ret = -errno;
+   if (!batch->screen->devinfo.no_hw) {
+      do {
+         ret = intel_ioctl(batch->screen->fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+      } while (ret && errno == ENOMEM);
+
+      if (ret)
+ ret = -errno;
+   }

    simple_mtx_unlock(bo_deps_lock);