summaryrefslogtreecommitdiff
path: root/src/egl/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/egldisplay.c6
-rw-r--r--src/egl/main/egldisplay.h6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 359900ca2f..125909d2bc 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -242,7 +242,10 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
void
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
{
+ assert(!res->Display || res->Display == dpy);
+
res->Display = dpy;
+ res->IsLinked = EGL_TRUE;
res->Next = dpy->ResourceLists[type];
dpy->ResourceLists[type] = res;
}
@@ -271,5 +274,6 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
}
res->Next = NULL;
- res->Display = NULL;
+ /* do not reset res->Display */
+ res->IsLinked = EGL_FALSE;
}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 0f5d3a01bb..8f74ad23a8 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -19,7 +19,11 @@ enum _egl_resource_type {
*/
struct _egl_resource
{
+ /* which display the resource belongs to */
_EGLDisplay *Display;
+ EGLBoolean IsLinked;
+
+ /* used to link resources of the same type */
_EGLResource *Next;
};
@@ -179,7 +183,7 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
static INLINE EGLBoolean
_eglIsResourceLinked(_EGLResource *res)
{
- return (res->Display != NULL);
+ return res->IsLinked;
}