st/mesa: Handle st_framebuffer_create returning NULL

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: 147d7fb772 ("st/mesa: add a winsys buffers list in st_context")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101775
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Michel Dänzer
2017-07-13 01:21:00 -06:00
committed by Brian Paul
parent 254fa3dbf5
commit 655a32f729

View File

@@ -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;