Commit Graph

76 Commits

Author SHA1 Message Date
Kristian Høgsberg f274dfaca4 egl: Use the right extension name in #ifdef 2011-04-25 15:34:04 -04:00
Benjamin Franzke 6b369c4c7c egl: Add EGL_WL_bind_wayland_display 2011-03-01 17:23:50 -05:00
Chia-I Wu a4a38dcf61 egl: Cleanup _EGLDisplay initialization.
Reorder/rename and document the fields that should be set by the driver during
initialization.  Drop the major/minor arguments from drv->API.Initialize.
2011-01-13 17:57:38 +08:00
Chia-I Wu d19afc57fe egl: Use reference counting to replace IsLinked or IsBound.
Remove all _egl<Res>IsLinked and _egl<Res>IsBound.  Update
_eglBindContext and drivers to do reference counting.
2010-10-23 15:26:28 +08:00
Chia-I Wu 4ce33ec606 egl: Drop dpy argument from the link functions.
All display resources are already initialized with a display.  Linking
simply links a resource to its display.
2010-10-23 11:20:40 +08:00
Chia-I Wu 6b2f1561ad egl: Check extensions.
Do not call into the driver if the extension for the called function is
not enabled.
2010-09-30 16:55:07 +08:00
Chia-I Wu 916c8ed2c8 egl: Use _EGL_CHECK_DISPLAY in eglCreateContext.
_EGL_CHECK_DISPLAY checks the display and returns from eglCreateContext
on error.
2010-09-10 00:18:23 +08:00
Kristian Høgsberg b7a8893a24 egl: Add EGL_MESA_drm_image extension
Create EGLImages from DRM buffer handles.
2010-08-25 09:17:47 -04:00
Chia-I Wu f508c0c097 egl: Allow core functions to be queried.
When _EGL_GET_CORE_ADDRESSES is defined, eglGetProcAddress can be used to query
core functions.  This is non-standard, but some apps expect it.
2010-08-20 19:22:35 +08:00
Chia-I Wu 4eebea74a8 egl: Add support for EGL_KHR_reusable_sync.
Individual drivers still need to support and enable the extension.
2010-08-17 00:06:19 +08:00
Kristian Høgsberg b90a3e7d8b egl: EGL_KHR_surfaceless_* extensions
These extensions allow an application to make a context current by
passing EGL_NO_SURFACE for the write and read surface in the call to
eglMakeCurrent.  The motivation is that applications that only want to
render to client API targets (such as OpenGL framebuffer objects)
should not need to create a throw-away EGL surface just to get a
current context.
2010-07-28 23:07:00 -04:00
Vinson Lee ff318c45ec egl: Remove unnecessary headers. 2010-07-06 16:02:49 -07:00
Chia-I Wu f2aa361f3b egl: Rework driver loading.
Driver loading is now splitted into two stages.  In the first stage, an
_EGLModule is created for each driver: user driver, default drivers, and
all files in the search directories that start with "egl_".  Modules are
not loaded at this stage.

In the second stage, each module is loaded to initialize a display.  The
process stops at the first module that can initialize the display.

If eglGetProcAddress is called before eglInitialize, the same code path
will be taken to find the first module that supports
EGL_DEFAULT_DISPLAY.  Because we do not want to initialize the display,
drv->Probe is used instead in this case.
2010-07-06 16:16:39 +08:00
nobled c43ab4fe1f egl: Always use EGLAPIENTRY in api function prototypes
Fixes the build on Windows.
2010-07-03 16:36:43 +08:00
Chia-I Wu 78d70ddbbd egl: Add support for EGL_MESA_drm_display.
The extension defines eglGetDRMDisplay that creates an EGLDisplay from a
DRM fd.  Calling eglCreateWindowSurace or eglCreatePixmapSurface with
such displays will generate EGL_BAD_NATIVE_WINDOW or
EGL_BAD_NATIVE_PIXMAP.
2010-06-23 15:14:59 +08:00
Chia-I Wu f22665df95 egl: Introduce platform displays internally.
This commit introduces type-safe platform displays internally.  A
platform display consists of a generic pointer and an enum that
specifies the platform.

