summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2011-06-29 09:00:23 +0200
committerThomas Hellstrom <[email protected]>2011-06-29 12:48:59 +0200
commitac8fdbc1c723afb19eeaba5457ba78d0bf33b8d4 (patch)
tree34b7c9d72551aa7976d634738585d65a256760ae /src/gallium/state_trackers/egl
parent1a7e17e44a1129bbd6a0f454fe95b3ce8240cd45 (diff)
st-api: Rework how drawables are invalidated v3.
The api and the state tracker manager code as well as the state tracker code assumed that only a single context could be bound to a drawable. That is not a valid assumption, since multiple contexts can bind to the same drawable. Fix this by making it the state tracker's responsibility to update all contexts binding to a drawable Note that the state trackers themselves don't use atomic stamps on frame-buffers. Multiple context rendering to the same drawable should be protected by the application. Signed-off-by: Thomas Hellstrom <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/egl')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c13
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c7
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c2
3 files changed, 6 insertions, 16 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 7d1eafe3bec..6649f02b244 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -31,6 +31,7 @@
#include "util/u_memory.h"
#include "util/u_format.h"
#include "util/u_string.h"
+#include "util/u_atomic.h"
#include "egl_g3d.h"
#include "egl_g3d_api.h"
@@ -45,15 +46,9 @@ egl_g3d_invalid_surface(struct native_display *ndpy,
{
/* XXX not thread safe? */
struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf->user_data);
- struct egl_g3d_context *gctx;
-
- /*
- * Some functions such as egl_g3d_copy_buffers create a temporary native
- * surface. There is no gsurf associated with it.
- */
- gctx = (gsurf) ? egl_g3d_context(gsurf->base.CurrentContext) : NULL;
- if (gctx)
- gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
+
+ if (gsurf && gsurf->stfbi)
+ p_atomic_inc(&gsurf->stfbi->stamp);
}
static struct pipe_screen *
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index cd68e97023b..f897054a540 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -504,19 +504,12 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
(gdraw) ? gdraw->stfbi : NULL, (gread) ? gread->stfbi : NULL);
if (ok) {
if (gdraw) {
- gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi,
- gdraw->stfbi);
-
if (gdraw->base.Type == EGL_WINDOW_BIT) {
gctx->base.WindowRenderBuffer =
(gdraw->stvis.render_buffer == ST_ATTACHMENT_FRONT_LEFT) ?
EGL_SINGLE_BUFFER : EGL_BACK_BUFFER;
}
}
- if (gread && gread != gdraw) {
- gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi,
- gread->stfbi);
- }
}
}
else if (old_gctx) {
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index 2b944b521a4..60c3e332ac9 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -292,6 +292,8 @@ egl_g3d_create_st_framebuffer(_EGLSurface *surf)
return NULL;
stfbi->visual = &gsurf->stvis;
+ p_atomic_set(&stfbi->stamp, 1);
+
if (gsurf->base.Type != EGL_PBUFFER_BIT) {
stfbi->flush_front = egl_g3d_st_framebuffer_flush_front;
stfbi->validate = egl_g3d_st_framebuffer_validate;