Mesa (master): mesa/st: Check for successful framebuffer allocation in st_api_make_current

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 1 18:41:50 UTC 2021


Module: Mesa
Branch: master
Commit: 04b28b9375b2204ab85d875d02474078ae942ed5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=04b28b9375b2204ab85d875d02474078ae942ed5

Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Mar 18 18:02:18 2021 -0400

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 at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9956>

---

 src/mesa/state_tracker/st_manager.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 9140bf2403c..a37b0fd1a65 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -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)



More information about the mesa-commit mailing list