diff --git a/SOURCES/0001-glx-fix-shared-memory-leak-in-X11.patch b/SOURCES/0001-glx-fix-shared-memory-leak-in-X11.patch new file mode 100644 index 0000000..4cb6895 --- /dev/null +++ b/SOURCES/0001-glx-fix-shared-memory-leak-in-X11.patch @@ -0,0 +1,31 @@ +From b344e32cdf7064a1f2ff7ef37027edda6589404f Mon Sep 17 00:00:00 2001 +From: Ray Zhang +Date: Wed, 27 Feb 2019 06:54:05 +0000 +Subject: [PATCH] glx: fix shared memory leak in X11 + +call XShmDetach to allow X server to free shared memory + +Fixes: bcd80be49a8260c2233d "drisw/glx: use XShm if possible" +Signed-off-by: Ray Zhang +Reviewed-by: Dave Airlie +--- + src/glx/drisw_glx.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c +index 00c7fa100ab..48c03ca42e0 100644 +--- a/src/glx/drisw_glx.c ++++ b/src/glx/drisw_glx.c +@@ -147,6 +147,9 @@ XDestroyDrawable(struct drisw_drawable * pdp, Display * dpy, XID drawable) + if (pdp->ximage) + XDestroyImage(pdp->ximage); + ++ if (pdp->shminfo.shmid > 0) ++ XShmDetach(dpy, &pdp->shminfo); ++ + free(pdp->visinfo); + + XFreeGC(dpy, pdp->gc); +-- +2.20.1 + diff --git a/SOURCES/fix-llvmpipe-remote-shm.patch b/SOURCES/fix-llvmpipe-remote-shm.patch new file mode 100644 index 0000000..b03ae67 --- /dev/null +++ b/SOURCES/fix-llvmpipe-remote-shm.patch @@ -0,0 +1,68 @@ +From 607a59f2922b1261920bae94efe4dc87da18d576 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 5 Mar 2019 15:31:51 -0500 +Subject: [PATCH] drisw: Try harder to probe whether MIT-SHM works + +XQueryExtension merely tells you whether the extension exists, it +doesn't tell you whether you're local enough for it to work. +XShmQueryVersion is not enough to discover this either, you need to +provoke the server to do actual work, and if it thinks you're remote it +will throw BadRequest at you. So send an invalid ShmDetach and use the +error code to distinguish local from remote. + +Signed-off-by: Adam Jackson +--- + src/glx/drisw_glx.c | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) + +diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c +index c63b097a71a..67698d1c450 100644 +--- a/src/glx/drisw_glx.c ++++ b/src/glx/drisw_glx.c +@@ -73,11 +73,10 @@ handle_xerror(Display *dpy, XErrorEvent *event) + (void) dpy; + + assert(xshm_opcode != -1); +- if (event->request_code != xshm_opcode || +- event->minor_code != X_ShmAttach) ++ if (event->request_code != xshm_opcode) + return 0; + +- xshm_error = 1; ++ xshm_error = event->error_code; + return 0; + } + +@@ -826,9 +825,28 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions) + static int + check_xshm(Display *dpy) + { ++ int (*old_handler)(Display *, XErrorEvent *); ++ + int ignore; ++ XShmSegmentInfo info = { 0, }; ++ ++ if (!XQueryExtension(dpy, "MIT-SHM", &xshm_opcode, &ignore, &ignore)) ++ return False; ++ ++ old_handler = XSetErrorHandler(handle_xerror); ++ XShmDetach(dpy, &info); ++ XSync(dpy, False); ++ (void) XSetErrorHandler(old_handler); + +- return XQueryExtension(dpy, "MIT-SHM", &xshm_opcode, &ignore, &ignore); ++ /* BadRequest means we're a remote client. If we were local we'd ++ * expect BadValue since 'info' has an invalid segment name. ++ */ ++ if (xshm_error == BadRequest) ++ return False; ++ ++ /* reset this as others read it later */ ++ xshm_error = 0; ++ return True; + } + + static struct glx_screen * +-- +2.20.1 + diff --git a/SPECS/mesa.spec b/SPECS/mesa.spec index 15863f5..442f6fd 100644 --- a/SPECS/mesa.spec +++ b/SPECS/mesa.spec @@ -51,7 +51,7 @@ Name: mesa Summary: Mesa graphics libraries Version: 18.3.1 -Release: 2%{?rctag:.%{rctag}}%{?dist} +Release: 5%{?rctag:.%{rctag}}%{?dist} License: MIT URL: http://www.mesa3d.org @@ -70,6 +70,8 @@ Patch3: 0003-evergreen-big-endian.patch Patch10: glvnd-fix-gl-dot-pc.patch Patch21: mesa-18.0.2-gallium-osmesa.patch Patch30: shmfix.patch +Patch31: 0001-glx-fix-shared-memory-leak-in-X11.patch +Patch32: fix-llvmpipe-remote-shm.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -620,6 +622,15 @@ done %endif %changelog +* Thu Apr 04 2019 Dave Airlie - 18.3.1-5 +- Fix remote shm detection again + +* Tue Mar 26 2019 Dave Airlie - 18.3.1-4 +- Fix remove shm detection + +* Wed Mar 20 2019 Dave Airlie - 18.3.1-3 +- Add shm leak fix + * Tue Jan 29 2019 Dave Airlie - 18.3.1-2 - fix shm swrast