Commit Graph

592 Commits

Author SHA1 Message Date
Kristian Høgsberg 0725f2d654 egl: Add extension infrastructure for EGL_EXT_buffer_age 2013-01-04 11:20:12 -05:00
Chad Versace bfe28b8d93 egl/android: Fix build for Jelly Bean (v2)
In Jelly Bean, the interface to ANativeWindow changed. The change included
adding a new parameter the queueBuffer and dequeueBuffer methods,
removing the lockBuffer method, and requiring libsync.

v2:
  - s/fence_fd == -1/fence_fd != -1/
  - Fix leak. Close the fence_fd.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-02 14:55:36 -08:00
Matt Turner 1f82bf12ed Remove OpenVMS support
Not maintained since 2008. Doubtful that it's worked in quite a while.

Also see commit 32ac8cb05 which removed VMS stuff from Makefile in 2009.

Cc: Jouk Jansen <j.jansen@tudelft.nl>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
2012-11-16 10:01:46 +01:00
Matt Turner 587d5db11d egl: Return EGL_BAD_MATCH for invalid profile attributes
Version 12 of the EGL_KHR_create_context spec changed this behavior.

NOTE: This is a candidate for the 9.0 branch
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2012-10-10 13:15:06 -07:00
Matt Turner 814345f54b build: Use AX_PTHREAD's HAVE_PTHREAD preprocessor definition 2012-10-01 15:23:04 -07:00
Matt Turner 2b7a972e3f Don't cast the return value of malloc/realloc
This patch has been generated by the following Coccinelle semantic
patch:

// Don't cast the return value of malloc/realloc.
//
// Casting the return value of malloc/realloc only stands to hide
// errors.

@@
type T;
expression E1, E2;
@@
- (T)
(
_mesa_align_calloc(E1, E2)
|
_mesa_align_malloc(E1, E2)
|
calloc(E1, E2)
|
malloc(E1)
|
realloc(E1, E2)
)
2012-09-05 22:28:50 -07:00
Matt Turner 971750e1cd egl: fix invalid flag detection for EGL_KHR_create_context
We want to check whether there are bits set outside of the valid flags.

Fixes piglit test egl-create-context-invalid-flag-gl

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-08-27 15:11:11 -07:00
Ian Romanick dbecb41300 egl: Allow OpenGL ES 3.0 as a version
In the DRI2 back-end this will get the same API as GLES 2.0.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-14 15:41:03 -07:00
Ian Romanick f171571bfc egl: Implement front-end support for EGL_EXT_create_context_robustness
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-14 15:41:03 -07:00
Ian Romanick 63beb3df98 egl: Implement front-end support for EGL_KHR_create_context
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-14 15:41:03 -07:00
Ian Romanick 3fd79dd988 egl: Rename ClientVersion to ClientMajorVersion, add ClientMinorVersion
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-08-14 15:41:03 -07: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
Jon TURNEY b2a37e242e automake: convert libglapi
* "configure substitutions are not allowed in _SOURCES variables" in automake,
so remove the AC_SUBST'ed GLAPI_ASM_SOURCES and instead use some AM_CONDITIONALS
to choose which asm sources are used

* Change GLAPI_LIB to point to the .la file in other Makefile.am files, and make a link
to the .a file for the convenience of other Makefiles which have not yet been converted
to automake

v2:
- Use AM_CPPFLAGS for cleaner build output
- EXTRA_SOURCES is not needed
- Remove libglapi.a compatibility link on clean

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Matt Turner <mattst88@gmail.com>
2012-07-13 12:44:07 +01: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
Tom Stellard a75c6163e6 radeonsi: initial WIP SI code
This commit adds initial support for acceleration
on SI chips.  egltri is starting to work.

The SI/R600 llvm backend is currently included in mesa
but that may change in the future.

The plan is to write a single gallium driver and
use gallium to support X acceleration.

This commit contains patches from:
Tom Stellard <thomas.stellard@amd.com>
Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher <alexander.deucher@amd.com>
Vadim Girlin <vadimgirlin@gmail.com>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

The following commits were squashed in:

======================================================================

radeonsi: Remove unused winsys pointer

This was removed from r600g in commit:

commit 96d882939d
Author: Marek Olšák <maraeo@gmail.com>
Date:   Fri Feb 17 01:49:49 2012 +0100

    gallium: remove unused winsys pointers in pipe_screen and pipe_context

    A winsys is already a private object of a driver.

======================================================================

radeonsi: Copy color clamping CAPs from r600

