1
2
3Notes about the EGL library:
4
5
6The EGL code here basically consists of two things:
7
81. An EGL API dispatcher.  This directly routes all the eglFooBar() API
9   calls into driver-specific functions.
10
112. Fallbacks for EGL API functions.  A driver _could_ implement all the
12   EGL API calls from scratch.  But in many cases, the fallbacks provided
13   in libEGL (such as eglChooseConfig()) will do the job.
14
15
16
17Bootstrapping:
18
19When the apps calls eglInitialize() a device driver is selected and loaded
20(look for _eglAddDrivers() and _eglLoadModule() in egldriver.c).
21
22The built-in driver's entry point function is then called and given
23a freshly allocated and initialised _EGLDriver, with default fallback
24entrypoints set.
25
26As part of initialization, the dispatch table in _EGLDriver->API must be
27populated with all the EGL entrypoints. Some functions like
28driver->API.Initialize and driver->API.Terminate _must_ be implemented
29with driver-specific code (no default/fallback function is possible).
30
31
32Shortly after, the driver->API.Initialize() function is executed.  Any additional
33driver initialization that wasn't done in the driver entry point should be
34done at this point.  Typically, this will involve setting up visual configs, etc.
35
36
37
38Special Functions:
39
40Certain EGL functions _must_ be implemented by the driver.  This includes:
41
42eglCreateContext
43eglCreateWindowSurface
44eglCreatePixmapSurface
45eglCreatePBufferSurface
46eglMakeCurrent
47eglSwapBuffers
48
49Most of the EGLConfig-related functions can be implemented with the
50defaults/fallbacks.  Same thing for the eglGet/Query functions.
51
52
53
54
55Teardown:
56
57When eglTerminate() is called, the driver->API.Terminate() function is
58called.  The driver should clean up after itself.  eglTerminate() will
59then close/unload the driver (shared library).
60
61
62
63
64Subclassing:
65
66The internal libEGL data structures such as _EGLDisplay, _EGLContext,
67_EGLSurface, etc should be considered base classes from which drivers
68will derive subclasses.
69
70