Commit Graph

322 Commits

Author SHA1 Message Date
Marek Olšák 0e4b564ef2 egl: combine VersionMajor and VersionMinor into one variable
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-06-05 19:44:33 +02:00
Marek Olšák efda9c5649 egl: set the EGL version in common code
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-06-05 19:44:33 +02:00
Emil Velikov 0c4eef6a2c egl: remove remaining EGL_MESA_copy_context skeleton
With earlier commit (7a58262e58 egl: Remove skeleton implementation of
EGL_MESA_screen_surface) we've removed the skeleton implementation of
eglCopyContextMESA(). Just like EGL_MESA_screen_surface this extension
was never implemented in mesa.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2015-05-14 21:05:16 +00:00
Emil Velikov 448e01b291 egl/main: fix EGL_KHR_get_all_proc_addresses
The extension requires that the address of the core functions should be
available via eglGetProcAddress. Currently the list is guarded by
_EGL_GET_CORE_ADDRESSES, which was only set for the scons (windows)
build.

Unconditionally enable it for all the builds (automake, android and
haiku) considering that the extension is not platform specific and is
always enabled.

v2: Drop the _EGL_GET_CORE_ADDRESSES macro altogether.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-05-14 21:00:05 +00:00
Marc-André Lureau ffc94e32a3 egl: more define fixes for EGL_MESA_image_dma_buf_export
s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by the spec
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-05-14 21:00:05 +00:00
Emil Velikov e3cc5ad49d egl/main: expose only core EGL functions statically
The EGL 1.3, 1.4 and 1.5 spec (as quoted below) explicitly mentions that
providing static symbols for functions provided by EGL extensions is not
portable. Considering that relatively recently we've seen a non-mesa
desktop EGL implementation, the fact that we opt for such behaviour has
gone unnoticed.

From the EGL 1.5 specification:
    For functions that are queryable with eglGetProcAddress,
    implementations may choose to also export those functions
    statically from the object libraries implementing those
    functions. However, portable clients cannot rely on this
    behavior.

To encourage devs against writing such non-portable code, let's hide the
symbols similar to the official binary driver from NVIDIA.

v2: Quote the EGL 1.5 spec, as suggested by Chad.

Cc: Brian Paul <brianp@vmware.com>
Cc: Chad Versace <chad.versace@intel.com>
Cc: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-05-14 21:00:05 +00:00
Adam Jackson 7a58262e58 egl: Remove skeleton implementation of EGL_MESA_screen_surface
No backend wires this up to anything, and the extension spec has been
marked obsolete for 4+ years.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-05-11 14:19:37 -04:00
Dave Airlie b5045e2991 egl: image_dma_buf_export - use KHR 64-bit type
After talking to Jon Leech he suggested this should be fine.

update spec to the version in the registry.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-05-05 12:19:40 +10:00
Marek Olšák 290a3eb750 egl/dri2: implement EGL_KHR_cl_event2 (v2)
v2: fix the SYNC_CONDITION query
2015-04-30 14:38:38 +02:00
Marek Olšák a8617cc042 egl/dri2: implement EGL_KHR_wait_sync 2015-04-30 14:38:38 +02:00
Marek Olšák 9a0bda2430 egl/dri2: implement EGL_KHR_fence_sync 2015-04-30 14:38:38 +02:00
Marc-André Lureau c66c158e59 egl: misc fixes for EGL_MESA_image_dma_buf_export
Fix define and a function argument name introduced in commit
8f7338f284

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-04-29 15:13:19 +10:00
Dave Airlie 8f7338f284 egl: add initial EGL_MESA_image_dma_buf_export v2.4
At the moment to get an EGL image to a dma-buf file descriptor,
you have to use EGL_MESA_drm_image, and then use libdrm to
convert this to a file descriptor.

This extension just provides an API modelled on EGL_MESA_drm_image,
to return a dma-buf file descriptor.

