Commit Graph

75 Commits

Author SHA1 Message Date
Eric Engestrom 7adb9b0948 egl/display: remove unnecessary code and make it easier to read
Remove the two first level `if` as they will always be true, and
flatten the two remaining `if`.
No functional change.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2016-07-07 11:13:13 -07:00
Marek Olšák 8c361e84ad Revert "egl: Check if API is supported when using eglBindAPI."
This reverts commit e8b38ca202.

It broke Glamor for Gallium at least.
2016-06-03 11:33:45 +02:00
Plamena Manolova e8b38ca202 egl: Check if API is supported when using eglBindAPI.
According to the EGL specifications before binding an API
we must check whether it's supported first. If not eglBindAPI
should return EGL_FALSE and generate a EGL_BAD_PARAMETER error.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-06-02 07:45:19 -07:00
Emil Velikov d62879565a egl: remove _EGL_PLATFORM_WINDOWS enum
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-07-22 16:35:26 +01:00
Emil Velikov 32debea337 egl: remove final references of platform_null
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-07-22 16:35:26 +01:00
Haixia Shi 6b8accb36b egl/dri2: implement platform_surfaceless
The surfaceless platform is for off-screen rendering only. Render node support
is required.

Only consider the render nodes. Do not use normal nodes as they require
auth hooks.

v3: change platform_null to platform_surfaceless
v4: make libdrm required for surfaceless
v5: remove modified include guards with defined(HAVE_SURFACELESS_PLATFORM)
v6: use O_CLOEXEC for drm fd

Signed-off-by: Haixia Shi <hshi@chromium.org>
Signed-off-by: Zach Reizner <zachr@google.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2015-06-16 13:55:26 -07:00
Emil Velikov 0d6e7620f3 egl/main: drop platform fbdev specific code
st/egl was the only one which had support for this platform.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
2015-03-21 17:16:41 +00: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
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 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
Chia-I Wu 4695f64895 egl: clarify what _eglInitResource does
It is a helper called from the initializers of its subclasses.
2014-02-19 13:08:54 +08: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
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
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
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 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 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
Benjamin Franzke e586c4b763 egl: Add wayland platform 2011-02-07 13:52:29 +01: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 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 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 6717a313f2 egl: Store configs in a dynamic array. 2010-06-30 18:32:48 +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 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 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 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
Vinson Lee 19af9ea792 egl: Remove unnecessary headers. 2010-01-31 21:56:53 -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 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 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 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 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 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 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 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