X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fegl%2Fmain%2Fegldisplay.h;h=5d44eb1ea88f35eca4c8148de45c01c35356a75d;hb=dbb866ab33862defc2749134805bafebf323fd11;hp=6575fdf198f4b9598f176a5d0a09c03d5619d8c9;hpb=5d526ed21ac9f1ec9220c2adb4c905893eb9d990;p=mesa.git diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 6575fdf198f..5d44eb1ea88 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -3,8 +3,25 @@ #include "egltypedefs.h" #include "egldefines.h" -#include "eglcontext.h" -#include "eglsurface.h" + + +enum _egl_resource_type { + _EGL_RESOURCE_CONTEXT, + _EGL_RESOURCE_SURFACE, + _EGL_RESOURCE_IMAGE, + + _EGL_NUM_RESOURCES +}; + + +/** + * A resource of a display. + */ +struct _egl_resource +{ + _EGLDisplay *Display; + _EGLResource *Next; +}; /** @@ -14,6 +31,8 @@ struct _egl_extensions { EGLBoolean MESA_screen_surface; EGLBoolean MESA_copy_context; + EGLBoolean KHR_image_base; + EGLBoolean KHR_image_pixmap; char String[_EGL_MAX_EXTENSIONS_LEN]; }; @@ -26,7 +45,6 @@ struct _egl_display EGLNativeDisplayType NativeDisplay; - const char *DriverName; _EGLDriver *Driver; void *DriverData; /* private to driver */ @@ -44,12 +62,12 @@ struct _egl_display EGLint NumScreens; _EGLScreen **Screens; /* array [NumScreens] */ + EGLint MaxConfigs; EGLint NumConfigs; _EGLConfig **Configs; /* array [NumConfigs] of ptr to _EGLConfig */ - /* lists of linked contexts and surface */ - _EGLContext *ContextList; - _EGLSurface *SurfaceList; + /* lists of resources */ + _EGLResource *ResourceLists[_EGL_NUM_RESOURCES]; }; @@ -57,10 +75,6 @@ extern void _eglFiniDisplay(void); -extern char * -_eglSplitDisplayString(const char *dpyString, const char **args); - - extern _EGLDisplay * _eglNewDisplay(NativeDisplayType displayName); @@ -77,30 +91,14 @@ extern _EGLDisplay * _eglFindDisplay(NativeDisplayType nativeDisplay); -extern void +PUBLIC void _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *dpy); -extern void +PUBLIC void _eglCleanupDisplay(_EGLDisplay *disp); -extern EGLContext -_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy); - - -extern void -_eglUnlinkContext(_EGLContext *ctx); - - -extern EGLSurface -_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy); - - -extern void -_eglUnlinkSurface(_EGLSurface *surf); - - #ifndef _EGL_SKIP_HANDLE_CHECK @@ -109,11 +107,7 @@ _eglCheckDisplayHandle(EGLDisplay dpy); extern EGLBoolean -_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy); - - -extern EGLBoolean -_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy); +_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy); #else /* !_EGL_SKIP_HANDLE_CHECK */ @@ -128,18 +122,9 @@ _eglCheckDisplayHandle(EGLDisplay dpy) static INLINE EGLBoolean -_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy) -{ - _EGLContext *c = (_EGLContext *) ctx; - return (dpy && c && c->Display == dpy); -} - - -static INLINE EGLBoolean -_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy) +_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy); { - _EGLSurface *s = (_EGLSurface *) surf; - return (dpy && s && s->Display == dpy); + return (((_EGLResource *) res)->Display == dpy); } @@ -180,92 +165,21 @@ _eglIsDisplayLinked(_EGLDisplay *dpy) } -/** - * Lookup a handle to find the linked context. - * Return NULL if the handle has no corresponding linked context. - */ -static INLINE _EGLContext * -_eglLookupContext(EGLContext context, _EGLDisplay *dpy) -{ - _EGLContext *ctx = (_EGLContext *) context; - if (!_eglCheckContextHandle(context, dpy)) - ctx = NULL; - return ctx; -} - - -/** - * Return the handle of a linked context, or EGL_NO_CONTEXT. - */ -static INLINE EGLContext -_eglGetContextHandle(_EGLContext *ctx) -{ - return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT); -} - - -/** - * Return true if the context is linked to a display. - */ -static INLINE EGLBoolean -_eglIsContextLinked(_EGLContext *ctx) -{ - return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT); -} - - -/** - * Lookup a handle to find the linked surface. - * Return NULL if the handle has no corresponding linked surface. - */ -static INLINE _EGLSurface * -_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy) -{ - _EGLSurface *surf = (_EGLSurface *) surface; - if (!_eglCheckSurfaceHandle(surf, dpy)) - surf = NULL; - return surf; -} +extern void +_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy); -/** - * Return the handle of a linked surface, or EGL_NO_SURFACE. - */ -static INLINE EGLSurface -_eglGetSurfaceHandle(_EGLSurface *surf) -{ - return (EGLSurface) ((surf && surf->Display) ? surf : EGL_NO_SURFACE); -} +extern void +_eglUnlinkResource(_EGLResource *res, _EGLResourceType type); /** - * Return true if the surface is linked to a display. + * Return true if the resource is linked. */ static INLINE EGLBoolean -_eglIsSurfaceLinked(_EGLSurface *surf) -{ - return (EGLBoolean) (_eglGetSurfaceHandle(surf) != EGL_NO_SURFACE); -} - - -/** - * Cast an unsigned int to a pointer. - */ -static INLINE void * -_eglUIntToPointer(unsigned int v) -{ - return (void *) ((uintptr_t) v); -} - - -/** - * Cast a pointer to an unsigned int. The pointer must be one that is - * returned by _eglUIntToPointer. - */ -static INLINE unsigned int -_eglPointerToUInt(const void *p) +_eglIsResourceLinked(_EGLResource *res) { - return (unsigned int) ((uintptr_t) p); + return (res->Display != NULL); }