Merge branch 'draw-instanced'
[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 #include <stddef.h>
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 * Release the driver resource.
48 *
49 * It is called before dlclose().
50 */
51 void (*Unload)(_EGLDriver *drv);
52
53 _EGLAPI API; /**< EGL API dispatch table */
54 };
55
56
57 extern _EGLDriver *
58 _eglBuiltInDriverGALLIUM(const char *args);
59
60
61 extern _EGLDriver *
62 _eglBuiltInDriverDRI2(const char *args);
63
64
65 extern _EGLDriver *
66 _eglBuiltInDriverGLX(const char *args);
67
68
69 PUBLIC _EGLDriver *
70 _eglMain(const char *args);
71
72
73 extern _EGLDriver *
74 _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only);
75
76
77 extern __eglMustCastToProperFunctionPointerType
78 _eglGetDriverProc(const char *procname);
79
80
81 extern void
82 _eglUnloadDrivers(void);
83
84
85 /* defined in eglfallbacks.c */
86 PUBLIC void
87 _eglInitDriverFallbacks(_EGLDriver *drv);
88
89
90 PUBLIC void
91 _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
92 void *callback_data);
93
94
95 #endif /* EGLDRIVER_INCLUDED */