1 #ifndef EGLIMAGE_INCLUDED
2 #define EGLIMAGE_INCLUDED
5 #include "egltypedefs.h"
6 #include "egldisplay.h"
10 * "Base" class for device driver images.
14 /* An image is a display resource */
15 _EGLResource Resource
;
18 EGLint GLTextureLevel
;
19 EGLint GLTextureZOffset
;
24 _eglInitImage(_EGLImage
*img
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
);
28 _eglCreateImageKHR(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
,
29 EGLenum target
, EGLClientBuffer buffer
, const EGLint
*attr_list
);
33 _eglDestroyImageKHR(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLImage
*image
);
37 * Link an image to a display and return the handle of the link.
38 * The handle can be passed to client directly.
40 static INLINE EGLImageKHR
41 _eglLinkImage(_EGLImage
*img
, _EGLDisplay
*dpy
)
43 _eglLinkResource(&img
->Resource
, _EGL_RESOURCE_IMAGE
, dpy
);
44 return (EGLImageKHR
) img
;
49 * Unlink a linked image from its display.
50 * Accessing an unlinked image should generate EGL_BAD_PARAMETER error.
53 _eglUnlinkImage(_EGLImage
*img
)
55 _eglUnlinkResource(&img
->Resource
, _EGL_RESOURCE_IMAGE
);
60 * Lookup a handle to find the linked image.
61 * Return NULL if the handle has no corresponding linked image.
63 static INLINE _EGLImage
*
64 _eglLookupImage(EGLImageKHR image
, _EGLDisplay
*dpy
)
66 _EGLImage
*img
= (_EGLImage
*) image
;
67 if (!dpy
|| !_eglCheckResource((void *) img
, _EGL_RESOURCE_IMAGE
, dpy
))
74 * Return the handle of a linked image, or EGL_NO_IMAGE_KHR.
76 static INLINE EGLImageKHR
77 _eglGetImageHandle(_EGLImage
*img
)
79 _EGLResource
*res
= (_EGLResource
*) img
;
80 return (res
&& _eglIsResourceLinked(res
)) ?
81 (EGLImageKHR
) img
: EGL_NO_IMAGE_KHR
;
86 * Return true if the image is linked to a display.
88 static INLINE EGLBoolean
89 _eglIsImageLinked(_EGLImage
*img
)
91 _EGLResource
*res
= (_EGLResource
*) img
;
92 return (res
&& _eglIsResourceLinked(res
));
96 #endif /* EGLIMAGE_INCLUDED */