An EGLDisplay is created from a platform display.  Native displays
become platform displays whose platform is determined by
_eglGetNativePlatform().  Platform windows and pixmaps may also be
introduced if needed.
2010-06-23 15:14:59 +08:00
Chia-I Wu 1e6c10f4be egl: Use SConscript for Windows build.
Fix several portability issues and add SConscript for Windows build.
2010-05-31 13:27:41 +08:00
Vinson Lee 12297f1f98 egl: Silence uninitialized variable warnings. 2010-05-14 08:59:42 -07:00
Kristian Høgsberg 52c554a79d egl: Implement EGL_NOK_swap_region
This extension adds a new function which provides an alternative to
eglSwapBuffers. eglSwapBuffersRegionNOK accepts two new parameters in
addition to those in eglSwapBuffers. The new parameters consist of a
pointer to a list of 4-integer blocks defining rectangles (x, y,
width, height) and an integer specifying the number of rectangles in
the list.
2010-05-13 20:30:45 -04:00
Kristian Høgsberg 681fd73f1e egl: Allow a prioritized list of default drivers
When there is no user driver or any matching display drivers we fall
back to the default driver.  This patch lets us have a list of default
drivers instead of just one.  The drivers are loaded in turn and we
attempt to initialize the display.  If it fails we unload the driver
and move on to the next one.

