Commit Graph

306 Commits

Author SHA1 Message Date
Kristian Høgsberg 021a68b7e8 egl: Drop broken _EGL_PLATFORM_NO_OS code
It would do strlen(library_suffix()) in _eglLoaderFile(), with
library_suffix() returning NULL.  So obviuosly not used or tested.
2010-05-13 08:59:56 -04:00
Kristian Høgsberg 41797e1659 egl: Don't try to load driver basename if the platform needs a suffix
That is, don't dlopen(egl_glx) when we know we need to append .so.
2010-05-13 08:28:45 -04:00
Chia-I Wu e8ba2812e6 egl: Add _eglSearchPathForEach.
The function can be used by a driver to check each search path of EGL.
2010-05-08 14:54:13 +08:00
Kristian Høgsberg ceffd7b924 Add egl.pc file 2010-05-04 14:13:46 -04:00
Dan Nicholson 02224ec4e0 Merge branch '7.8'
Conflicts:
	progs/egl/Makefile

progs/egl/Makefile is gone on master with the egl demos split into
subdirectories. Will require an additional commit.
2010-04-19 20:22:48 -07:00
Dan Nicholson 88be2171e7 egl: Pass flags to locate Xlib headers and libraries
eglplatform.h pulls in Xlib.h on X11 platforms. Likewise, the egl glx
driver and egl programs needs to link to libX11. Make sure we use the
locations the user told us about.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
2010-04-19 20:21:57 -07:00
Chia-I Wu 848945e5d6 egl: Unbind the old context in _eglBindContext.
The last commit incorrectly moved the code under an "else".
2010-04-06 11:55:40 +08:00
Chia-I Wu bbe459b14d egl: Fix eglMakeCurrent with different surfaces.
0a82fadcdd seems to trigger a bug in
_eglBindContext.  Rework the logics yet again.  It is simpler, and
hopefully correct this time.
2010-04-06 11:37:58 +08:00
Chia-I Wu 0a82fadcdd egl: Make _eglBindContextToSurfaces more readable.
There is no effective changes given how the function is called.  It is
still not trivial, but it should be more readable and resemble
_eglBindContextToThread a lot.
2010-03-28 03:37:28 +08:00
Chia-I Wu 551bfe7a09 egl: Always return the previously bound context.
When a newly bound context is the same as the previously bound one,
_eglBindContextToThread should still return the context instead of NULL.
This gives the driver a chance to flush the context.
2010-03-28 03:37:28 +08:00
Ian Romanick 016fc30839 Remove support for GCC older than 3.3.0
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-03 16:26:32 -08:00
Chia-I Wu 7d1237bc71 egl: Remove unused _EGL_SKIP_HANDLE_CHECK.
It was added to skip checking EGLDisplay, EGLSurface, and etc.  It is
never defined and the spec does not allow the checks to be skipped.
Remove it for good.
2010-02-23 22:42:46 +08:00
Chia-I Wu 496724b869 egl: Silence warnings when compiled with -pedantic.
Just follow gcc's advices here.
2010-02-19 12:40:01 +08: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 4afe24808e egl: Revisit global data locking.
Lock the global mutex in _eglPreloadDrivers and _eglAllocScreenHandle.
Add comments to why certain pathes do not need locking.
2010-02-17 20:00:12 +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 99bcb1f06d egl: Add a mutex to _EGLDisplay.
A display may be shared by multiple threads.  Add a mutex for access
control.
2010-02-17 20:00:11 +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 3dee01a692 egl: Always record error code.
The error code denotes the success or failure of the most recent
function call.  A call to _eglError should always update the error code.
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 4f47684f75 egl: Add debug messages to config validation and matching.
It might be desirable find out which attribute went wrong.
2010-02-05 14:19:54 +08:00
Chia-I Wu a37dc17c12 egl: Clean up eglconfig.h.
Update the comments to macros/functions.  Remove unused
_eglSetConfigAttrib.
2010-02-05 13:42:02 +08:00
Chia-I Wu cb260e1d18 egl: Update the comments to typecast macros.
Put a note that the macros define functions and should not be ended with
a semicolon when used.
2010-02-05 11:45:01 +08:00
Chia-I Wu b31255fbfd egl: Clarify IsLinked and IsBound.
Both a link and a binding creates a reference to the resource.  Drivers
should not destroy the resource when there is a reference.  The
difference is better described in doc/egl.html.
2010-02-05 11:45:01 +08:00
Chia-I Wu bdb9e202de egl: Add macros to define typecast functions.
There are standard typecast functions that are common to most drivers.
They are used to typecast, for example, an _EGLSurface to a
driver-defined type.

