xorg-x11-server/0008-glamor-Propagate-FBO-allocation-failure-for-picture-.patch
Olivier Fourdan 1e468bc44a xserver 1.20.7
- backport from stable "xserver-1.20-branch" up to commit ad7364d8d
  (for mutter fullscreen unredirect on Wayland)
- Update videodrv minor ABI as 1.20.7 changed the minor ABI version
  (backward compatible, API addition in glamor)
- Rebase Xwayland randr resolution change emulation support patches
2020-03-13 09:54:18 +01:00

45 lines
1.7 KiB
Diff

From 428b5ce4da99a43bfa0c1933ec447f7feb3639a1 Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Date: Mon, 10 Feb 2020 10:19:18 +0100
Subject: [PATCH xserver 08/22] glamor: Propagate FBO allocation failure for
picture to texture upload
When uploading a picture to a texture, glamor_upload_picture_to_texture
calls glamor_pixmap_ensure_fbo to ensure that there is backing FBO.
The FBO will be allocated if the picture's drawable pixmap does not have
one already, which can fail when there is no GL memory left.
glamor_upload_picture_to_texture checks that the call succeeded and will
enter the failure path if it did not. However, unlike many other
functions in glamor, this one has ret set to TRUE initially, so it needs
to be set to FALSE when a failure happens.
Otherwise, the error is not propagated and the failure path return TRUE.
This leads to a fault when trying to access the FBO pointer later on.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
(cherry picked from commit c98c7709c67d8ed6b7455ec700a49b58c396ec2c)
---
glamor/glamor_picture.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 84a33ad6a..685d8d618 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -340,8 +340,10 @@ glamor_upload_picture_to_texture(PicturePtr picture)
else
iformat = format;
- if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO))
+ if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) {
+ ret = FALSE;
goto fail;
+ }
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
--
2.24.1