Merge remote branch 'origin/master' into glsl2
[mesa.git] / src / egl / main / egldriver.h
1 #ifndef EGLDRIVER_INCLUDED
2 #define EGLDRIVER_INCLUDED
3
4
5 #include "egltypedefs.h"
6 #include "eglapi.h"
7
8
9 /**
10 * Define an inline driver typecast function.
11 *
12 * Note that this macro defines a function and should not be ended with a
13 * semicolon when used.
14 */
15 #define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \
16 static INLINE struct drvtype *drvtype(const egltype *obj) \
17 { return (struct drvtype *) code; }
18
19
20 /**
21 * Define the driver typecast functions for _EGLDriver, _EGLDisplay,
22 * _EGLContext, _EGLSurface, and _EGLConfig.
23 *
24 * Note that this macro defines several functions and should not be ended with
25 * a semicolon when used.
26 */
27 #define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \
28 _EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \
29 /* note that this is not a direct cast */ \
30 _EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \
31 _EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \
32 _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \
33 _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj)
34
35
36 typedef _EGLDriver *(*_EGLMain_t)(const char *args);
37
38
39 /**
40 * Base class for device drivers.
41 */
42 struct _egl_driver
43 {
44 const char *Name; /**< name of this driver */
45
46 /**
47 * Probe a display and return a score.
48 *
49 * Roughly,
50 * 50 means the driver supports the display;
51 * 90 means the driver can accelerate the display;
52 * 100 means a perfect match.
53 */
54 EGLint (*Probe)(_EGLDriver *drv, _EGLDisplay *dpy);
55
56 /**
57 * Release the driver resource.
58 *
59 * It is called before dlclose().
60 */
61 void (*Unload)(_EGLDriver *drv);
62
63 _EGLAPI API; /**< EGL API dispatch table */
64 };
65
66
67 PUBLIC _EGLDriver *
68 _eglMain(const char *args);
69
70
71 extern _EGLDriver *
72 _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean probe_only);
73
74
75 extern __eglMustCastToProperFunctionPointerType
76 _eglGetDriverProc(const char *procname);
77
78
79 extern void
80 _eglUnloadDrivers(void);
81
82
83 PUBLIC void
84 _eglInitDriverFallbacks(_EGLDriver *drv);
85
86
87 PUBLIC void
88 _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
89 void *callback_data);
90
91
92 #endif /* EGLDRIVER_INCLUDED */