This commits define _EGL_DRIVER_STANDARD_TYPECASTS and
_EGL_DRIVER_TYPECAST that should hopefully save some typings for driver
writers.
2010-02-04 14:36:48 +08:00
Igor Oliveira 88af76ce94 egl: fix wrong argument. Use loader_data instead of loader 2010-02-04 10:09:37 +08:00
Chia-I Wu 0d089cbb48 egl: Rename _eglPreloadForEach callbacks.
Rename _eglPreloadFile to _eglLoaderFile, and _eglPreloadFile to
_eglLoaderFile.  There are several _eglPreload* functions.  The
callbacks do not belong to them and it should be better to give them a
different prefix.
2010-02-03 14:16:16 +08:00
Chia-I Wu 8e6a964411 egl: Fix a potential segfault in driver suffix matching.
The driver suffix might be NULL on some platforms.  Perform the matching
only when there is a suffix.
2010-02-03 14:16:16 +08:00
Chia-I Wu 2287f4c52a egl: Remove unnecessary #ifdef's.
There were some refactorings with the addition of EGL_DRIVERS_PATH.
They made some platform #ifdef's unnecessary.
2010-02-03 14:16:15 +08:00
Chia-I Wu 6fd8b6a9e2 egl: Ignore certain environment variables when setuid/setgid.
Specifically, ignore EGL_DRIVERS_PATH when an application is
setuid/setgid.  And ignore EGL_DRIVER when there is a slash in it.
2010-02-03 14:16:15 +08:00
Chia-I Wu 5d8646c41f egl: Add EGL_DRIVERS_PATH environment variable.
EGL_DRIVERS_PATH gives a list of colon-separated directories.  The given
directories will be searched when preloading drivers.