Not sure if the values of these CAPS are correct for radeonsi, but the
same changed were made to r600g in commit:

commit bc1c836938
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jan 23 03:11:17 2012 +0100

    st/mesa: do vertex and fragment color clamping in shaders

    For ARB_color_buffer_float. Most hardware can't do it and st/mesa is
    the perfect place for a fallback.
    The exceptions are:
    - r500 (vertex clamp only)
    - nv50 (both)
    - nvc0 (both)
    - softpipe (both)

    We also have to take into account that r300 can do CLAMPED vertex colors only,
    while r600 can do UNCLAMPED vertex colors only. The difference can be expressed
    with the two new CAPs.

======================================================================

radeonsi: Remove PIPE_CAP_OUTPUT_READ

This CAP was dropped in commit:

commit 04e3240087
Author: Marek Olšák <maraeo@gmail.com>
Date:   Thu Feb 23 23:44:36 2012 +0100

    gallium: remove PIPE_SHADER_CAP_OUTPUT_READ

    r600g is the only driver which has made use of it. The reason the CAP was
    added was to fix some piglit tests when the GLSL pass lower_output_reads
    didn't exist.

    However, not removing output reads breaks the fallback for glClampColorARB,
    which assumes outputs are not readable. The fix would be non-trivial
    and my personal preference is to remove the CAP, considering that reading
    outputs is uncommon and that we can now use lower_output_reads to fix
    the issue that the CAP was supposed to workaround in the first place.

======================================================================

radeonsi: Add missing parameters to rws->buffer_get_tiling() call

This was changed in commit:

commit c0c979eebc
Author: Jerome Glisse <jglisse@redhat.com>
Date:   Mon Jan 30 17:22:13 2012 -0500

    r600g: add support for common surface allocator for tiling v13

    Tiled surface have all kind of alignment constraint that needs to
    be met. Instead of having all this code duplicated btw ddx and
    mesa use common code in libdrm_radeon this also ensure that both
    ddx and mesa compute those alignment in the same way.

    v2 fix evergreen
    v3 fix compressed texture and workaround cube texture issue by
       disabling 2D array mode for cubemap (need to check if r7xx and
       newer are also affected by the issue)
    v4 fix texture array
    v5 fix evergreen and newer, split surface values computation from
       mipmap tree generation so that we can get them directly from the
       ddx
    v6 final fix to evergreen tile split value
    v7 fix mipmap offset to avoid to use random value, use color view
       depth view to address different layer as hardware is doing some
       magic rotation depending on the layer
    v8 fix COLOR_VIEW on r6xx for linear array mode, use COLOR_VIEW on
       evergreen, align bytes per pixel to a multiple of a dword
    v9 fix handling of stencil on evergreen, half fix for compressed
       texture
    v10 fix evergreen compressed texture proper support for stencil
        tile split. Fix stencil issue when array mode was clear by
        the kernel, always program stencil bo. On evergreen depth
        buffer bo need to be big enough to hold depth buffer + stencil
        buffer as even with stencil disabled things get written there.
    v11 rebase on top of mesa, fix pitch issue with 1d surface on evergreen,
        old ddx overestimate those. Fix linear case when pitch*height < 64.
        Fix r300g.
    v12 Fix linear case when pitch*height < 64 for old path, adapt to
        libdrm API change
    v13 add libdrm check

    Signed-off-by: Jerome Glisse <jglisse@redhat.com>

======================================================================

radeonsi: Remove PIPE_TRANSFER_MAP_PERMANENTLY

This was removed in commit:

commit 62f44f670b
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Mar 5 13:45:00 2012 +0100

    Revert "gallium: add flag PIPE_TRANSFER_MAP_PERMANENTLY"

    This reverts commit 0950086376.

    It was decided to refactor the transfer API instead of adding workarounds
    to address the performance issues.

======================================================================

radeonsi: Handle PIPE_VIDEO_CAP_PREFERED_FORMAT.

Reintroduced in commit 9d9afcb5ba.

======================================================================

radeonsi: nuke the fallback for vertex and fragment color clamping

Ported from r600g commit c2b800cf38.

======================================================================

radeonsi: don't expose transform_feedback2 without kernel support

Ported from r600g commit 15146fd1bc.

======================================================================

radeonsi: Handle PIPE_CAP_GLSL_FEATURE_LEVEL.

Ported from r600g part of commit 171be75522.

======================================================================

radeonsi: set minimum point size to 1.0 for non-sprite non-aa points.

