[Mesa-dev] [PATCH 1/4] st/mesa: Propagate framebuffer validation failure

George Barrett bob at bob131.so
Tue Nov 21 11:15:56 UTC 2017


st_framebuffer_validate discards the result of the validate interface
method, preventing functions up the call stack from being notified of
any failure. Update st_framebuffer_validate to resolve this, and amend
st_api_make_current to propagate this failure up the stack.
---
 src/mesa/state_tracker/st_manager.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 380b05c53f..a6eb5aef23 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -180,7 +180,7 @@ st_context_validate(struct st_context *st,
  * drawable state, not context state, and can be freed by another pipe
  * context).
  */
-static void
+static boolean
 st_framebuffer_validate(struct st_framebuffer *stfb,
                         struct st_context *st)
 {
@@ -192,7 +192,7 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
 
    new_stamp = p_atomic_read(&stfb->iface->stamp);
    if (stfb->iface_stamp == new_stamp)
-      return;
+      return TRUE;
 
    memset(textures, 0, stfb->num_statts * sizeof(textures[0]));
 
@@ -200,7 +200,7 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
    do {
       if (!stfb->iface->validate(&st->iface, stfb->iface, stfb->statts,
                                  stfb->num_statts, textures))
-         return;
+         return FALSE;
 
       stfb->iface_stamp = new_stamp;
       new_stamp = p_atomic_read(&stfb->iface->stamp);
@@ -259,6 +259,8 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
       ++stfb->stamp;
       _mesa_resize_framebuffer(st->ctx, &stfb->Base, width, height);
    }
+
+   return TRUE;
 }
 
 
@@ -1035,9 +1037,12 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
       }
 
       if (stdraw && stread) {
-         st_framebuffer_validate(stdraw, st);
+         if (!st_framebuffer_validate(stdraw, st))
+            return FALSE;
+
          if (stread != stdraw)
-            st_framebuffer_validate(stread, st);
+            if (!st_framebuffer_validate(stread, st))
+               return FALSE;
 
          ret = _mesa_make_current(st->ctx, &stdraw->Base, &stread->Base);
 
-- 
2.14.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171121/df423f8b/attachment.sig>


More information about the mesa-dev mailing list