v2: update spec for new API proposal
add internal queries to get the fourcc back from intel driver.

v2.1: add gallium pieces.

v2.2: add offsets to spec and API, rename fd->fds, stride->strides
in API. rewrite spec a bit more, add some q/a

v2.3:
add modifiers to query interface and 64-bit type for that (Daniel Stone)
specifiy what happens to num fds vs num planes differences. (Chad Versace)

v2.4:
fix grammar (Daniel Stone)

Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-04-01 14:10:04 +10:00
Dave Airlie 37e3a116f8 egl: don't fill client apis string forever.
We never reset the string on eglTerminate, so it grows
for ever on multiple eglInitialise.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-03-19 08:28:38 +10:00
Matt Turner 6c6e2a15aa egl: Remove eglQueryString virtual dispatch.
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-03-17 14:09:56 -07:00
Matt Turner dac2e7deaa egl: Create queryable strings in eglInitialize().
Creating/recreating the strings in eglQueryString() is extra work and
isn't thread-safe, as exhibited by shader-db's run.c using libepoxy.

Multiple threads in run.c call eglReleaseThread() around the same time.
libepoxy calls eglQueryString() to determine whether eglReleaseThread()
exists, and our EGL implementation passes a pointer to the version
string to libepoxy while simultaneously overwriting the string, leading
to a failure in libepoxy.

Moreover, the EGL spec says (emphasis mine):

"eglQueryString returns a pointer to a *static*, zero-terminated string"

This patch moves some auxiliary functions from eglmisc.c to eglapi.c so
that they may be used to create the extension, API, and version strings
once during eglInitialize(). The auxiliary functions are renamed from
_eglUpdate* to _eglCreate*, and some checks made unnecessary by calling
the functions from eglInitialize() are removed.

Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-03-13 10:42:38 -07:00
Emil Velikov efe87f1a80 egl/main: use c11/threads' mutex directly
Remove the inline wrappers/abstraction layer.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-11 23:28:25 +00:00
Emil Velikov 56ede80940 Revert "egl/main: use c11/threads' mutex directly"
This reverts commit 6cee785c69.

Not meant to go in yet. Lacking review.
2015-03-06 17:07:40 +00:00
Emil Velikov 6cee785c69 egl/main: use c11/threads' mutex directly
Remove the inline wrappers/abstraction layer.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-06 16:46:17 +00:00
Emil Velikov d780012cd7 egl/main: replace __FUNCTION__ with __func__
The latter is a C99 standard, and our current wrapper c99_compat.h
should handle non-compliant compilers.
Drop the c99_compat.h inclusion from eglcompiler.h altogether, as it's
no longer required.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-05 14:45:53 +00:00
Emil Velikov 7bd1693877 egl/main: replace INLINE with inline
Drop the custom keyword in favour of the C99 one. All the places using
it now directly include c99_compat.h which should handle things on
platforms which lack it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-05 14:45:53 +00:00
Alexander von Gluck IV 400b833592 egl: Add Haiku code and support
* This is the cleaned up work of the Haiku GCI student
  Adrián Arroyo Calle adrian.arroyocalle@gmail.com
* Several patches were consolidated to prevent
  unnecessary touching of non-related code
2014-12-23 09:07:57 -05:00
Chad Versace 7e8ba77c49 egl: Expose EGL_KHR_get_all_proc_addresses and its client extension
Mesa already implements the behavior of EGL_KHR_get_all_proc_addresses
and EGL_KHR_client_get_all_proc_addresses. This patch just exposes the
extension strings.

See: https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_get_all_proc_addresses.txt
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-12-07 20:58:25 -08:00
Sinclair Yeh 91ff0d4c65 egl: Check for NULL native_window in eglCreateWindowSurface
We have customers using NULL as a way to test the robustness of the API.
Without this check, EGL will segfault trying to dereference
dri2_surf->wl_win->private because wl_win is NULL.

This fix adds a check and sets EGL_BAD_NATIVE_WINDOW