Ported from r600g commit f183cc9ce3.

======================================================================

radeonsi: rework and consolidate stencilref state setting.

Ported from r600g commit a2361946e7.

======================================================================

radeonsi: cleanup setting DB_SHADER_CONTROL.

Ported from r600g commit 3d061caaed.

======================================================================

radeonsi: Get rid of register masks.

Ported from r600g commits
3d061caaed13b646ff40754f8ebe73f3d4983c5b..9344ab382a1765c1a7c2560e771485edf4954fe2.

======================================================================

radeonsi: get rid of r600_context_reg.

Ported from r600g commits
9344ab382a1765c1a7c2560e771485edf4954fe2..bed20f02a771f43e1c5092254705701c228cfa7f.

======================================================================

radeonsi: Fix regression from 'Get rid of register masks'.

======================================================================

radeonsi: optimize r600_resource_va.

Ported from r600g commit 669d8766ff.

======================================================================

radeonsi: remove u8,u16,u32,u64 types.

Ported from r600g commit 78293b99b2.

======================================================================

radeonsi: merge r600_context with r600_pipe_context.

Ported from r600g commit e4340c1908.

======================================================================

radeonsi: Miscellaneous context cleanups.

Ported from r600g commits
e4340c1908a6a3b09e1a15d5195f6da7d00494d0..621e0db71c5ddcb379171064a4f720c9cf01e888.

======================================================================

radeonsi: add a new simple API for state emission.

Ported from r600g commits
621e0db71c5ddcb379171064a4f720c9cf01e888..f661405637bba32c2cfbeecf6e2e56e414e9521e.

======================================================================

radeonsi: Also remove sbu_flags member of struct r600_reg.

Requires using sid.h instead of r600d.h for the new CP_COHER_CNTL definitions,
so some code needs to be disabled for now.

======================================================================

radeonsi: Miscellaneous simplifications.

Ported from r600g commits 38bf276348 and
b0337b679a.

======================================================================

radeonsi: Handle PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION.

Ported from commit 8b4f7b0672.

======================================================================

radeonsi: Use a fake reloc to sleep for fences.

Ported from r600g commit 8cd03b933c.

======================================================================

radeonsi: adapt to get_query_result interface change.

Ported from r600g commit 4445e170be.
2012-04-13 10:32:06 -04:00
Dylan Noblesmith 071501a681 egl: fix uninitialized values
Noticed by clang:

eglimage.c:48:28: warning: argument to 'sizeof' in 'memset' call is
the same expression as the destination; did you mean to dereference
it? [-Wsizeof-pointer-memaccess]
   memset(attrs, 0, sizeof(attrs));
          ~~~~~            ^~~~~

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
2012-04-13 14:25:08 +00:00
Kenneth Graunke dfce56ba4d Add Makefile.in to toplevel .gitignore
To avoid redundancies, this patch also removes Makefile.in from the
other .gitignore files.

Acked-by: Eric Anholt <eric@anholt.net>
2012-03-20 11:50:50 -07:00
Paul Berry b41ab3b42c Add .deps/, .libs/, and *.la to toplevel .gitignore
To avoid redundancies, this patch also removes .deps, .libs, and *.la
from .gitignore files in subdirectories.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-03-20 11:50:50 -07:00
Kristian Høgsberg ca760181b4 shared-glapi: Convert to automake
This fixes a build problem where EGL links to libgbm.la, which encodes
a relative path to it's libglapi.so dependency.  The relative path
breaks when the linker tries to resolve it from src/egl/main instead
of src/gbm.  Typically we silently fall back to the system
libglapi.so, which is wrong and breaks when there isn't one.

Morale of the story: don't mix mklib and libtool.
2012-03-19 11:13:06 -04:00
Jon TURNEY 71f4a960f8 egl: Use -no-undefined libtool flag
"Use -no-undefined to assure libtool that the library has no
unresolved symbols at link time, so that libtool will build a shared
library on platforms require that all symbols are resolved when the
library is linked."

