[Mesa-dev] [PATCH mesa] wayland: Disable prime support on buggy kernels

Daniel Vetter daniel at ffwll.ch
Fri May 10 02:08:05 PDT 2013


On Fri, May 10, 2013 at 10:44:05AM +0300, Ander Conselvan de Oliveira wrote:
> On 05/08/2013 11:50 PM, Jonas Ådahl wrote:
> >On Tue, Apr 23, 2013 at 3:54 PM, Ander Conselvan de Oliveira
> ><ander.conselvan.de.oliveira at intel.com> wrote:
> >>Linux kernel 3.8 shipped with a bug in the prime fd passing code that
> >>makes it unreliable. As of this writing, it seems unlikely that 3.9
> >>will contain the fix for the issue.
> >>
> >>This patch disable prime support when running on top of those kernels,
> >>in order to prevent unexpected behavior when running a Wayland
> >>compositor.
> >>
> >>Commit be8a42ae60addd8b6092535c11b42d099d6470ec in Linus tree introduces
> >>the problem, which can be fixed by the patch below (not upstream yet):
> >>http://lists.freedesktop.org/archives/dri-devel/2013-April/037716.html
> >>---
> >>  src/egl/drivers/dri2/egl_dri2.c |   36 +++++++++++++++++++++++++++++++++++-
> >>  1 file changed, 35 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> >>index 06a21d7..13b9107 100644
> >>--- a/src/egl/drivers/dri2/egl_dri2.c
> >>+++ b/src/egl/drivers/dri2/egl_dri2.c
> >>@@ -38,6 +38,7 @@
> >>  #include <GL/internal/dri_interface.h>
> >>  #include <sys/types.h>
> >>  #include <sys/stat.h>
> >>+#include <sys/utsname.h>
> >>
> >>  #include "egl_dri2.h"
> >>
> >>@@ -1557,6 +1558,38 @@ static struct wayland_drm_callbacks wl_drm_callbacks = {
> >>  };
> >>
> >>  static EGLBoolean
> >>+kernel_prime_support_not_buggy()
> >>+{
> >>+   struct utsname un;
> >>+
> >>+   /* Linux kernel 3.8 shipped with a bug in the prime fd passing code that
> >>+    * makes it unreliable. As of this writing, it seems unlikely that 3.9
> >>+    * will contain the fix for the issue. Disable prime support when running
> >>+    * on top of those kernels, in order to prevent unexpected behavior when
> >>+    * running a Wayland compositor.
> >>+    *
> >>+    * Commit be8a42ae60addd8b6092535c11b42d099d6470ec in Linus tree introduces
> >>+    * the problem, which can be fixed by the patch below (not upstream yet):
> >>+    * http://lists.freedesktop.org/archives/dri-devel/2013-April/037716.html
> >>+    */
> >>+   if (uname(&un) == -1) {
> >>+      _eglLog(_EGL_INFO,
> >>+              "DRI2: wayland prime support disabled: unknown kernel version");
> >>+      return EGL_FALSE;
> >>+   }
> >>+
> >>+   if (strncmp(un.sysname, "Linux", strlen("Linux")) == 0 &&
> >>+       (strncmp(un.release, "3.8.", strlen("3.8.")) == 0 ||
> >>+        strncmp(un.release, "3.9.", strlen("3.9.")) == 0)) {
> >
> >I think if we should test against kernel releases we can disable for
> >anything older than the first release that has the fix as it doesn't
> >seem to work on older versions either. At least in my case I get what
> >looks like the same issue when prime support enabled when running
> >kernel version 3.5.
> 
> Your distro probably picked up the patch that introduces the bug.
> But anyway, I think this patch should just be dropped. It doesn't
> really solve the issue.
> 
> There's no Mesa release with prime support yet, so I guess we should
> just disable it for now, until things are solved on the kernel side.

Things are solved on the kernel side now I think, and prime fixes are
trickling down to all stable releases atm. So I don't think you need any
workarounds and we can just enable prime buffer passing in the next mesa
release.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the mesa-dev mailing list