Date: Thursday, January 12, 2023 @ 00:53:56
  Author: heftig
Revision: 466359

22.3.3-1

Added:
  mesa/trunk/0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
  mesa/trunk/0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
Modified:
  mesa/trunk/0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
  mesa/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch |    4 
 0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch  |   47 
++++++++++
 0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch |   30 ++++++
 PKGBUILD                                                        |   17 ++-
 4 files changed, 92 insertions(+), 6 deletions(-)

Modified: 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
===================================================================
--- 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch     
2023-01-12 00:51:27 UTC (rev 466358)
+++ 0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch     
2023-01-12 00:53:56 UTC (rev 466359)
@@ -26,10 +26,10 @@
  1 file changed, 14 insertions(+)
 
 diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
-index 17629fb7ac87..1651c29d9ebd 100644
+index c28267563c4b..fadd2631c06c 100644
 --- a/src/intel/vulkan/genX_cmd_buffer.c
 +++ b/src/intel/vulkan/genX_cmd_buffer.c
-@@ -6003,6 +6003,20 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer 
*cmd_buffer,
+@@ -6028,6 +6028,20 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer 
*cmd_buffer,
     }
  #endif
  

Added: 0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
===================================================================
--- 0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch              
                (rev 0)
+++ 0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch      
2023-01-12 00:53:56 UTC (rev 466359)
@@ -0,0 +1,47 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <[email protected]>
+Date: Thu, 29 Dec 2022 13:43:27 +0800
+Subject: [PATCH] iris: Retry DRM_IOCTL_I915_GEM_EXECBUFFER2 on ENOMEM
+
+We are seeing endless DRM_IOCTL_SYNCOBJ_WAIT ioctl when system memory is
+under pressured.
+
+Commit f9d8d9acbb6a ("iris: Avoid abort() if kernel can't allocate
+memory") avoids the abort() on ENOMEM by resetting the batch. However,
+when there's an ongoing OpenGL query, resetting the batch will make the
+snapshots_landed never be flipped, so iris_get_query_result() gets stuck
+in the while loop forever.
+
+Since there's no guarantee that the next batch after resetting won't hit
+ENOMEM, so instead of resetting the batch, be patient and wait until kernel has
+enough memory. Once the batch is submiited and snapshots_landed gets
+flipped, iris_get_query_result() can proceed normally.
+
+Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6851
+(cherry picked from commit 35462bab70db7312b2960796344c37738c93ce91)
+---
+ src/gallium/drivers/iris/iris_batch.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/src/gallium/drivers/iris/iris_batch.c 
b/src/gallium/drivers/iris/iris_batch.c
+index ec32d88cc9bc..8b49615a9901 100644
+--- a/src/gallium/drivers/iris/iris_batch.c
++++ b/src/gallium/drivers/iris/iris_batch.c
+@@ -987,9 +987,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);
+ 

Added: 0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
===================================================================
--- 0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch             
                (rev 0)