If I had a dollar for every time I wrote this patch, I'd have about
$10 :-)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2012-03-05 18:39:29 -08:00
Eric Anholt 31b044506e egl: Also put a symlink from libEGL.so in lib/ for now.
This fixes the egl_gallium.so driver build when no system libEGL.so is
present, since it's relying on the lib/ to build against until it gets
converted to automake.
2012-03-02 18:42:25 -08:00
José Fonseca 6b024464e8 egl: Don't include strings.h on Windows.
strings.h is needed for the declaration of strcasecmp(), but only on
non-Windows platforms.
2012-03-01 06:37:30 +00:00
Eric Anholt e5f895485e egl/drivers: Convert to automake.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-02-29 11:52:41 -08:00
Eric Anholt 88612029f6 egl/main: Convert to automake.
The drivers/ walk-through-subdirs makefile is converted as well so I
didn't need to keep EGL_DRIVERS_DIRS along with the per-driver
HAVE_EGL_DRIVER_WHATEVER.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-02-29 11:52:40 -08:00
Benjamin Franzke 8b902056d5 automake: src/egl/wayland
So we can use the wayland scanner makro, which is way
better than our previous runtime-pkgconfig hack.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2012-01-26 10:07:11 +01:00
Matt Turner a208468e04 gbm: install libgbm.so into lib
This partially reverts commit 90e2568534.
2012-01-24 11:32:02 -05:00
Benjamin Franzke 90e2568534 egl,gbm_gallium: Fix linkage against gbm from automake
Add src/gbm/.libs to ldflags.
The gbm lib is src/gbm/.libs/ instead of lib/
as of commit 06ad64ad29.
2012-01-24 10:00:52 +01: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 496f68bb9d android: bring in i915_dri and i965_dri automatically
Add i915_dri and i965_dri to libGLES_mesa's LOCAL_REQUIRED_MODULES when
enabled.
2011-11-26 11:42:08 +08:00
Chia-I Wu 4d3d6f76ff android: move libGLES_mesa build rules to src/egl/main/.
Keep the top-level Android.mk away from building modules.
2011-11-26 11:42:08 +08:00
Brian Paul 2e15f0c860 egl: silence unused var warning 2011-11-10 16:00:46 -07:00
Chia-I Wu 5eca41665b egl: add null platform
The null platform has no window or pixmap surface (but pbuffer surface).
And the only valid display is EGL_DEFAULT_DISPLAY.  It is useful for
offscreen rendering.  It works everywhere becase no window system is
required.
2011-09-20 17:44:15 +08:00
José Fonseca 1cf808c86e Define INLINE macro in terms of inline. 2011-09-08 09:17:42 +01:00
Benjamin Franzke efb4872a9d egl: Use gbm/wayland flags regardless of egl_dri2
Since they are needed for display autodetection.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40443
2011-08-29 09:34:20 +02:00
Chia-I Wu 099faeef33 android: add support for egl_dri2
Add rules to build egl_dri2 and make it a built-in EGL driver of
libGLES_mesa.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-28 21:56:23 +08:00
Chia-I Wu 2a77dc0c0d android: build core EGL
This builds the static library libmesa_egl from core EGL.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +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
Chia-I Wu b0945c14df egl: add _EGL_PLATFORM_ANDROID
This is Android Gingerbread platform.

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 61d2dfbe48 egl: Add include paths for platform autodetection
Needed since commit 85fe9484.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40145
2011-08-16 19:28:07 +02:00
Benjamin Franzke 2e71c7d4ff egl: Log (debug) native platform type
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2011-08-15 09:42:16 +02: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 d6a9564854 egl: EGL_MATCH_NATIVE_NATIVE_PIXMAP cannot be EGL_DONT_CARE 2011-07-29 10:24:45 +09:00
Chia-I Wu a5ab46909e egl: make pixmaps and pbuffers EGL_BUFFER_PRESERVED
eglSwapBuffers is no-op to these surface types anyway.
2011-07-29 10:24:39 +09: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
Chia-I Wu c250363022 egl: fix a compiler warning 2011-07-01 18:28:56 +09:00
Chia-I Wu 8ea5330200 egl: fix EGL_MATCH_NATIVE_PIXMAP
EGL_MATCH_NATIVE_PIXMAP is valid for eglChooseConfig, but invalid for
eglGetConfigAttrib.
2011-06-25 18:51:11 +09:00
Chia-I Wu 31520548b7 egl: make implementing eglChooseConfig easier
Add a new helper function, _eglFilterConfigArray, for drivers and hide
_eglSortConfigs.
2011-06-25 18:17:38 +09:00
Benjamin Franzke e5fc4c81ce egl_dri2: Hookup gbm as drm platform 2011-06-23 21:07:17 +02:00
Kristian Høgsberg bfaa458445 wayland: Fix link order for libwayland-drm.a 2011-05-18 18:57:05 -04:00
Benjamin Franzke b8033a5651 egl: Compile wayland-drm.a into libEGL independent of egl_dri2
Fixes egl_gallium when egl_dri2 is not enabled.
2011-05-16 10:36:36 +02:00
Kristian Høgsberg 93aea63a33 egl_dri2: Make it possible to not compile in the X11 platform 2011-05-13 09:31:09 -04: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
Benjamin Franzke e586c4b763 egl: Add wayland platform 2011-02-07 13:52:29 +01:00
Chia-I Wu f36cba6cf3 egl: Make the transition to built-in drivers more smooth.
When the user sets EGL_DRIVER to egl_dri2 (or egl_glx), make sure the
built-in driver is used.  The user might leave the outdated egl_dri2.so
(or egl_glx.so) on the filesystem and we do not want to load it.
2011-01-30 04:55:08 +08:00
Chia-I Wu e7d8f92570 egl: Fix EGL_VERSION string.
Fix a copy-and-paste error in a4a38dcf61.
2011-01-14 14:29:19 +08:00
Chia-I Wu 36a59b29ef egl: Fix an assertion in _eglUpdateAPIsString.
dpy->ClientAPIs was renamed in a4a38dcf61.
2011-01-14 14:12:42 +08:00
Brian Paul ca31c596e8 egl: need stdio.h for non-Windows build too to avoid compiler warning 2011-01-13 09:25:55 -07:00
Chia-I Wu a22a332fc7 egl: Improve driver selection.
The idea is to be able to match a driver using the following order

  try egl_gallium with hw renderer
  try egl_dri2
  try egl_gallium with sw renderer
  try egl_glx

