mesa/st: Check for successful framebuffer allocation in st_api_make_current

Ran into this while trying to rework fbconfig setup, due to a bug I
ended up trying to allocate a PIPE_FORMAT_NONE framebuffer, which failed
like you'd hope, but which we weren't converting into an error in
st_api_make_current. Instead we'd treat it like binding no drawable to
the context, which is really not what was asked for, so let's go ahead
and make this an error.

Reviewed-by: Eric Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9956>
This commit is contained in:
Adam Jackson
2021-03-18 18:02:18 -04:00
committed by Marge Bot
parent 95be3c9b6d
commit 04b28b9375

View File

@@ -1094,6 +1094,10 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
st_framebuffer_reference(&stread, stdraw);
}
/* If framebuffers were asked for, we'd better have allocated them */
if ((stdrawi && !stdraw) || (streadi && !stread))
return false;
if (stdraw && stread) {
st_framebuffer_validate(stdraw, st);
if (stread != stdraw)