summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2017-07-20 11:04:14 -0700
committerCharmaine Lee <[email protected]>2017-07-20 17:34:34 -0700
commit5124bf982393114862f44ee62fa361027faa7c29 (patch)
treeccf369ce57ec78bd9cb214d3584383caf8c6a035 /src/gallium
parent59a141c95a7f4008ba5d5d7804fa75e6b8604a06 (diff)
st/mesa: add destroy_drawable interface
With this patch, the st manager will maintain a hash table for the active framebuffer interface objects. A destroy_drawable interface is added to allow the state tracker to notify the st manager to remove the associated framebuffer interface object from the hash table, so the associated framebuffer and its resources can be deleted at framebuffers purge time. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101829 Fixes: 147d7fb772a ("st/mesa: add a winsys buffers list in st_context") Tested-by: Brad King <[email protected]> Tested-by: Gert Wollny <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/include/state_tracker/st_api.h7
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c6
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c5
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c2
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.c6
5 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 30a4866a7af..9b660f74c93 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -552,6 +552,13 @@ struct st_api
* Get the currently bound context in the calling thread.
*/
struct st_context_iface *(*get_current)(struct st_api *stapi);
+
+ /**
+ * Notify the st manager the framebuffer interface object
+ * is no longer valid.
+ */
+ void (*destroy_drawable)(struct st_api *stapi,
+ struct st_framebuffer_iface *stfbi);
};
/**
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 0cfdc305583..c7df0f63327 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -169,6 +169,8 @@ void
dri_destroy_buffer(__DRIdrawable * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct dri_screen *screen = drawable->screen;
+ struct st_api *stapi = screen->st_api;
int i;
pipe_surface_reference(&drawable->drisw_surface, NULL);
@@ -180,7 +182,9 @@ dri_destroy_buffer(__DRIdrawable * dPriv)
swap_fences_unref(drawable);
- drawable->base.ID = 0;
+ /* Notify the st manager that this drawable is no longer valid */
+ stapi->destroy_drawable(stapi, &drawable->base);
+
FREE(drawable);
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 881dd443232..e4b1e9dd4de 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -595,6 +595,11 @@ xmesa_free_buffer(XMesaBuffer buffer)
*/
b->ws.drawable = 0;
+ /* Notify the st manager that the associated framebuffer interface
+ * object is no longer valid.
+ */
+ stapi->destroy_drawable(stapi, buffer->stfb);
+
/* XXX we should move the buffer to a delete-pending list and destroy
* the buffer until it is no longer current.
*/
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 9e30efad60d..6a0f4aad7d8 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -273,6 +273,7 @@ xmesa_st_framebuffer_flush_front(struct st_context_iface *stctx,
return ret;
}
+static uint32_t xmesa_stfbi_ID = 0;
struct st_framebuffer_iface *
xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b)
@@ -302,6 +303,7 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b)
stfbi->visual = &xstfb->stvis;
stfbi->flush_front = xmesa_st_framebuffer_flush_front;
stfbi->validate = xmesa_st_framebuffer_validate;
+ stfbi->ID = p_atomic_inc_return(&xmesa_stfbi_ID);
p_atomic_set(&stfbi->stamp, 1);
stfbi->st_manager_private = (void *) xstfb;
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index c2844b04c4e..85a8b1743ea 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -256,7 +256,11 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb)
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(&stwfb->textures[i], NULL);
- stwfb->base.ID = 0;
+ /* Notify the st manager that the framebuffer interface is no
+ * longer valid.
+ */
+ stw_dev->stapi->destroy_drawable(stw_dev->stapi, &stwfb->base);
+
FREE(stwfb);
}