given the module list

  egl_gallium
  egl_dri2
  egl_glx

For that, UseFallback initialization option is added.  The module list
is matched twice: with the option unset and with the option set.  In the
first pass, egl_gallium skips its sw renderer and egl_glx rejects to
initialize since UseFallback is not set.  In the second pass,
egl_gallium skips its hw renderer and egl_dri2 rejects to initialize
since UseFallback is set.  The process stops at the first driver that
initializes the display.
2011-01-13 18:15:45 +08:00
Chia-I Wu 655e459892 egl: Simplify driver matching.
Add initialization options that drv->API.Initialize should support.
Replace drv->Probe by TestOnly initialization option and simplify
_eglMatchDriver.
2011-01-13 18:10:38 +08: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 1e4f412242 egl: When EGL_DRIVER is set, do not add other drivers.
Setting EGL_DRIVER forces the driver to be loaded, as documented.  There
should be no fallbacks.
2011-01-12 18:10:15 +08:00
Chia-I Wu 4924cb9036 egl: libEGL depends on LOCAL_LIBS.
So that libEGL is rebuilt whenever LOCAL_LIBS changes.
2011-01-12 18:10:15 +08:00
Chia-I Wu a8b6b6555c scons: Updates for targets/egl-static.
Update SConscripts to re-enable or add support for EGL on windows and
x11 platforms respectively.  targets/egl-gdi is replaced by
targets/egl-static, where "-static" means pipe drivers and state
trackers are linked to statically by egl_gallium, and egl_gallium is a
built-in driver of libEGL.  There is no more egl_gallium.dll on Windows.
2011-01-12 17:40:01 +08:00
Chia-I Wu 49ed5bb28d targets/egl-static: New EGL target for scons.
This target is based on and replaces egl-gdi.  It is suitable for both
windows and x11.
2011-01-12 17:40:01 +08:00
Chia-I Wu c98ea26e16 egl: Make egl_dri2 and egl_glx built-in drivers.
These two drivers are small in size.  Making them built-in should
simplify packaging.
2011-01-10 11:50:34 +08:00
Brian Paul e227f4bf50 egl: add missing case in _eglError() 2010-12-31 09:14:25 -07:00
Chia-I Wu d6b1478ff0 egl: Do not unload drivers.
When the driver is the last reference to libEGL.so, unloading it will
cause libEGL.so to be unmapped and give problems.  Disable the unloading
for now.  Still have to figure out the right timing to unload drivers.
2010-12-12 18:31:48 +08:00
Chia-I Wu 5ae4b6693a egl: _eglFilterArray should not allocate.
Otherwise, when it is called from within a driver, the caller cannot
free the returned data (on Windows).
2010-12-06 15:40:37 +08:00
Thomas Hellstrom 675aec8178 egl: Add an include for size_t
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-11-09 12:31:24 +01:00
Chia-I Wu 04ae53ca8a st/egl: Add support for EGL_MATCH_NATIVE_PIXMAP.
Added for completeness.  It makes sense to have such mechanism, but I am
not aware of any user of that..
2010-11-03 17:17:29 +08:00
Chia-I Wu c9186bd588 egl: Set up the pthread key even TLS is used.
We have to rely on the pthread key destructor to free the current thread
info when a thread exits.
2010-11-03 13:34:17 +08:00
Chia-I Wu ad00a92ee7 egl: Rework _eglGetSearchPath.
So that the directory part of EGL_DRIVER, if exists, is prepended to the
search path.  This commit also adds a sanity check to _eglLog.
2010-11-02 01:37:16 +08:00
José Fonseca 601498ae73 scons: Revamp how to specify targets to build.
Use scons target and dependency system instead of ad-hoc options.