Compared to the display driver mechanism, this avoids loading a number
of drivers and then only using one.  Also, we call Initialize to see
if the driver will work instead of relying on Probe.  To know for sure
that a driver will work, Probe really have to do a full Initialize, so
we will just use Initialize directly.
2010-05-13 16:14:07 -04:00
Chia-I Wu bef4b476d7 egl: Silence warnings in check/return macros.
The macros give warnings when compiled with -pedantic.  This commit is
based on a patch by Brian Paul, with minor changes to add do {} while(0)
and rename the check macros.
2010-02-19 12:34:18 +08:00
Chia-I Wu 655f465467 egl: Always lock a display before using it.
This gives a simple access control to the display.  It is potentially
slow, but a finer grained mutex can always be used in the future.  The
benefit of this simple approach is that drivers need not to worry about
thread-safety.
2010-02-17 20:00:12 +08:00
Chia-I Wu db5ce8b384 egl: Make eglGetDisplay atomic.
Merge _eglNewDisplay and _eglLinkDisplay into _eglFindDisplay.  Remove
unused _eglUnlinkDisplay.
2010-02-17 20:00:12 +08:00
Chia-I Wu b3bb180620 egl: eglGetError should return the status of the last call.
Use macros to record the status of the function call before returning.
This is the only way that eglGetError can return the status of the most
recent function call.
2010-02-17 20:00:11 +08:00
Chia-I Wu aed7358e54 egl: Use new error checking macros.
Replace all uses of _EGL_DECLARE_* and _eglCheck* by _EGL_CHECK_*.
2010-02-17 20:00:11 +08:00
Chia-I Wu f3e03e1277 egl: Add new error checking macros.
Add _EGL_CHECK_* which will replace _EGL_DECLARE_* for error checking.
Move _eglCheck* earlier in the file so that the macros and the functions
are grouped together.
2010-02-17 20:00:10 +08:00
Chia-I Wu 94cb321b5d egl: Clean up header inclusions.
Mainly to remove eglcurrent.h and egldisplay.h from eglglobals.h.
2010-01-30 22:55:49 +08:00
Chia-I Wu 45ba533243 egl: Correctly unbind contexts in eglReleaseThread.
MakeCurrent unbinds the current context of the current API.  Modify the
current API to make sure all contexts are correctly unbound.
2010-01-28 17:28:48 +08:00
Chia-I Wu 17330479b3 egl: eglMakeCurrent should accept an uninitialized display.
When no context or surface are given, the display is allowed to be
uninitialized.  Most drivers cannot handle an uninitialized display.
But they are updated to at least throw a fatal message.
2010-01-28 17:28:47 +08:00
Chia-I Wu a933259daa egl: Use a boolean to indicate whether a display is initialized.
The driver pointer of the display was used to decide whether a display
is initialized.  Use a boolean for that purpose allows accessing the
driver of an uninitialized display.
2010-01-28 17:28:47 +08:00
Chia-I Wu 092b1ca989 egl: Remove _eglOpenDriver and _eglCloseDriver.
_eglCloseDriver is no-op and _eglOpenDriver does nothing but call
_eglMatchDriver.  Export _eglMatchDriver directly.
2010-01-26 18:46:06 +08:00
Chia-I Wu a1717970e7 egl: Remove _eglGetCurrentSurface and _eglGetCurrentDisplay.
They have little use in drivers since drivers need to work for multiple
current contexts.
2010-01-26 18:46:05 +08:00
Chia-I Wu 11cf3cb2c4 egl: Fix leaks in eglReleaseThread.
There may be multiple bound contexts that should be unbound.
2010-01-26 18:46:05 +08:00
Chia-I Wu 4aed0944f4 egl: Native types are renamed in EGL 1.3.
Rename Native*Type to EGLNative*Type.
2010-01-25 11:59:12 +08:00
Chia-I Wu a1c4a8a3c8 egl: Add support for EGL_KHR_image.
Individual drivers still need to implement the API hooks.
2010-01-25 11:28:27 +08:00
Chia-I Wu 95f8f75ad8 egl: Update headers.
Update to the current versions found at
http://www.khronos.org/registry/egl/.  There is one modification in
khrplatform.h for GCC visibility.
2010-01-25 11:28:27 +08:00
Chia-I Wu ecb3b3102a egl: Make surfaces and contexts resources.
Turn _EGLSurface and _EGLContext into _EGLResource so that they can be
managed uniformly.
2010-01-24 20:38:16 +08:00
Chia-I Wu 57929eda3e egl: Use _eglPreloadDrivers.
Replace the use of _eglPreloadDriver by _eglPreloadDrivers.  The latter
supports EGL_DISPLAY which have a better chance to "just work".
2010-01-20 17:40:07 +08:00
Chia-I Wu 3e6139d158 egl: Add _EGLDriver as the first argument to GetProcAddress.
The rest of the driver API has it as the first argument.  It should be
there so that a driver has access to itself.
2010-01-12 17:53:57 +08:00
Chia-I Wu 6c21c8862b egl: Rework the synchronization primitives.
This adds error checking to the synchronization primitives.  And
eglWaitGL is now implemented by eglWaitClient.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:54:00 -06:00
Chia-I Wu 57da499d7b egl: Rework eglSwapInterval.
This adds error checking to eglSwapInterval and clamps the swap
interval.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:54:00 -06:00
Chia-I Wu bbfd0e2615 egl: Rework error checking in eglSwapBuffers.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:58 -06:00
Chia-I Wu aaa1253b09 egl: Update comments about eglapi.c.
Mention that opaque handles are looked up and checked.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:57 -06:00
Chia-I Wu 6190663120 egl: Rework error checking in eglGetCurrentSurface.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:57 -06:00
Chia-I Wu 310c76812e egl: Allow binding to any client API.
As a result, EGL_NONE is no longer a valid client API.  And it is
possible that no config supports the current bound API.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-13 12:00:36 -06:00
Chia-I Wu e787ffcd02 egl: Preload a driver if eglGetProcAddress is called early.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-13 12:00:36 -06:00
Chia-I Wu 9061d733d3 egl: Remove core functions from eglGetProcAddress.
eglGetProcAddress may not be used to query core (non-extension)
functions.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-13 12:00:36 -06:00
Chia-I Wu ccc2b0bc65 egl: _eglCloseDriver should be no-op.
Move drv->API.Terminate call to eglTerminate.  Remove
_eglReleaseDisplayResource as drivers are doing it.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:22 -06:00
Chia-I Wu 5a2c9372a0 egl: Some per-driver data should be per-display.
Move some fields of _EGLDriver to _EGLDisplay.  It also becomes
unnecessary to pass _EGLDisplay to drivers when _eglMain is called.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:49:09 -06:00
Chia-I Wu 0eaa02c836 egl: Change the way drivers are loaded.
Driver is chosen and preloaded when eglGetDisplay is called.  Later when
eglInitialize is called, the same driver is matched to initialize the
display.  Also, add new, but unused, hooks to EGLDriver to allow a
driver to probe a display or unload itself.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:44:44 -06:00