1 #ifndef EGLDRIVER_INCLUDED
2 #define EGLDRIVER_INCLUDED
5 #include "egltypedefs.h"
10 * Define an inline driver typecast function.
12 #define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \
13 static INLINE struct drvtype *drvtype(const egltype *obj) \
14 { return (struct drvtype *) code; }
18 * Define the driver typecast functions for _EGLDriver, _EGLDisplay,
19 * _EGLContext, _EGLSurface, and _EGLConfig.
21 #define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \
22 _EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \
23 /* note that this is not a direct cast */ \
24 _EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \
25 _EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \
26 _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \
27 _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj)
30 typedef _EGLDriver
*(*_EGLMain_t
)(const char *args
);
34 * Base class for device drivers.
38 void *LibHandle
; /**< dlopen handle */
39 const char *Path
; /**< path to this driver */
40 const char *Args
; /**< args to load this driver */
42 const char *Name
; /**< name of this driver */
45 * Probe a display and return a score.
48 * 50 means the driver supports the display;
49 * 90 means the driver can accelerate the display;
50 * 100 means a perfect match.
52 EGLint (*Probe
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
55 * Release the driver resource.
57 * It is called before dlclose().
59 void (*Unload
)(_EGLDriver
*drv
);
61 _EGLAPI API
; /**< EGL API dispatch table */
66 _eglMain(const char *args
);
70 _eglMatchDriver(_EGLDisplay
*dpy
);
74 _eglPreloadDrivers(void);
78 _eglUnloadDrivers(void);
82 _eglInitDriverFallbacks(_EGLDriver
*drv
);
86 _eglSetProbeCache(EGLint key
, const void *val
);
90 _eglGetProbeCache(EGLint key
);
93 #endif /* EGLDRIVER_INCLUDED */