Now is simply a matter of naming what to build. For example:

  scons libgl-xlib

  scons libgl-gdi

  scons graw-progs

  scons llvmpipe

and so on. And there is also the possibility of scepcified subdirs, e.g.

  scons src/gallium/drivers

If nothing is specified then everything will be build.

There might be some rough corners over the next days. Please bare with me.
2010-11-01 13:30:22 +00:00
Vinson Lee 1b92eb1a4b egl: Remove unnecessary headers. 2010-10-27 09:51:11 -07:00
Chia-I Wu 0d43cbed2f egl: Fix a false negative check in _eglCheckMakeCurrent.
This call sequence

  eglMakeCurrent(dpy, surf, surf, ctx1);
  eglMakeCurrent(dpy, surf, surf, ctx2);

should be valid if ctx1 and ctx2 have the same client API and are not
current in another thread.
2010-10-23 16:58: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 dc4f845c37 egl: Add reference count for resources.
This is a really simple mechanism.  There is no atomicity and the caller
is expected to hold the display lock.
2010-10-23 15:19:34 +08:00
Chia-I Wu e32ac5b8a9 egl: Fix _eglModeLookup.
Internally a mode belongs to a screen.  But functions like
eglGetModeAttribMESA treat a mode as a display resource: a mode can be
looked up without a screen.  Considering how KMS works, it is better to
stick to the current implementation.

To properly support looking up a mode without a screen, this commit
assigns each mode (of all screens) a unique ID.
2010-10-23 11:20:41 +08:00
Chia-I Wu 37213ceacc egl: Minor changes to the _EGLScreen interface.
Make _eglInitScreen take a display and rename _eglAddScreen to
_eglLinkScreen.  Remove unused functions.
2010-10-23 11:20:41 +08:00
Chia-I Wu 8a6bdf3979 egl: Minor changes to the _EGLConfig interface.
Mainly to rename _eglAddConfig to _eglLinkConfig, along with a few clean
ups.
2010-10-23 11:20:40 +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 25328509c9 egl: Move fallback routines to eglfallbacks.c.
We do not want them to be all over the places.
2010-10-22 18:38:30 +08:00
Chia-I Wu 5664a98386 egl: Parse image attributes with _eglParseImageAttribList.
Avoid code duplications.
2010-10-22 18:35:09 +08:00
Chia-I Wu 713c8734f4 egl: Move attributes in _EGLImage to _EGLImageAttribs.
The opaque nature of EGLImage implies that extensions almost always
define their own attributes.  Move attributes in _EGLImage to
_EGLImageAttribs and add a helper function to parse attribute lists.
2010-10-22 17:15:45 +08:00
Chia-I Wu 0ed96efc1b egl_glx: Drop the use of [SG]ET_CONFIG_ATTRIB.
_EGLConfig can be directly dereferenced now.  Since egl_glx is the last
user of the macros, drop the macros too.
2010-10-22 16:26:25 +08:00
Chia-I Wu 3fa21881b1 egl: Access config attributes directly.
Replace SET_CONFIG_ATTRIB/GET_CONFIG_ATTRIB by direct dereferences.
2010-10-14 17:16:14 +08:00
Chia-I Wu 282e514240 egl: Use attribute names as the _EGLConfig member names.
This makes _EGLConfig more accessible and scales better when new
attributes are added.
2010-10-14 17:14:44 +08:00
Nicolas Kaiser 3b7b1db661 egl: remove duplicated include
Remove duplicated include.