v2: Incorporated feedback from idr - moved the check to a higher level
function.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
2014-06-03 17:28:30 -07:00
Beren Minor 0ca0d5743f egl/main: Fix eglMakeCurrent when releasing context from current thread.
EGL 1.4 Specification says that
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)
can be used to release the current thread's ownership on the surfaces
and context.

MESA's egl implementation was only accepting the parameters when the
KHR_surfaceless_context extension is supported.

[chadv] Add quote from the EGL 1.4 spec.
Cc: "10,1, 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2014-06-02 12:16:50 -07:00
Sarah Sharp c524f3ef91 egl: Add EGL_CHROMIUM_sync_control extension.
Chromium defined a new GL extension (that isn't registered with Khronos).
We need to add an EGL extension for it, so we can migrate ChromeOS on
Intel systems to use EGL instead of GLX.

http://git.chromium.org/gitweb/?p=chromium/src/third_party/khronos.git;a=commitdiff;h=27cbfdab35c601f70aa150581ad1448d0401f447

The EGL_CHROMIUM_sync_control extension is similar to the GLX extension
OML_sync_control, but only defines one function,
eglGetSyncValuesCHROMIUM, which is equivalent to glXGetSyncValuesOML.

http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Jamey Sharp <jamey@minilop.net>
Cc: Ian Romanick <idr@freedesktop.org>
Cc: Stéphane Marchesin <stephane.marchesin@gmail.com>
2014-05-20 15:19:48 -07:00
Chad Versace 468cc866b4 egl/main: Enable Linux platform extensions
Enable EGL_EXT_platform_base and the Linux platform extensions layered
atop it: EGL_EXT_platform_x11, EGL_EXT_platform_wayland,
and EGL_MESA_platform_gbm.

Tested with Piglit's EGL_EXT_platform_base tests under an X11 session.
To enable running the Wayland and GBM tests, windowed Weston was running
and the kernel had render nodes enabled.

I regression tested my EGL_EXT_platform_base patch set with Piglit on
Ivybridge under X11/EGL, standalone Weston, and GBM with rendernodes. No
regressions found.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:49:06 -07:00
Chad Versace 6d1f83ec09 egl/main: Stop using EGLNative types internally
Internally, much of the EGL code uses EGLNativeDisplayType,
EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type
often does not match the variable's actual type.

The concept of EGLNative types are a bad match for Linux, as explained
below. And the EGL platform extensions don't use EGLNative types at all.
Those extensions attempt to solve cross-platform issues by moving the
EGL API away from the EGLNative types.

The core of the problem is that eglplatform.h can define each EGLNative
type once only, but Linux supports multiple EGL platforms.

To work around the problem, Mesa's eglplatform.h contains multiple
definitions of each EGLNative type, selected by feature macros. Mesa
expects EGL clients to set the feature macro approrpiately. But the
feature macros don't work when a single codebase must be built with
support for multiple EGL platforms, *such as Mesa itself*.

When building libEGL, autotools chooses the EGLNative typedefs based on
the first element of '--with-egl-platforms'. For example,
'--with-egl-platforms=x11,drm,wayland' defines the following:

    typedef Display* EGLNativeDisplayType;
    typedef Window   EGLNativeWindowType;
    typedef Pixmap   EGLNativePixmapType;

Clearly, this doesn't work well for Wayland and GBM.  Mesa works around
the problem by casting the EGLNative types to different things in
different files.

For sanity's sake, and to prepare for the EGL platform extensions, this
patch removes from egl/main and egl/dri2 all internal use of the
EGLNative types. It replaces them with 'void*' and checks each explicit
cast with a static assertion. Also, the patch touches egl_gallium the
minimal amount to keep it compatible with eglapi.h.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:39:23 -07:00
Neil Roberts 551d459af4 Add the EGL_MESA_configless_context extension
This extension provides a way for an application to render to multiple
surfaces with different buffer formats without having to use multiple
contexts. An EGLContext can be created without an EGLConfig by passing
EGL_NO_CONFIG_MESA. In that case there are no restrictions on the surfaces
that can be used with the context apart from that they must be using the same
EGLDisplay.

_mesa_initialze_context can now take a NULL gl_config which will mark the
context as ‘configless’. It will memset the visual to zero in that case.
Previously the i965 and i915 drivers were explicitly creating a zeroed visual
whenever 0 is passed for the EGLConfig. Mesa needs to be aware that the
context is configless because it affects the initial value to use for
glDrawBuffer. The first time the context is bound it will set the initial
value for configless contexts depending on whether the framebuffer used is
double-buffered.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-12 14:40:47 -07:00
Neil Roberts 4b17dff3e5 eglCreateContext: Remove the check for whether config == 0
In eglCreateContext there is a check for whether the config parameter is zero
and in this case it will avoid reporting an error if the
EGL_KHR_surfacless_context extension is supported. However there is nothing in
that extension which says you can create a context without a config and Mesa
breaks if you try this so it is probably better to leave it reporting an
error.

The original check was added in b90a3e7d8b based on the API-specific
extensions EGL_KHR_surfaceless_opengl/gles1/gles2. This was later changed to
refer to EGL_KHR_surfacless_context in b50703aea5. Perhaps the original
extensions specified a configless context but the new one does not.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-12 14:40:47 -07:00
José Fonseca 8771285054 s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 20:00:32 +00:00
Neil Roberts 5cddb1ce3c wayland: Add an extension to create wl_buffers from EGLImages
This adds an extension called EGL_WL_create_wayland_buffer_from_image
which adds the following single function:

struct wl_buffer *
eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image);

