|
|
751470 |
From 74e4f90deeae466ed19d2a31d8f62f6fc5e1709b Mon Sep 17 00:00:00 2001
|
|
|
751470 |
From: Dave Airlie <airlied@redhat.com>
|
|
|
751470 |
Date: Fri, 14 Feb 2020 15:03:24 +1000
|
|
|
751470 |
Subject: [PATCH 2/2] glx: add getImageShm2 path
|
|
|
751470 |
|
|
|
751470 |
If the glx side shmid is -1 (because the X server failed to attach)
|
|
|
751470 |
then we should let the caller know to fallback.
|
|
|
751470 |
|
|
|
751470 |
Fixes: 02c3dad0f3b4 ("Call shmget() with permission 0600 instead of 0777")
|
|
|
751470 |
---
|
|
|
751470 |
src/glx/drisw_glx.c | 25 +++++++++++++++++++------
|
|
|
751470 |
1 file changed, 19 insertions(+), 6 deletions(-)
|
|
|
751470 |
|
|
|
751470 |
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
|
|
|
751470 |
index 069f64d5216..dfa3218d759 100644
|
|
|
751470 |
--- a/src/glx/drisw_glx.c
|
|
|
751470 |
+++ b/src/glx/drisw_glx.c
|
|
|
751470 |
@@ -288,10 +288,10 @@ swrastGetImage(__DRIdrawable * read,
|
|
|
751470 |
swrastGetImage2(read, x, y, w, h, 0, data, loaderPrivate);
|
|
|
751470 |
}
|
|
|
751470 |
|
|
|
751470 |
-static void
|
|
|
751470 |
-swrastGetImageShm(__DRIdrawable * read,
|
|
|
751470 |
- int x, int y, int w, int h,
|
|
|
751470 |
- int shmid, void *loaderPrivate)
|
|
|
751470 |
+static GLboolean
|
|
|
751470 |
+swrastGetImageShm2(__DRIdrawable * read,
|
|
|
751470 |
+ int x, int y, int w, int h,
|
|
|
751470 |
+ int shmid, void *loaderPrivate)
|
|
|
751470 |
{
|
|
|
751470 |
struct drisw_drawable *prp = loaderPrivate;
|
|
|
751470 |
__GLXDRIdrawable *pread = &(prp->base);
|
|
|
751470 |
@@ -301,8 +301,11 @@ swrastGetImageShm(__DRIdrawable * read,
|
|
|
751470 |
|
|
|
751470 |
if (!prp->ximage || shmid != prp->shminfo.shmid) {
|
|
|
751470 |
if (!XCreateDrawable(prp, shmid, dpy))
|
|
|
751470 |
- return;
|
|
|
751470 |
+ return GL_FALSE;
|
|
|
751470 |
}
|
|
|
751470 |
+
|
|
|
751470 |
+ if (prp->shminfo.shmid == -1)
|
|
|
751470 |
+ return GL_FALSE;
|
|
|
751470 |
readable = pread->xDrawable;
|
|
|
751470 |
|
|
|
751470 |
ximage = prp->ximage;
|
|
|
751470 |
@@ -312,10 +315,19 @@ swrastGetImageShm(__DRIdrawable * read,
|
|
|
751470 |
ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
|
|
|
751470 |
|
|
|
751470 |
XShmGetImage(dpy, readable, ximage, x, y, ~0L);
|
|
|
751470 |
+ return GL_TRUE;
|
|
|
751470 |
+}
|
|
|
751470 |
+
|
|
|
751470 |
+static void
|
|
|
751470 |
+swrastGetImageShm(__DRIdrawable * read,
|
|
|
751470 |
+ int x, int y, int w, int h,
|
|
|
751470 |
+ int shmid, void *loaderPrivate)
|
|
|
751470 |
+{
|
|
|
751470 |
+ swrastGetImageShm2(read, x, y, w, h, shmid, loaderPrivate);
|
|
|
751470 |
}
|
|
|
751470 |
|
|
|
751470 |
static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = {
|
|
|
751470 |
- .base = {__DRI_SWRAST_LOADER, 5 },
|
|
|
751470 |
+ .base = {__DRI_SWRAST_LOADER, 6 },
|
|
|
751470 |
|
|
|
751470 |
.getDrawableInfo = swrastGetDrawableInfo,
|
|
|
751470 |
.putImage = swrastPutImage,
|
|
|
751470 |
@@ -325,6 +337,7 @@ static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = {
|
|
|
751470 |
.putImageShm = swrastPutImageShm,
|
|
|
751470 |
.getImageShm = swrastGetImageShm,
|
|
|
751470 |
.putImageShm2 = swrastPutImageShm2,
|
|
|
751470 |
+ .getImageShm2 = swrastGetImageShm2,
|
|
|
751470 |
};
|
|
|
751470 |
|
|
|
751470 |
static const __DRIextension *loader_extensions_shm[] = {
|
|
|
751470 |
--
|
|
|
751470 |
2.21.1
|
|
|
751470 |
|