mesa/src/egl/main
Emil Velikov b3ade65387 egl/glvnd: correctly report errors when vendor cannot be found
If the user provides an invalid display or device the ToVendor lookup
will fail.

In this case, the local [Mesa vendor] error code will be set. Thus on
sequential eglGetError(), the error will be EGL_SUCCESS.

To be more specific, GLVND remembers the last vendor and calls back
into it's eglGetError, although there's no guarantee to ever have had
one.

v2:
 - Add _eglError call, so the debug callback is executed (Kyle)
 - Drop XXX comment.

Piglit: tests/egl/spec/egl_ext_device_query
Fixes: ce562f9e3f ("EGL: Implement the libglvnd interface for EGL (v3)")
Cc: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Kyle Brenneman <kbrenneman@nvidia.com>
2018-11-05 20:53:05 +00:00
..
50_mesa.json EGL: Implement the libglvnd interface for EGL (v3) 2017-04-17 13:03:58 +01:00
egl.def
egl.pc.in egl/main: Convert to automake. 2012-02-29 11:52:40 -08:00
eglapi.c egl: add base EGL_EXT_device_base implementation 2018-11-01 00:05:43 +00:00
eglapi.h egl: add support for EGL_ANDROID_blob_cache 2018-02-07 14:45:34 +02:00
eglarray.c egl: _eglFilterArray's filter is always non-null 2017-02-16 15:27:20 +00:00
eglarray.h egl: Add needed extern "C" for C++ access 2015-05-14 14:08:37 -04:00
eglconfig.c egl: add messages to a few assert() and turn a couple into unreachable() 2018-10-30 18:10:59 +00:00
eglconfig.h egl: EXT_pixel_format_float plumbing 2017-11-13 12:40:26 +02:00
eglcontext.c egl: Simplify queries for EGL_RENDER_BUFFER 2018-08-07 11:11:05 -07:00
eglcontext.h egl: Simplify queries for EGL_RENDER_BUFFER 2018-08-07 11:11:05 -07:00
eglcurrent.c egl: remove unneeded braces around since line if statements 2017-09-19 19:08:34 +01:00
eglcurrent.h egl: simplify _eglDebugReport* API 2017-09-19 19:07:16 +01:00
egldefines.h egl: use util/macros.h 2016-11-04 11:30:47 +01:00
egldevice.c egl: add EGL_EXT_device_drm support 2018-11-01 00:05:43 +00:00
egldevice.h egl: add EGL_EXT_device_drm support 2018-11-01 00:05:43 +00:00
egldispatchstubs.c egl/glvnd: correctly report errors when vendor cannot be found 2018-11-05 20:53:05 +00:00
egldispatchstubs.h EGL: Implement the libglvnd interface for EGL (v3) 2017-04-17 13:03:58 +01:00
egldisplay.c egl/main: fix indentation 2018-08-02 12:54:05 +01:00
egldisplay.h egl: add base EGL_EXT_device_base implementation 2018-11-01 00:05:43 +00:00
egldriver.c egl: drop EGL driver name 2018-10-31 11:01:54 +00:00
egldriver.h egl: drop EGL driver name 2018-10-31 11:01:54 +00:00
eglentrypoint.h egl: Fix eglentrypoint.h sort order. 2018-11-01 10:56:21 +01:00
eglfallbacks.c egl: drop memset(0) of calloc'ed memory 2017-10-12 14:40:12 +01:00
eglglobals.c egl: enable EGL_EXT_device_{base,enumeration,query} 2018-11-01 00:05:43 +00:00
eglglobals.h egl: add base EGL_EXT_device_base implementation 2018-11-01 00:05:43 +00:00
eglglvnd.c EGL: Implement the libglvnd interface for EGL (v3) 2017-04-17 13:03:58 +01:00
eglimage.c egl: fix whitespace issues from eglimage code 2017-07-25 12:54:33 +03:00
eglimage.h egl: call _eglError within _eglParseImageAttribList 2017-07-12 15:42:51 +01:00
egllog.c android: change include "cutils/log.h" to "log/log.h" on Android API >=26 2018-05-14 08:08:31 +03:00
egllog.h egl: remove no longer needed logger infra 2017-05-08 15:33:54 +01:00
eglsurface.c egl: implement EXT_surface_SMPTE2086_metadata and EXT_surface_CTA861_3_metadata 2018-08-20 09:44:53 +03:00
eglsurface.h egl: implement EXT_surface_SMPTE2086_metadata and EXT_surface_CTA861_3_metadata 2018-08-20 09:44:53 +03:00
eglsync.c egl: add EGL_ANDROID_native_fence_sync 2016-12-01 10:57:35 -08:00
eglsync.h egl: add EGL_ANDROID_native_fence_sync 2016-12-01 10:57:35 -08:00
egltypedefs.h egl: add base EGL_EXT_device_base implementation 2018-11-01 00:05:43 +00:00
README.txt egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku} 2018-10-31 11:01:54 +00:00


Notes about the EGL library:


The EGL code here basically consists of two things:

1. An EGL API dispatcher.  This directly routes all the eglFooBar() API
   calls into driver-specific functions.

2. Fallbacks for EGL API functions.  A driver _could_ implement all the
   EGL API calls from scratch.  But in many cases, the fallbacks provided
   in libEGL (such as eglChooseConfig()) will do the job.



Bootstrapping:

When the apps calls eglInitialize() a device driver is selected and loaded
(look for _eglAddDrivers() and _eglLoadModule() in egldriver.c).

The built-in driver's entry point function is then called and given
a freshly allocated and initialised _EGLDriver, with default fallback
entrypoints set.

As part of initialization, the dispatch table in _EGLDriver->API must be
populated with all the EGL entrypoints. Some functions like
driver->API.Initialize and driver->API.Terminate _must_ be implemented
with driver-specific code (no default/fallback function is possible).


Shortly after, the driver->API.Initialize() function is executed.  Any additional
driver initialization that wasn't done in the driver entry point should be
done at this point.  Typically, this will involve setting up visual configs, etc.



Special Functions:

Certain EGL functions _must_ be implemented by the driver.  This includes:

eglCreateContext
eglCreateWindowSurface
eglCreatePixmapSurface
eglCreatePBufferSurface
eglMakeCurrent
eglSwapBuffers

Most of the EGLConfig-related functions can be implemented with the
defaults/fallbacks.  Same thing for the eglGet/Query functions.




Teardown:

When eglTerminate() is called, the driver->API.Terminate() function is
called.  The driver should clean up after itself.  eglTerminate() will
then close/unload the driver (shared library).




Subclassing:

The internal libEGL data structures such as _EGLDisplay, _EGLContext,
_EGLSurface, etc should be considered base classes from which drivers
will derive subclasses.