+++ 0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch     
2023-01-12 00:53:56 UTC (rev 466359)
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <[email protected]>
+Date: Thu, 29 Dec 2022 14:01:31 +0800
+Subject: [PATCH] Revert "iris: Avoid abort() if kernel can't allocate memory"
+
+This reverts commit f9d8d9acbb6a620684fb4dac4affe25816587d92.
+
+Now ENOMEM is handled in submit_batch(), we don't need to check it for
+resetting anymore.
+
+(cherry picked from commit af935f451f7437ab86235903da8fefb71f0d4bb7)
+---
+ src/gallium/drivers/iris/iris_batch.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/gallium/drivers/iris/iris_batch.c 
b/src/gallium/drivers/iris/iris_batch.c
+index 8b49615a9901..be98c889372c 100644
+--- a/src/gallium/drivers/iris/iris_batch.c
++++ b/src/gallium/drivers/iris/iris_batch.c
+@@ -1103,9 +1103,8 @@ _iris_batch_flush(struct iris_batch *batch, const char 
*file, int line)
+     * with a new logical context, and inform iris_context that all state
+     * has been lost and needs to be re-initialized.  If this succeeds,
+     * dubiously claim success...
+-    * Also handle ENOMEM here.
+     */
+-   if ((ret == -EIO || ret == -ENOMEM) && replace_kernel_ctx(batch)) {
++   if (ret == -EIO && replace_kernel_ctx(batch)) {
+       if (batch->reset->reset) {
+          /* Tell gallium frontends the device is lost and it was our fault. */
+          batch->reset->reset(batch->reset->data, PIPE_GUILTY_CONTEXT_RESET);

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-01-12 00:51:27 UTC (rev 466358)
+++ PKGBUILD    2023-01-12 00:53:56 UTC (rev 466359)
@@ -6,8 +6,8 @@
 pkgbase=mesa
 pkgname=('vulkan-mesa-layers' 'opencl-mesa' 'vulkan-intel' 'vulkan-radeon' 
'vulkan-swrast' 'vulkan-virtio' 'libva-mesa-driver' 'mesa-vdpau' 'mesa')
 pkgdesc="An open-source implementation of the OpenGL specification"
-pkgver=22.3.2
-pkgrel=4
+pkgver=22.3.3
+pkgrel=1
 arch=('x86_64')
 makedepends=('python-mako' 'libxml2' 'libx11' 'xorgproto' 'libdrm' 
'libxshmfence' 'libxxf86vm'
              'libxdamage' 'libvdpau' 'libva' 'wayland' 'wayland-protocols' 
'zstd' 'elfutils' 'llvm'
@@ -19,10 +19,14 @@
 options=('debug' '!lto')
 source=(https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig}
         0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
+        0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
+        0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
         LICENSE)
-sha512sums=('32934dd23cfcd6165c365597d9a469da0b806b72ea98a200f499344c3b47815db3bf78875b4ea766d2d28d9c70b50c1615d2d3fcbfd4769447fe0a9d3b32951f'
+sha512sums=('dcf166bc7c80e6ad09337e0188219e5ea4bdc558bc4b4ca35ce30d5421568f6b5328e5508b3175a2696521214e466354d8652ade22468ce448d9f61d5709c8a1'
             'SKIP'
-            
'd02f3fd44cf95b7dbfd607a58b764bd79d02b8b8586acd37bd4b2340aea171410b2b5eda7eab5c5d2c87bbf512e2322d5468f95aab0bfedeabc5367ebdee3b1d'
+            
'6150324d4e4b974bd2398157decaceef69bb0867d878d60fb9f4d15fa2fc52948edd27b787846cc1e552a331f7e91953bd3c4a4500d5445df1dba1fe3326bcfe'
+            
'33067a6fab6c078cb829b6266ab5e328929923ace7c580c3b347f25682b4427a5f7cfd52234311636fc23e03beb021c543020d3deb30bf8515f58bf78173bde8'
+            
'94f25da531a1ccbb630f0b1ccd80fe85aae60cba7b6e29b2761d4014b79f611eb4b89b2e29e2501231620ee381bc91e546ad2158cf76ec2d6c678d048553eba0'
             
'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7')
 validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D'  # Emil Velikov 
<[email protected]>
               '946D09B5E4C9845E63075FF1D961C596A7203456'  # Andres Gomez 
<[email protected]>
@@ -38,6 +42,11 @@
   # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17247
   # https://github.com/HansKristian-Work/vkd3d-proton/issues/1200
   patch -Np1 -i 
../0001-anv-force-MEDIA_INTERFACE_DESCRIPTOR_LOAD-reemit-aft.patch
+
+  # https://gitlab.freedesktop.org/drm/intel/-/issues/6851
+  # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20449
+  patch -Np1 -i 
../0002-iris-Retry-DRM_IOCTL_I915_GEM_EXECBUFFER2-on-ENOMEM.patch
+  patch -Np1 -i 
../0003-Revert-iris-Avoid-abort-if-kernel-can-t-allocate-mem.patch
 }
 
 build() {

Reply via email to