1848b8605Smrg
2848b8605Smrg
3848b8605SmrgNotes about the EGL library:
4848b8605Smrg
5848b8605Smrg
6848b8605SmrgThe EGL code here basically consists of two things:
7848b8605Smrg
8848b8605Smrg1. An EGL API dispatcher.  This directly routes all the eglFooBar() API
9848b8605Smrg   calls into driver-specific functions.
10848b8605Smrg
11848b8605Smrg2. Fallbacks for EGL API functions.  A driver _could_ implement all the
12848b8605Smrg   EGL API calls from scratch.  But in many cases, the fallbacks provided
13848b8605Smrg   in libEGL (such as eglChooseConfig()) will do the job.
14848b8605Smrg
15848b8605Smrg
16848b8605Smrg
17848b8605SmrgBootstrapping:
18848b8605Smrg
19b8e80941SmrgWhen the apps calls eglInitialize() a device driver is selected and loaded
20b8e80941Smrg(look for _eglAddDrivers() and _eglLoadModule() in egldriver.c).
21848b8605Smrg
22b8e80941SmrgThe built-in driver's entry point function is then called and given
23b8e80941Smrga freshly allocated and initialised _EGLDriver, with default fallback
24b8e80941Smrgentrypoints set.
25848b8605Smrg
26848b8605SmrgAs part of initialization, the dispatch table in _EGLDriver->API must be
27b8e80941Smrgpopulated with all the EGL entrypoints. Some functions like
28848b8605Smrgdriver->API.Initialize and driver->API.Terminate _must_ be implemented
29848b8605Smrgwith driver-specific code (no default/fallback function is possible).
30848b8605Smrg
31848b8605Smrg
32b8e80941SmrgShortly after, the driver->API.Initialize() function is executed.  Any additional
33b8e80941Smrgdriver initialization that wasn't done in the driver entry point should be
34b8e80941Smrgdone at this point.  Typically, this will involve setting up visual configs, etc.
35848b8605Smrg
36848b8605Smrg
37848b8605Smrg
38848b8605SmrgSpecial Functions:
39848b8605Smrg
40848b8605SmrgCertain EGL functions _must_ be implemented by the driver.  This includes:
41848b8605Smrg
42848b8605SmrgeglCreateContext
43848b8605SmrgeglCreateWindowSurface
44848b8605SmrgeglCreatePixmapSurface
45848b8605SmrgeglCreatePBufferSurface
46848b8605SmrgeglMakeCurrent
47848b8605SmrgeglSwapBuffers
48848b8605Smrg
49848b8605SmrgMost of the EGLConfig-related functions can be implemented with the
50848b8605Smrgdefaults/fallbacks.  Same thing for the eglGet/Query functions.
51848b8605Smrg
52848b8605Smrg
53848b8605Smrg
54848b8605Smrg
55848b8605SmrgTeardown:
56848b8605Smrg
57848b8605SmrgWhen eglTerminate() is called, the driver->API.Terminate() function is
58848b8605Smrgcalled.  The driver should clean up after itself.  eglTerminate() will
59848b8605Smrgthen close/unload the driver (shared library).
60848b8605Smrg
61848b8605Smrg
62848b8605Smrg
63848b8605Smrg
64848b8605SmrgSubclassing:
65848b8605Smrg
66848b8605SmrgThe internal libEGL data structures such as _EGLDisplay, _EGLContext,
67848b8605Smrg_EGLSurface, etc should be considered base classes from which drivers
68848b8605Smrgwill derive subclasses.
69848b8605Smrg
70