README.txt revision 848b8605
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
19848b8605SmrgWhen the apps calls eglOpenDisplay() a device driver is selected and loaded
20848b8605Smrg(look for dlsym() or LoadLibrary() in egldriver.c).
21848b8605Smrg
22848b8605SmrgThe driver's _eglMain() function is then called.  This driver function
23848b8605Smrgallocates, initializes and returns a new _EGLDriver object (usually a
24848b8605Smrgsubclass of that type).
25848b8605Smrg
26848b8605SmrgAs part of initialization, the dispatch table in _EGLDriver->API must be
27848b8605Smrgpopulated with all the EGL entrypoints.  Typically, _eglInitDriverFallbacks()
28848b8605Smrgcan be used to plug in default/fallback functions.  Some functions like
29848b8605Smrgdriver->API.Initialize and driver->API.Terminate _must_ be implemented
30848b8605Smrgwith driver-specific code (no default/fallback function is possible).
31848b8605Smrg
32848b8605Smrg
33848b8605SmrgA bit later, the app will call eglInitialize().  This will get routed
34848b8605Smrgto the driver->API.Initialize() function.  Any additional driver
35848b8605Smrginitialization that wasn't done in _eglMain() should be done at this
36848b8605Smrgpoint.  Typically, this will involve setting up visual configs, etc.
37848b8605Smrg
38848b8605Smrg
39848b8605Smrg
40848b8605SmrgSpecial Functions:
41848b8605Smrg
42848b8605SmrgCertain EGL functions _must_ be implemented by the driver.  This includes:
43848b8605Smrg
44848b8605SmrgeglCreateContext
45848b8605SmrgeglCreateWindowSurface
46848b8605SmrgeglCreatePixmapSurface
47848b8605SmrgeglCreatePBufferSurface
48848b8605SmrgeglMakeCurrent
49848b8605SmrgeglSwapBuffers
50848b8605Smrg
51848b8605SmrgMost of the EGLConfig-related functions can be implemented with the
52848b8605Smrgdefaults/fallbacks.  Same thing for the eglGet/Query functions.
53848b8605Smrg
54848b8605Smrg
55848b8605Smrg
56848b8605Smrg
57848b8605SmrgTeardown:
58848b8605Smrg
59848b8605SmrgWhen eglTerminate() is called, the driver->API.Terminate() function is
60848b8605Smrgcalled.  The driver should clean up after itself.  eglTerminate() will
61848b8605Smrgthen close/unload the driver (shared library).
62848b8605Smrg
63848b8605Smrg
64848b8605Smrg
65848b8605Smrg
66848b8605SmrgSubclassing:
67848b8605Smrg
68848b8605SmrgThe internal libEGL data structures such as _EGLDisplay, _EGLContext,
69848b8605Smrg_EGLSurface, etc should be considered base classes from which drivers
70848b8605Smrgwill derive subclasses.
71848b8605Smrg
72