egl: Use a boolean to indicate whether a resource is linked.

An unlinked resource may still be a current resource such as current
surfaces.  There might still be a need to know which display the
unlinked resource belongs to.
This commit is contained in:
Chia-I Wu
2010-01-26 15:16:49 +08:00
parent d21ee93fdb
commit f65ed0a309
2 changed files with 10 additions and 2 deletions

View File

@@ -242,7 +242,10 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
void void
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy) _eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
{ {
assert(!res->Display || res->Display == dpy);
res->Display = dpy; res->Display = dpy;
res->IsLinked = EGL_TRUE;
res->Next = dpy->ResourceLists[type]; res->Next = dpy->ResourceLists[type];
dpy->ResourceLists[type] = res; dpy->ResourceLists[type] = res;
} }
@@ -271,5 +274,6 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
} }
res->Next = NULL; res->Next = NULL;
res->Display = NULL; /* do not reset res->Display */
res->IsLinked = EGL_FALSE;
} }

View File

@@ -19,7 +19,11 @@ enum _egl_resource_type {
*/ */
struct _egl_resource struct _egl_resource
{ {
/* which display the resource belongs to */
_EGLDisplay *Display; _EGLDisplay *Display;
EGLBoolean IsLinked;
/* used to link resources of the same type */
_EGLResource *Next; _EGLResource *Next;
}; };
@@ -179,7 +183,7 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
static INLINE EGLBoolean static INLINE EGLBoolean
_eglIsResourceLinked(_EGLResource *res) _eglIsResourceLinked(_EGLResource *res)
{ {
return (res->Display != NULL); return res->IsLinked;
} }