[PATCH xserver 2/2] glamor: Propagate glamor_fds_from_pixmap error in glamor_fd_from_pixmap
Michel Dänzer
michel at daenzer.net
Wed May 23 09:43:33 UTC 2018
From: Michel Dänzer <michel.daenzer at amd.com>
glamor_fds_from_pixmap returns 0 on error, but we were treating that as
success, continuing with uninitialized stride and fd values.
Also bail if the offset isn't 0, same as in dri3_fd_from_pixmap.
Fixes: c8c276c9569b "glamor: Implement PixmapFromBuffers and
BuffersFromPixmap"
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
glamor/glamor.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/glamor/glamor.c b/glamor/glamor.c
index e2c74d17a..63f0947fa 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -865,17 +865,15 @@ glamor_fd_from_pixmap(ScreenPtr screen,
&modifier);
/* Pixmaps with multi-planes/modifier are not supported in this interface */
- if (ret > 1) {
- while (ret > 0)
- close(fds[--ret]);
- return -1;
+ if (ret == 1 && offsets[0] == 0) {
+ *stride = strides[0];
+ *size = pixmap->drawable.height * *stride;
+ return fds[0];
}
- ret = fds[0];
- *stride = strides[0];
- *size = pixmap->drawable.height * *stride;
-
- return ret;
+ while (ret > 0)
+ close(fds[--ret]);
+ return -1;
}
_X_EXPORT int
--
2.17.0
More information about the xorg-devel
mailing list