The function creates a wl_buffer which shares its contents with the given
EGLImage. The expected use case for this is in a nested Wayland compositor
which is using subsurfaces to present buffers from its clients. Using this
extension it can attach the client buffers directly to the subsurface without
having to blit the contents into an intermediate buffer. The compositing can
then be done in the parent compositor.

The extension is only implemented in the Wayland EGL platform because of
course it wouldn't make sense anywhere else.
2013-12-04 17:04:57 -08:00
Chad Versace 3c58d4c700 egl: Enable EGL_EXT_client_extensions
Insert two fields into _egl_global to hold the client extensions and
statically initialize them:
    ClientExtensions // a struct of bools
    ClientExtensionString

Post-patch, Mesa supports exactly one client extension,
EGL_EXT_client_extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-26 12:50:29 -08:00
Ander Conselvan de Oliveira 8d29b5271a egl: Update to Wayland 1.2 server API
Since Wayland 1.2, struct wl_buffer and a few functions are deprecated.

References to wl_buffer are replaced with wl_resource and some getter
functions and calls to deprecated functions are replaced with the proper
new API. The latter changes are related to resource versioning.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-08-07 10:37:58 -07:00
Topi Pohjolainen 0de013b619 egl: definitions for EXT_image_dma_buf_import
As specified in:

http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt

Checking for the valid fourcc values is left for drivers avoiding
dependency to drm header files here.

v2: enforce EGL_NO_CONTEXT

v3: declare the extension as EGL (not GLES)

v4: do not update eglext.h manually but rely on update from
    Khronos instead

v5: (Eric) report invalid context as EGL_BAD_PARAMETER instead of as
    EGL_BAD_CONTEXT

v6: (Chad) fix the checking for valid hints. Before all values were
    rejected.

