[Mesa-dev] [PATCH] st/mesa: Handle st_framebuffer_create returning NULL

Charmaine Lee charmainel at vmware.com
Thu Jul 13 15:57:58 UTC 2017


Reviewed-by: Charmaine Lee <charmainel at vmware.com>
________________________________________
From: Michel Dänzer <michel at daenzer.net>
Sent: Thursday, July 13, 2017 12:21 AM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] st/mesa: Handle st_framebuffer_create returning NULL

From: Michel Dänzer <michel.daenzer at amd.com>

st_framebuffer_create returns NULL if stfbi == NULL or
st_framebuffer_add_renderbuffer returns false for the colour buffer.

Fixes Xorg crashing on startup using glamor on radeonsi.

Fixes: 147d7fb772a7 ("st/mesa: add a winsys buffers list in st_context")
Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D101775&d=DwIDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ang1qmMo4GwCmRUnLE-f31kqPa6AOnoS-OAMUzQyM0M&m=UEU3ibcz-_bgA7gbDqxCJ-TuosvjQ-3MVZhk0YlAaHM&s=m4MMnUdTtDoBav5jZlfidkkA0ORGokAl9-djnste8Hw&e=
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/mesa/state_tracker/st_manager.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index de16a3a2cf..348b456c4d 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -802,10 +802,12 @@ st_framebuffer_reuse_or_create(struct st_context *st,
    if (stfb == NULL) {
       cur = st_framebuffer_create(st, stfbi);

-      /* add to the context's winsys buffers list */
-      LIST_ADD(&cur->head, &st->winsys_buffers);
+      if (cur) {
+         /* add to the context's winsys buffers list */
+         LIST_ADD(&cur->head, &st->winsys_buffers);

-      st_framebuffer_reference(&stfb, cur);
+         st_framebuffer_reference(&stfb, cur);
+      }
    }

    return stfb;
--
2.13.2



More information about the mesa-dev mailing list