Signed-off-by: Brian Paul <brianp@vmware.com>
2010-09-30 09:36:21 -06: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 e7424d7240 st/egl: Rename kms backend to drm.
The main use of the backend is to support EGL_MESA_drm_display.  drm
should be a better name.
2010-09-19 17:19:03 +08:00
Chia-I Wu ea9e5dbbc2 egl: Simplify _eglBindContext.
Remove the hard-to-get-right _eglBindContextToSurfaces.  As well as fix
an assertion failure from b90a3e7d8b when
such call sequence is hit

  eglMakeCurrent(dpy, surf1, surf1, ctx1);
  eglMakeCurrent(dpy, surf2, surf2, ctx2);
  eglMakeCurrent(dpy, surf1, surf1, ctx1);
2010-09-10 18:41:14 +08:00
Kristian Høgsberg 6eda3f311b eglglx: Convert glx visuals/fbconfigs straight to EGL configs
In other words, skip the __GLcontextModes middle man.
2010-09-09 15:00:18 -04: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
Chia-I Wu 08a482e7a9 egl: Display may be NULL in _eglLookup*.
This fixes several NULL dereferences.
2010-09-10 00:18:14 +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 5eb33596a0 egl: Fix context API check and be verbose.
The API of the context was not checked against EGL_RENDERABLE_TYPE when there
was no attribute list.  Move the check to _eglInitContext, and be verbose about
common mistakes (EGL_RENDERABLE_TYPE not set, EGL_CONTEXT_CLIENT_VERSION not
set, or eglBindAPI not called).
2010-08-20 19:22:51 +08:00
Chia-I Wu ce2cae4130 egl: Add egl.def for win32 build.
Without the .def file, function names are decorated and cannot be
queried by GetProcAddress easily.
2010-08-20 19:22:50 +08: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 ce29e86458 st/egl: Fix win32 build.
Add new source files to SConscripts.
2010-08-19 14:07:29 +08:00
Chia-I Wu 2b2c5c4f5c egl: Add support for EGL_KHR_fence_sync.
Individual drivers still need to support and enable the extension.
2010-08-17 00:06:19 +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
Vinson Lee db71bdc31c egl: Fix '_eglAddAtExitCall' implicit declaration warning. 2010-07-31 13:28:32 -07:00
Chia-I Wu 6c7e0b95a4 egl: Add checks for EGL_MESA_screen_surface.
This allows Mesa EGL to be compiled with eglext.h that does not define
EGL_MESA_screen_surface.
2010-07-31 17:49:32 +08:00
Kristian Høgsberg 2c343af098 egl: Fix deref before NULL-check 2010-07-28 23:54:16 -04: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
Chia-I Wu d7284b45e2 egl: Return the correct array size in _eglFlattenArray.
The function is used by _eglGetConfigs and _eglGetScreens.  The array
size should not be limited by the buffer size when the buffer is NULL.

This fixes fdo bug #29052.
2010-07-15 10:05:46 +08: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 a8815b754d egl: Update MaxSize when a dynamic array is grown. 2010-06-30 18:52:00 +08:00
Chia-I Wu 98ebc8165c egl: Make _eglUnloadDrivers no-op on Windows.
Windows unloads DLLs before atexit.  Make _eglUnloadDrivers no-op on
Windows for now.
2010-06-30 18:32:48 +08:00
Chia-I Wu 8b0c6c4a8d egl: Store screens in a dynamic array. 2010-06-30 18:32:48 +08:00
Chia-I Wu 6717a313f2 egl: Store configs in a dynamic array. 2010-06-30 18:32:48 +08:00
Chia-I Wu 106466783f egl: Add dynamic array.
Dynamic arrays will be used to store configs and screens of a display.
2010-06-30 18:32:48 +08:00
Chia-I Wu 4cb853402b egl: Remove st/egl probe code.
It is no longer needed.
2010-06-29 17:16:20 +08:00
Chia-I Wu afcea9b115 egl: Do not call drv->Initialize with global mutex locked. 2010-06-29 17:16:20 +08:00
Chia-I Wu a81ef14228 st/egl: Build a single EGL driver.
This change makes st/egl build a single egl_gallium.so and multiple
st_<API>.so and pipe_<HW>.so.  When a display is initialized, the
corresponding pipe driver will be loaded.  When a context is created,
the corresponding state tracker will be loaded.