This is based on Mike Stroyan's patch, which honors the variable in
_eglPreloadDisplayDrivers.  It is extended to honor the variable also in
_eglPreloadUserDriver and _eglPreloadDefaultDriver in this version.
2010-02-03 14:16:15 +08:00
Vinson Lee 19af9ea792 egl: Remove unnecessary headers. 2010-01-31 21:56:53 -08:00
Chia-I Wu eb961f81d5 egl: Clean up surface attributes.
Add missing attributes and use correct types in _EGLSurface.  Remove
ifdef tests that serve no purpose.  Update _eglQuerySurface and
_eglSurfaceAttrib for missing queries and checks.
2010-01-31 22:21:26 +08:00
Chia-I Wu 0135e5d6c8 egl: Add support for more EGLImage extensions to EGL core.
Add support EGL_KHR_vg_parent_image and EGL_KHR_gl_*.  This is as simple
as adding some flags that can be enabled.  Individual drivers need to
implement the extensions before enbaling the flags.
2010-01-31 22:20:42 +08:00
Chia-I Wu bbdce27649 egl: Surface type validaction should depend on extensions supported.
EGL_SCREEN_BIT_MESA is a valid bit only when EGL_MESA_screen_surface is
supported.
2010-01-31 14:46:15 +08:00
Chia-I Wu 216925ccd1 egl: Initialize display configs with the display.
This changes _eglInitConfig to take the display as its argument.
2010-01-31 14:46:14 +08:00
Chia-I Wu d69242be55 egl: Initialize display resources with their display.
Change _eglInitSurface, _eglInitContext, and _eglInitImage to take an
_EGLDisplay instead of an _EGLDriver.  This is a more natural form, and
plus, the display encodes information such as the extensions supported
that might be required for attribute list parsing.
2010-01-31 14:46:14 +08:00
Chia-I Wu e694ccad80 egl: Refactor _eglInitImage.
Refactor attribute list parsing code to _eglParseImageAttribList.
2010-01-31 14:46:14 +08:00
Chia-I Wu caa5c8dfe8 egl: Refactor _eglInitContext.
Refactor attribute list parsing code to _eglParseContextAttribList.  Add
a check to make sure the config supports the client API.
2010-01-31 14:46:14 +08:00
Chia-I Wu 6f1529293f egl: Refactor _eglInitSurface.
Refactor attribute list parsing code to _eglParseSurfaceAttribList.
2010-01-31 14:46:13 +08:00
Chia-I Wu 996fd61442 egl: Remove code blocks that are commented out.
They are either unit tests or to demonstrate how functions are supposed
to be used.  The unit test is outdated and it should be better to take a
look at any of the working drivers to see how a function is used.
2010-01-31 11:31:58 +08:00
Chia-I Wu 2c3a23a96f egl: Remove my_strdup.
There is already _eglstrdup for the main library's use.
2010-01-30 23:02:45 +08:00
Chia-I Wu 6fc304456e egl: Remove unused VisibleRefCount. 2010-01-30 22:58:03 +08:00
Chia-I Wu 00e1790f32 egl: Rename Binding to CurrentContext in _EGLSurface.
A context can be bound to a surface just like it can be bound to a
thread.  CurrentContext is a more consistent name.
2010-01-30 22:57:18 +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
Vinson Lee fc4939bff9 egl: Remove unnecessary headers. 2010-01-28 15:39:11 -08:00
Chia-I Wu 6baa2c8d02 egl: Migrate drivers to use _eglBindContext.
_eglMakeCurrent is a big hammer that is not easy to use.  Migrate
drivers to use _eglBindContext and un-export _eglMakeCurrent.
2010-01-28 17:28:48 +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 959481ad70 egl: Add _eglBindContext.
It works similar to _eglMakeCurrent, except that the old context and
surfaces are returned instead of destroyed.  _eglMakeCurrent is now
calling the new _eglBindContext.
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 545eaf83b5 egl: Fix a segfault when a display is initialized again.
Reset dpy->MaxConfigs so that dpy->Configs is re-allocated.
2010-01-26 18:46:05 +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 7c09296d4c egl: Refactor _eglMakeCurrent.
Refactor _eglMakeCurrent into _eglCheckMakeCurrent,
_eglBindContextToSurface, and _eglBindContextToThread.
2010-01-26 18:46:05 +08:00
Chia-I Wu 6f6f3e4227 egl: Add _eglGetAPIContext.
It will return the currently bound context of the given API.
2010-01-26 18:46:05 +08:00
Chia-I Wu f65ed0a309 egl: Use a boolean to indicate whether a resource is linked.
An unlinked resource may still be a current resource such as current
surfaces.  There might still be a need to know which display the
unlinked resource belongs to.
2010-01-26 18:46:05 +08:00
Chia-I Wu d21ee93fdb egl: Mark _eglCheckResource as PUBLIC.
To support extensions such as GL_OES_EGL_image, the drivers need a way
to check if a given EGLImageKHR is valid.
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 dbb866ab33 egl: Make resource void pointer in _eglCheckResource.
This emphasizes the fact that the resource to be checked could really be
invalid and have an unknown type.
2010-01-25 11:44:13 +08:00
Chia-I Wu 3f932a4440 egl: Install EGL headers.
Install EGL (and KHR) headers along with the library.
2010-01-25 11:34:59 +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 21b2c0a6e5 egl: Add and use make_library_path.
Add a platform specific function to turn a library name to a library
path.  It is used to convert EGL_DRIVER or the default driver to a
library path that can be loaded.
2010-01-24 21:27:52 +08:00
Chia-I Wu cecc33cd4f egl: Remove _eglFindAPIs.
This function is not used and should have been removed by last commit.
My mistake.
2010-01-24 20:55:17 +08:00
Chia-I Wu cf7c1ea4f1 egl: Remove unused helper functions.
_eglFillInConfigs and _eglFindAPIs have no user in Mesa and are unlikely
to find one soon.  It should be fine to remove them.
2010-01-24 20:52:30 +08:00
Chia-I Wu 56b93a25ea egl: Remove unused casting functions.
_eglUIntToPointer and _eglPointerToUInt are no longer used.
2010-01-24 20:38:16 +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 7abf42626f egl: Add _EGLResource and _EGLResourceType.
Resources are objects managed by a display.  They can be linked to or
unlinked from a display.  It is also possible to check if a resource is
valid.
2010-01-24 20:38:15 +08:00
Chia-I Wu b4d2c97a2d egl: Move surface functions in egldisplay.[ch] to eglsurface.[ch]
Move functions to where they should be.  There should be no real change
here.
2010-01-24 20:38:15 +08:00
Chia-I Wu 5e66d18932 egl: Move context functions in egldisplay.[ch] to eglcontext.[ch].
Move functions to where they should be.  There should be no real change
here.
2010-01-24 20:38:15 +08:00
Chia-I Wu 28c3e57c83 egl: Install drivers to ${libdir}/egl.
Install EGL drivers to EGL_DRIVER_INSTALL_DIR, which is default to
${libdir}/egl.
2010-01-23 20:30:11 +08:00
Chia-I Wu 3b0ffd5a36 egl: Remove egl_softpipe.
With the addition egl_x11_swrast, egl_softpipe is sort of deprecated.
The new driver serves the same purpose as egl_softpipe does.  It is
based on egl_g3d and provides more features.
2010-01-22 16:44:13 +08:00
Alan Coopersmith 506e27b972 Copy __FUNCTION__ portability #defines from mesa/compiler.h to eglcompiler.h
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-20 23:18:07 +08:00
Chia-I Wu c5766c4ae3 egl: Add a simple cache for driver probe.
In current design, multiple drivers will probe the same display and the
best driver is determined.  The cache can be used by the drivers to
store and share the probed data.
2010-01-20 17:44:12 +08:00
Chia-I Wu cf22fd5e5b egl: Improve driver matching.
Make drv->Probe return a score so that the matching can be done by
finding the driver with the highest score.
2010-01-20 17:44:11 +08:00
Chia-I Wu 925f8113be egl: Rename _EGL_PLATFORM_X to _EGL_PLATFORM_POSIX.
The macro is used to determine if dlfcn.h or dirent.h is available.
POSIX is a better name than X in such case.
2010-01-20 17:44:11 +08:00
Chia-I Wu f0c2871bf4 egl: Remove unused driver and display functions.
Remove _eglPreloadDriver, _eglLookupDriver, and _eglSplitDisplayString.
2010-01-20 17:40:07 +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 b3bcd33f7a egl: Add _eglPreloadDrivers.
It can be used to load the user driver specified by EGL_DRIVER, or a set
of drivers specified by EGL_DISPLAY, or the default driver, and in that
order.
2010-01-20 17:40:00 +08:00
Alan Coopersmith a7aaf052f9 Sun compilers now support some gcc __attribute__ values
Sun cc 5.9 and later (__SUNPRO_C >= 0x590) support __attribute__ calls
for aligned, always_inline, noinline, pure, const, and malloc.

