|
|
a24c5fa |
From patchwork Wed May 23 09:43:33 2018
|
|
|
a24c5fa |
Content-Type: text/plain; charset="utf-8"
|
|
|
a24c5fa |
MIME-Version: 1.0
|
|
|
a24c5fa |
Content-Transfer-Encoding: 8bit
|
|
|
a24c5fa |
Subject: [xserver, 2/2] glamor: Propagate glamor_fds_from_pixmap error in
|
|
|
a24c5fa |
glamor_fd_from_pixmap
|
|
|
a24c5fa |
From: =?utf-8?q?Michel_D=C3=A4nzer?= <michel@daenzer.net>
|
|
|
a24c5fa |
X-Patchwork-Id: 224910
|
|
|
a24c5fa |
Message-Id: <20180523094333.11076-2-michel@daenzer.net>
|
|
|
a24c5fa |
To: =?UTF-8?q?Louis-Francis=20Ratt=C3=A9-Boulianne?= <lfrb@collabora.com>,
|
|
|
a24c5fa |
Daniel Stone <daniels@collabora.com>
|
|
|
a24c5fa |
Cc: xorg-devel@lists.x.org
|
|
|
a24c5fa |
Date: Wed, 23 May 2018 11:43:33 +0200
|
|
|
a24c5fa |
|
|
|
a24c5fa |
From: Michel Dänzer <michel.daenzer@amd.com>
|
|
|
a24c5fa |
|
|
|
a24c5fa |
glamor_fds_from_pixmap returns 0 on error, but we were treating that as
|
|
|
a24c5fa |
success, continuing with uninitialized stride and fd values.
|
|
|
a24c5fa |
|
|
|
a24c5fa |
Also bail if the offset isn't 0, same as in dri3_fd_from_pixmap.
|
|
|
a24c5fa |
|
|
|
a24c5fa |
Fixes: c8c276c9569b "glamor: Implement PixmapFromBuffers and
|
|
|
a24c5fa |
BuffersFromPixmap"
|
|
|
a24c5fa |
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
|
|
|
a24c5fa |
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
|
|
|
a24c5fa |
---
|
|
|
a24c5fa |
glamor/glamor.c | 16 +++++++---------
|
|
|
a24c5fa |
1 file changed, 7 insertions(+), 9 deletions(-)
|
|
|
a24c5fa |
|
|
|
a24c5fa |
diff --git a/glamor/glamor.c b/glamor/glamor.c
|
|
|
a24c5fa |
index e2c74d17a..63f0947fa 100644
|
|
|
a24c5fa |
--- a/glamor/glamor.c
|
|
|
a24c5fa |
+++ b/glamor/glamor.c
|
|
|
a24c5fa |
@@ -865,17 +865,15 @@ glamor_fd_from_pixmap(ScreenPtr screen,
|
|
|
a24c5fa |
&modifier);
|
|
|
a24c5fa |
|
|
|
a24c5fa |
/* Pixmaps with multi-planes/modifier are not supported in this interface */
|
|
|
a24c5fa |
- if (ret > 1) {
|
|
|
a24c5fa |
- while (ret > 0)
|
|
|
a24c5fa |
- close(fds[--ret]);
|
|
|
a24c5fa |
- return -1;
|
|
|
a24c5fa |
+ if (ret == 1 && offsets[0] == 0) {
|
|
|
a24c5fa |
+ *stride = strides[0];
|
|
|
a24c5fa |
+ *size = pixmap->drawable.height * *stride;
|
|
|
a24c5fa |
+ return fds[0];
|
|
|
a24c5fa |
}
|
|
|
a24c5fa |
|
|
|
a24c5fa |
- ret = fds[0];
|
|
|
a24c5fa |
- *stride = strides[0];
|
|
|
a24c5fa |
- *size = pixmap->drawable.height * *stride;
|
|
|
a24c5fa |
-
|
|
|
a24c5fa |
- return ret;
|
|
|
a24c5fa |
+ while (ret > 0)
|
|
|
a24c5fa |
+ close(fds[--ret]);
|
|
|
a24c5fa |
+ return -1;
|
|
|
a24c5fa |
}
|
|
|
a24c5fa |
|
|
|
a24c5fa |
_X_EXPORT int
|