Unlike DRI drivers, no ABI compatibility is maintained.  egl_gallium,
pipe drivers and state trackers should always be distributed as a single
package.  As such, there is only a single src/gallium/targets/egl/ that
builds everything for the package.
2010-06-29 17:16:20 +08:00
Chia-I Wu ea05299ce5 st/egl: One driver per hardware.
Merge multiple egl_<platform>_<pipe>.so into a single
egl_gallium_<pipe>.so.  The environment variable EGL_PLATFORM is now
used to modify the return value of _eglGetNativePlatform.
2010-06-29 17:16:19 +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 da39d5d3b4 egl: s/EGL_DISPLAY/EGL_PLATFORM/.
A platform is already used to mean a window system in EGL.  No need to
use a different term.
2010-06-17 16:30:26 +08:00
Chia-I Wu 6f690caddc egl: s/_EGL_PLATFORM/_EGL_OS/ and s/POSIX/UNIX/.
A platform means a native window system in EGL.  Use OS that follows
Gallium instead.
2010-06-17 16:05:18 +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
Chia-I Wu ba26631d0d Define PUBLIC to dllexport on MSVC.
Define PUBLIC to __declspec(dllexport) when _MVC_VER is defined.
2010-05-31 11:31:07 +08:00
Chia-I Wu d2cb999045 Always define int32_t in compiler headers.
eglplatform.h no longer defines int32_t.
2010-05-31 11:00:01 +08:00
Kristian Høgsberg 6e9da8ab60 egl: Return NULL if we fail to load a default driver 2010-05-27 09:59:27 -04:00
Kristian Høgsberg 5dc0f49084 egl: Implement EGL_NOK_texture_from_pixmap
This extension allows a color buffer to be used for both rendering and
texturing.  EGL allows the use of color buffers of pbuffer drawables
for texturing, this extension extends this to allow the use of color
buffers of pixmaps too.
2010-05-14 14:47:54 -04:00
Kristian Høgsberg 554e4fc26a egl: Only allow valid config attributes in _eglParseConfigAttribList()
Passing 0x3030, 0 in the chooser list didn't get caught.
2010-05-14 14:47:54 -04: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
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
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 5541988578 egl: Add support for driver built-in.
This allows an EGL driver to be compiled together with libEGL.so.  It
eliminates the need to specify a driver, or support module loading on
new platforms.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-10-13 12:00:36 -06:00
Chia-I Wu d845f2754b egl: Add support for querying render buffer.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-09-29 08:10:48 -06:00
Chia-I Wu 55893b9439 egl: Add a function to convert __GLcontextModes to _EGLConfig.
_eglConfigFromContextModesRec is used to convert a __GLcontextModes to a
_EGLConfig.  Note that the config is not validated.  An invalid mode
is likely to give an invalid config.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-09-29 08:10:47 -06:00
Chia-I Wu 56822b0812 egl: Rework config lookup.
Make it similiar to how contexts and surfaces are looked up.  It should
be slightly faster, and work better with multiple displays.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-09-29 08:10:47 -06:00
Chia-I Wu 95cdd697e7 egl: Rework configuration management.
This mainly implements the algorithms for configuration selection and
sorting, described in the spec.  User errors should also be correctly
detected and reported.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-09-29 08:10:47 -06:00
Chia-I Wu 358c5a8fd1 egl: Introduce config keys.
Config keys are almost config attributes.  A valid config attribute is a
valid config key, but a valid config key may not be a valid config
attribute.

This commit does not distinguish the differences.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-09-29 08:10:47 -06:00
Chia-I Wu e1d978775f egl: Remove Xdpy from EGLDisplay.
It is not used anymore.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-26 16:40:22 -06:00
Chia-I Wu b1f156f0ec egl: Make _eglChooseDriver return the filename of the driver.
The real difference is that the driver suffix is now appended.  This
also fixes an annoying bug that EGL_DRIVER could not specify the path to
a driver because a suffix was always appended.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu 5a459d58fc egl: Remove dependency on libX11.
libX11 is used to determine the screen number, which is in turned used
to determine the DRI driver.  However, the sysfs interface for
determining the DRI driver is gone, and no working driver depends on
this mechanism.

Display string parsing is moved to a new function,
_eglSplitDisplayString.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu 408db29792 egl: Check for null display in handle checking.
The display may be NULL when checking a handle.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-21 08:34:34 -06:00
Chia-I Wu 34d8c13bff egl: Remove eglhash.c and eglhash.h.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:50:12 -06:00
Chia-I Wu e484a92928 egl: Add back handle checking.
Handle checking was done using hash tables.  Now that they are gone, we
have to loop over the lists.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
2009-08-18 08:50:06 -06:00
Chia-I Wu e3734e4685 egl: Make lookup functions static inline.
progs/egl/demo3.c is also changed since it uses an internal function.

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