summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2017-12-31 02:22:27 -0500
committerIlia Mirkin <imirkin@alum.mit.edu>2018-02-04 18:13:11 -0500
commitea83b9bd8c88dad67e6494031f1f65eed823b6f1 (patch)
tree5f22e7032366cb5ec8fef45cdba48847df8da314
parent048baf53872f2f93628f2c8637ec832fb4006057 (diff)
downloadxorg-driver-xf86-video-nouveau-ea83b9bd8c88dad67e6494031f1f65eed823b6f1.tar.gz
dri3: remove bogus condition for creating pixmap
Not clear what the depth % 8 was trying to protect against, but it was breaking 30bpp visuals with DRI3. Add it in to ensure that bitsPerPixel % 8 is 0, since there is plenty of bpp/8 math in the driver. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--src/nouveau_dri2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index cbb7b2a..ac0ca09 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -1076,13 +1076,16 @@ static PixmapPtr nouveau_dri3_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 wi
struct nouveau_bo *bo = NULL;
struct nouveau_pixmap *nvpix;
- if (depth < 8 || depth > 32 || depth % 8)
+ if (depth < 8 || depth > 32)
return NULL;
pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0);
if (!pixmap)
return NULL;
+ if (pixmap->drawable.bitsPerPixel % 8)
+ goto free_pixmap;
+
if (!screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL))
goto free_pixmap;