mirror of https://gitlab.freedesktop.org/mesa/mesa
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:
parent
d21ee93fdb
commit
f65ed0a309
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue