From 7514702907a861a2fd0134b13ae0b859bc401faa Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 30 2020 11:51:48 +0000 Subject: import mesa-18.3.4-6.el7_7.1 --- diff --git a/SOURCES/0001-dri-add-another-get-shm-variant.patch b/SOURCES/0001-dri-add-another-get-shm-variant.patch new file mode 100644 index 0000000..2d3cc3b --- /dev/null +++ b/SOURCES/0001-dri-add-another-get-shm-variant.patch @@ -0,0 +1,77 @@ +From 7881d29f2c729e4a8a5af21a0abcf3db18e22918 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 14 Feb 2020 15:00:13 +1000 +Subject: [PATCH 1/2] dri: add another get shm variant. + +When Brian in 02c3dad0f3b4d26e0faa5cc51d06bc50d693dcdc restricted +the shm permissions it means we hit the fallback paths in some +scenarios we hadn't before. + +When you use Xephyr to xdmcp from one user to another the new perms +stop the X server (running as user a) attaching to the SHM segments +from gnome-shell (running as user b). + +In this case however only the GLX side of the code had insight into this, +and the dri could was meant of fall back, and it worked for put image +fine but the get image path was broken, since there was no indication +in the broken case of the need to fallback. + +This adds a return type to a new interface member that lets the +caller know it has to fallback. + +Fixes: 02c3dad0f3b4 ("Call shmget() with permission 0600 instead of 0777") +--- + include/GL/internal/dri_interface.h | 15 ++++++++++++++- + src/gallium/state_trackers/dri/drisw.c | 3 +++ + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h +index 09782c8baeb..e40106575c0 100644 +--- a/include/GL/internal/dri_interface.h ++++ b/include/GL/internal/dri_interface.h +@@ -634,7 +634,7 @@ struct __DRIdamageExtensionRec { + * SWRast Loader extension. + */ + #define __DRI_SWRAST_LOADER "DRI_SWRastLoader" +-#define __DRI_SWRAST_LOADER_VERSION 5 ++#define __DRI_SWRAST_LOADER_VERSION 6 + struct __DRIswrastLoaderExtensionRec { + __DRIextension base; + +@@ -711,6 +711,19 @@ struct __DRIswrastLoaderExtensionRec { + int width, int height, int stride, + int shmid, char *shmaddr, unsigned offset, + void *loaderPrivate); ++ ++ /** ++ * get shm image to drawable (v2) ++ * ++ * There are some cases where GLX can't use SHM, but DRI ++ * still tries, we need to get a return type for when to ++ * fallback to the non-shm path. ++ * ++ * \since 6 ++ */ ++ GLboolean (*getImageShm2)(__DRIdrawable *readable, ++ int x, int y, int width, int height, ++ int shmid, void *loaderPrivate); + }; + + /** +diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c +index e3fb3f1b925..df364c47391 100644 +--- a/src/gallium/state_trackers/dri/drisw.c ++++ b/src/gallium/state_trackers/dri/drisw.c +@@ -138,6 +138,9 @@ get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height, + if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) + return FALSE; + ++ if (loader->base.version > 5 && loader->getImageShm2) ++ return loader->getImageShm2(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate); ++ + loader->getImageShm(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate); + return TRUE; + } +-- +2.21.1 + diff --git a/SOURCES/0002-glx-add-getImageShm2-path.patch b/SOURCES/0002-glx-add-getImageShm2-path.patch new file mode 100644 index 0000000..d8062b3 --- /dev/null +++ b/SOURCES/0002-glx-add-getImageShm2-path.patch @@ -0,0 +1,77 @@ +From 74e4f90deeae466ed19d2a31d8f62f6fc5e1709b Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Fri, 14 Feb 2020 15:03:24 +1000 +Subject: [PATCH 2/2] glx: add getImageShm2 path + +If the glx side shmid is -1 (because the X server failed to attach) +then we should let the caller know to fallback. + +Fixes: 02c3dad0f3b4 ("Call shmget() with permission 0600 instead of 0777") +--- + src/glx/drisw_glx.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c +index 069f64d5216..dfa3218d759 100644 +--- a/src/glx/drisw_glx.c ++++ b/src/glx/drisw_glx.c +@@ -288,10 +288,10 @@ swrastGetImage(__DRIdrawable * read, + swrastGetImage2(read, x, y, w, h, 0, data, loaderPrivate); + } + +-static void +-swrastGetImageShm(__DRIdrawable * read, +- int x, int y, int w, int h, +- int shmid, void *loaderPrivate) ++static GLboolean ++swrastGetImageShm2(__DRIdrawable * read, ++ int x, int y, int w, int h, ++ int shmid, void *loaderPrivate) + { + struct drisw_drawable *prp = loaderPrivate; + __GLXDRIdrawable *pread = &(prp->base); +@@ -301,8 +301,11 @@ swrastGetImageShm(__DRIdrawable * read, + + if (!prp->ximage || shmid != prp->shminfo.shmid) { + if (!XCreateDrawable(prp, shmid, dpy)) +- return; ++ return GL_FALSE; + } ++ ++ if (prp->shminfo.shmid == -1) ++ return GL_FALSE; + readable = pread->xDrawable; + + ximage = prp->ximage; +@@ -312,10 +315,19 @@ swrastGetImageShm(__DRIdrawable * read, + ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32); + + XShmGetImage(dpy, readable, ximage, x, y, ~0L); ++ return GL_TRUE; ++} ++ ++static void ++swrastGetImageShm(__DRIdrawable * read, ++ int x, int y, int w, int h, ++ int shmid, void *loaderPrivate) ++{ ++ swrastGetImageShm2(read, x, y, w, h, shmid, loaderPrivate); + } + + static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = { +- .base = {__DRI_SWRAST_LOADER, 5 }, ++ .base = {__DRI_SWRAST_LOADER, 6 }, + + .getDrawableInfo = swrastGetDrawableInfo, + .putImage = swrastPutImage, +@@ -325,6 +337,7 @@ static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = { + .putImageShm = swrastPutImageShm, + .getImageShm = swrastGetImageShm, + .putImageShm2 = swrastPutImageShm2, ++ .getImageShm2 = swrastGetImageShm2, + }; + + static const __DRIextension *loader_extensions_shm[] = { +-- +2.21.1 + diff --git a/SOURCES/dri-shm-fix-put-image.patch b/SOURCES/dri-shm-fix-put-image.patch new file mode 100644 index 0000000..8d90146 --- /dev/null +++ b/SOURCES/dri-shm-fix-put-image.patch @@ -0,0 +1,12 @@ +diff -up mesa-18.3.4/src/glx/drisw_glx.c.dma mesa-18.3.4/src/glx/drisw_glx.c +--- mesa-18.3.4/src/glx/drisw_glx.c.dma 2020-03-13 09:53:49.347674709 +1000 ++++ mesa-18.3.4/src/glx/drisw_glx.c 2020-03-13 09:54:23.704608060 +1000 +@@ -241,7 +241,7 @@ swrastXPutImage(__DRIdrawable * draw, in + XShmPutImage(dpy, drawable, gc, ximage, srcx, srcy, x, y, w, h, False); + XSync(dpy, False); + } else { +- ximage->width = w; ++ ximage->width = ximage->bytes_per_line / ((ximage->bits_per_pixel + 7)/ 8); + ximage->height = h; + XPutImage(dpy, drawable, gc, ximage, srcx, srcy, x, y, w, h); + } diff --git a/SPECS/mesa.spec b/SPECS/mesa.spec index 9e29839..a7c12e2 100644 --- a/SPECS/mesa.spec +++ b/SPECS/mesa.spec @@ -61,7 +61,7 @@ Summary: Mesa graphics libraries Name: mesa Version: 18.3.4 -Release: 7%{?dist} +Release: 6%{?dist}.1 License: MIT Group: System Environment/Libraries URL: http://www.mesa3d.org @@ -86,6 +86,9 @@ Patch3: fix-timeout-warnings.patch Patch4: 0001-glx-fix-shared-memory-leak-in-X11.patch # fix remove shm Patch5: fix-llvmpipe-remote-shm.patch +Patch6: dri-shm-fix-put-image.patch +Patch7: 0001-dri-add-another-get-shm-variant.patch +Patch8: 0002-glx-add-getImageShm2-path.patch Patch12: mesa-8.0.1-fix-16bpp.patch Patch15: mesa-9.2-hardware-float.patch @@ -345,6 +348,9 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1 %patch3 -p1 -b .timeout %patch4 -p1 -b .shmleak %patch5 -p1 -b .shmremote +%patch6 -p1 -b .shmputfix +%patch7 -p1 -b .shmget1 +%patch8 -p1 -b .shmget2 #patch12 -p1 -b .16bpp @@ -668,8 +674,8 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog -* Thu Jan 23 2020 Tomas Pelka - 18.3.4-7 -- bump version and rebuild to avoind conflict with 7.7.z build (#1543572) +* Fri Mar 13 2020 Dave Airlie - 18.3.4-6.1 +- Backport put/get shm fixes to EL7 (#1749699) * Mon Jan 06 2020 Ben Crocker - 18.3.4-6 - Patch to require Large CodeModel for llvmpipe on ppc64/ppc64le (#1543572)