Mesa (master): st/osmesa: add osmesa framebuffer iface hash table per st manager

Tim Rowley torowley at kemper.freedesktop.org
Thu Aug 3 16:19:08 UTC 2017


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

Author: Bruce Cherniak <bruce.cherniak at intel.com>
Date:   Wed Aug  2 18:14:19 2017 -0500

st/osmesa: add osmesa framebuffer iface hash table per st manager

Commit bbc29393d3 didn't include osmesa state_tracker.  This patch adds
necessary initialization.

Fixes crash in OSMesa initialization.

Created-by: Charmaine Lee <charmainel at vmware.com>
Tested-by: Bruce Cherniak <bruce.cherniak at intel.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>

Cc: 17.2 <mesa-stable at lists.freedesktop.org>

---

 src/gallium/state_trackers/osmesa/osmesa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c
index 18f1b88128..751d255c54 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -439,6 +439,7 @@ osmesa_st_framebuffer_validate(struct st_context_iface *stctx,
    return TRUE;
 }
 
+static uint32_t osmesa_fb_ID = 0;
 
 static struct st_framebuffer_iface *
 osmesa_create_st_framebuffer(void)
@@ -448,6 +449,8 @@ osmesa_create_st_framebuffer(void)
       stfbi->flush_front = osmesa_st_framebuffer_flush_front;
       stfbi->validate = osmesa_st_framebuffer_validate;
       p_atomic_set(&stfbi->stamp, 1);
+      stfbi->ID = p_atomic_inc_return(&osmesa_fb_ID);
+      stfbi->state_manager = get_st_manager();
    }
    return stfbi;
 }
@@ -508,6 +511,14 @@ osmesa_find_buffer(enum pipe_format color_format,
 static void
 osmesa_destroy_buffer(struct osmesa_buffer *osbuffer)
 {
+   struct st_api *stapi = get_st_api();
+
+   /*
+    * Notify the state manager that the associated framebuffer interface
+    * is no longer valid.
+    */
+   stapi->destroy_drawable(stapi, osbuffer->stfb);
+
    FREE(osbuffer->stfb);
    FREE(osbuffer);
 }




More information about the mesa-commit mailing list