This commit includes updates to files that were regenerated by gl_XML.py
after adding the __SUNPRO_C checks to it

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-19 10:15:55 -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 39790cab13 egl: EGL_SCREEN_BIT_MESA is a valid bit.
Update _eglValidateConfig so that it passes the test.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2010-01-12 10:55:35 +08:00
Chia-I Wu d4c1ee0534 egl: Clean up the Makefile rules.
This allows libEGL to be built as a static library and removes libX11
from the dependencies.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2010-01-11 01:11:05 +08:00
Chia-I Wu 897cb8950a egl: Fix breakage from -fvisibility=hidden.
Mark EGL API and driver functions as PUBLIC.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2010-01-05 11:23:52 -05:00
Chia-I Wu 326baecd75 egl: Correct conversion of native visual type.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-22 09:33:27 -06: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 8bb2485ed0 egl: Include GL header in eglconfigutil.h.
This is just a cosmetic change.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:56 -06:00
Chia-I Wu 29d115092e egl: Fix GLX_USE_TLS build.
Remove an extraneous semicolon.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:56 -06:00
Chia-I Wu 2fc1614e7a egl: Fix eglCheckConfigHandle.
A stupid bug by me made the check void.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-15 12:53:55 -06:00
Chia-I Wu f1c5cab552 egl: Improve logging facility.
Add _eglSetLogger and _eglSetLogLevel to allow drivers to change the
message logger or report level.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-13 12:00:37 -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