v7: (Chad) comment style change from

    /**
     * Multi-
     * line

    into

    /* Multi-
     * line

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-02 08:56:03 +03:00
Robert Bragg 6425b14515 egl: Add extension infrastructure for EGL_EXT_swap_buffers_with_damage
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2013-05-07 17:07:45 +01:00
Ian Romanick b50703aea5 egl: Replace KHR_surfaceless_* extensions with KHR_surfaceless_context
KHR extension name is reserved for Khronos ratified extensions, and there is
no such thing as EGL_KHR_surfaceless_{gles1,gles2,opengl}.  Replace these
three extensions with EGL_KHR_surfaceless_context since that extension
actually exists.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2012-08-06 15:37:04 -07:00
Kristian Høgsberg e6a33570b7 egl: Add EGL_WAYLAND_PLANE_WL attribute
This lets us specify the plane to create the image for for multiplanar
wl_buffers.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-07-11 15:28:36 -04:00
Fredrik Höglund 7d46b45c5b egl: add EGL_NV_post_sub_buffer
v2: Handle EGL_POST_SUB_BUFFER_SUPPORTED_NV in
    _eglParseSurfaceAttribList()

Signed-off-by: Fredrik Höglund <fredrik@kde.org>

[olv: remove #ifdef checks]
2011-12-20 17:04:46 +08:00
Chia-I Wu f63e129d5f egl: KHR_reusable_sync entrypoints are missing from eglGetProcAddress 2011-12-20 17:00:01 +08:00
Chia-I Wu f957cac772 egl: remove #ifdef's for official extensions
There is no point in having them when we distribute eglext.h.

As for unofficial extensions, there is a chance that we might remove some of
them evetually.  Keeping the #ifdef's for now should make that easier.
2011-12-20 16:59:09 +08:00
Chia-I Wu ed1ff2acec egl: remove EGL_ANDROID_swap_rectangle
We never support this unofficial extension, and it has been removed from
Android recently.  There is no point in keeping it.
2011-12-20 16:20:17 +08:00
Chia-I Wu 00b365bc78 egl: add Android-specific extensions
Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
There is no spec for them though.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:48 +08:00
Benjamin Franzke 85fe948494 egl: Native Display autodetection
EGL doesnt define howto manage different native platforms.
So mesa has a builtime configurable default platform,
whith non-standard envvar (EGL_PLATFORM) overwrites.
This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

Detection is grouped into basic types of NativeDisplays (which itself
needs to be detected).  The final decision is based on characteristcs
of these basic types:

  File Desciptor based platforms (fbdev):
    - fstat(2) to check for being a fd that belongs to a character device
    - check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
    - mincore(2) to check whether its valid pointer to some memory.
    - magic elements (e.g. pointers to exported symbols):
      o wayland display stores interface type pointer (first elm.)
      o gbm stores pointer to its constructor (first elm.)
      o x11 as a fallback (FIXME?)

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2011-08-15 09:42:16 +02:00
Chia-I Wu f2001df508 egl: add copyright notices
The list of copyright holders could be incomplete.  Please update
directly or notify me if your name is missing.
2011-07-02 18:21:31 +09:00
José Fonseca 6a661895e9 egl: Fix int <-> ptr casts.
Based on zhigang gong <zhigang.gong@gmail.com>'s patch.
2011-05-12 15:12:16 +01:00
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
Chia-I Wu 2f2cf461c5 egl: Overhaul driver API.
The motivation is so that drivers do not need to look up and check for
bad display, context, and etc.  It also becomes unnecessary for drivers
to call the link functions.

This commit makes eglapi.[ch] do the lookup and check.  As a result, the
driver API is overhauled, and almost all sources and drivers need
update.  The updates are mainly find and replace with human brains.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:44:34 -06:00
Chia-I Wu 0e3687e33d egl: Make _eglGlobal initialize statically.
Now that display and surface hash tables are moved out, _eglGlobal can
be initialized statically.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-11 22:14:35 -06:00
Chia-I Wu be9d1ab171 egl: Return the same EGL Display for the same native display.
The latest revision of the spec explicitly requires the same handle to
be returned for the same native display.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:53:39 -06:00
Chia-I Wu 18457cb263 egl: Add funtions to link contexts and surfaces to displays.
EGL contexts and surfaces are resources of displays.  They should be
managed by displays.  This commit adds a bunch of functions to
egldisplay.c to help establish the links between contexts/surfaces and
displays.  How links are established is considered opaque outside
display.  Functions like _eglGetSurfaceHandle or _eglLookupSurface are
therefore moved to egldisplay.c, with some small modifications.

The idea is also extended to display.  That is, displays need to link to
themselves to be looked up.

This commit only adds the functions.  A commit to use them should
follow.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:48:27 -06:00
Chia-I Wu 21b635ffa8 egl: Extend per-thread info for multiple current contexts.
EGL allows multiple current contexts, as long as they are bound to
different client APIs.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:42:04 -06:00
Chia-I Wu 75da80b295 egl: Support per-thread info.
This commit introduces a "current" system to manage per-thread info.  It
uses TLS, if GLX_USE_TLS is defined, or pthread, if PTHREADS is defined.
If none of them are defined, it uses a dummy implementation that is just
like before.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-07-17 11:41:02 -06:00
Jonathan White 7e2458c7b5 egl: fix version handling 2008-08-06 13:40:03 -06:00
Brian Paul e3805cad0d egl: new eglGetProcAddress() code
The idea is to pass the call down to the device driver where an API-specific
query can be made.  Untested.
2008-05-30 14:50:33 -06:00
Brian Paul d5078b9432 egl: clean-up re-org of the client API state 2008-05-30 13:45:40 -06:00
Brian Paul 1c73b4ba86 egl: added Name field to _EGLDriver so a driver name string can propogate up through EGL_VERSION string 2008-05-29 17:04:24 -06:00
Brian Paul c56e15b093 egl: make sure EGL_VERSION_STRING query returns same version as eglInitialize() 2008-05-28 15:43:41 -06:00
Brian Paul 0c8908c411 egl: added args string to _eglMain() 2008-05-28 12:56:36 -06:00
Brian Paul 6052af172f minor overhaul/re-org of driver selection/loading code 2008-05-27 16:48:23 -06:00
Brian Paul 721ba15bf4 added _eglGet*Handle() functions
These are the inverse of the _eglLookup*() functions.
Returns the public handle for a private surface/config/display/etc.
Removes glapi.c's direct access of private fields.
2008-05-27 14:33:54 -06:00
Brian Paul 5f8a4f3e5e added EGL_OPENGL_API case 2008-05-27 14:23:56 -06:00
Brian Paul 5e7dba5412 eliminate the context hash table
In EGL 1.4 the opaque EGLContext type is a pointer so we can just cast
between public EGLContext handles and private _EGLContext pointers.
2008-05-27 14:21:25 -06:00
Brian Paul 1ed1027e88 assorted changes to compile with new EGL 1.4 headers (untested) 2008-05-27 13:45:41 -06:00
Brian Paul b2006a40eb some initial EGL 1.2 work 2006-01-30 00:10:55 +00:00
Brian Paul 4882279633 Some initial per-thread support.
Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA.
2005-12-10 17:54:00 +00:00
Brian Paul daf585d0f0 Move all the EGL API function pointers into a new _egl_api struct. 2005-11-24 04:02:16 +00:00
Brian Paul 198d6d05b0 remove eglQueryDisplayMESA() 2005-05-17 13:22:13 +00:00
Brian Paul f9bad3dfea use EGLint instead of unsigned long for eglCopyContextMESA, added comments 2005-05-16 02:21:08 +00:00
Jon Smirl 1c606a9aa1 Add empty placeholder for eglCopyContextMESA 2005-05-14 14:54:38 +00:00
Jon Smirl 7012d01d88 First attempt at getting egl support up on dumb framebuffer.
Seems to be mostly working. Not all of egl API is implemented.
2005-05-13 18:31:35 +00:00
Brian Paul c22990c29a sync with latest EGL_MESA_screen_surface spec (EGLScreenMESA handles) 2005-05-04 03:33:21 +00:00
Brian Paul adbff7e977 initial EGL code 2005-04-22 21:09:39 +00:00