summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
Commit message (Collapse)AuthorAgeFilesLines
* egl: Check for NULL native_window in eglCreateWindowSurfaceSinclair Yeh2014-06-031-0/+4
| | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: "10.1 10.2" <[email protected]>
* egl/main: Fix eglMakeCurrent when releasing context from current thread.Beren Minor2014-06-021-2/+6
| | | | | | | | | | | | | | 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" <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Add EGL_CHROMIUM_sync_control extension.Sarah Sharp2014-05-201-0/+23
| | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Cc: Jamey Sharp <[email protected]> Cc: Ian Romanick <[email protected]> Cc: Stéphane Marchesin <[email protected]>
* egl/main: Enable Linux platform extensionsChad Versace2014-03-171-22/+110
| | | | | | | | | | | | | | | | 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 <[email protected]>
* egl/main: Stop using EGLNative types internallyChad Versace2014-03-171-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Add the EGL_MESA_configless_context extensionNeil Roberts2014-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* eglCreateContext: Remove the check for whether config == 0Neil Roberts2014-03-121-5/+2
| | | | | | | | | | | | | | | | 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 b90a3e7d8b1bc 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 <[email protected]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # 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 <[email protected]>
* wayland: Add an extension to create wl_buffers from EGLImagesNeil Roberts2013-12-041-0/+25
| | | | | | | | | | | | | | | | | | 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.
* egl: Enable EGL_EXT_client_extensionsChad Versace2013-11-261-1/+7
| | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* egl: Update to Wayland 1.2 server APIAnder Conselvan de Oliveira2013-08-071-1/+1
| | | | | | | | | | 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 <[email protected]>
* egl: definitions for EXT_image_dma_buf_importTopi Pohjolainen2013-08-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Add extension infrastructure for EGL_EXT_swap_buffers_with_damageRobert Bragg2013-05-071-0/+32
| | | | | Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* egl: Replace KHR_surfaceless_* extensions with KHR_surfaceless_contextIan Romanick2012-08-061-6/+2
| | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Add EGL_WAYLAND_PLANE_WL attributeKristian Høgsberg2012-07-111-0/+20
| | | | | | | This lets us specify the plane to create the image for for multiplanar wl_buffers. Signed-off-by: Kristian Høgsberg <[email protected]>
* egl: add EGL_NV_post_sub_bufferFredrik Höglund2011-12-201-0/+21
| | | | | | | | | v2: Handle EGL_POST_SUB_BUFFER_SUPPORTED_NV in _eglParseSurfaceAttribList() Signed-off-by: Fredrik Höglund <[email protected]> [olv: remove #ifdef checks]
* egl: KHR_reusable_sync entrypoints are missing from eglGetProcAddressChia-I Wu2011-12-201-0/+5
|
* egl: remove #ifdef's for official extensionsChia-I Wu2011-12-201-30/+0
| | | | | | | 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.
* egl: remove EGL_ANDROID_swap_rectangleChia-I Wu2011-12-201-25/+0
| | | | | We never support this unofficial extension, and it has been removed from Android recently. There is no point in keeping it.
* egl: add Android-specific extensionsChia-I Wu2011-08-211-0/+25
| | | | | | | | Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle. There is no spec for them though. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Native Display autodetectionBenjamin Franzke2011-08-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* egl: add copyright noticesChia-I Wu2011-07-021-0/+30
| | | | | The list of copyright holders could be incomplete. Please update directly or notify me if your name is missing.
* egl: Fix int <-> ptr casts.José Fonseca2011-05-121-1/+1
| | | | Based on zhigang gong <[email protected]>'s patch.
* egl: Use the right extension name in #ifdefKristian Høgsberg2011-04-251-1/+1
|
* egl: Add EGL_WL_bind_wayland_displayBenjamin Franzke2011-03-011-0/+44
|
* egl: Cleanup _EGLDisplay initialization.Chia-I Wu2011-01-131-6/+3
| | | | | Reorder/rename and document the fields that should be set by the driver during initialization. Drop the major/minor arguments from drv->API.Initialize.
* egl: Use reference counting to replace IsLinked or IsBound.Chia-I Wu2010-10-231-6/+11
| | | | | Remove all _egl<Res>IsLinked and _egl<Res>IsBound. Update _eglBindContext and drivers to do reference counting.
* egl: Drop dpy argument from the link functions.Chia-I Wu2010-10-231-9/+9
| | | | | All display resources are already initialized with a display. Linking simply links a resource to its display.
* egl: Check extensions.Chia-I Wu2010-09-301-11/+41
| | | | | Do not call into the driver if the extension for the called function is not enabled.
* egl: Use _EGL_CHECK_DISPLAY in eglCreateContext.Chia-I Wu2010-09-101-1/+1
| | | | | _EGL_CHECK_DISPLAY checks the display and returns from eglCreateContext on error.
* egl: Add EGL_MESA_drm_image extensionKristian Høgsberg2010-08-251-0/+43
| | | | Create EGLImages from DRM buffer handles.
* egl: Allow core functions to be queried.Chia-I Wu2010-08-201-1/+38
| | | | | When _EGL_GET_CORE_ADDRESSES is defined, eglGetProcAddress can be used to query core functions. This is non-standard, but some apps expect it.
* egl: Add support for EGL_KHR_reusable_sync.Chia-I Wu2010-08-171-0/+107
| | | | Individual drivers still need to support and enable the extension.
* egl: EGL_KHR_surfaceless_* extensionsKristian Høgsberg2010-07-281-1/+5
| | | | | | | | | 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.
* egl: Remove unnecessary headers.Vinson Lee2010-07-061-1/+0
|
* egl: Rework driver loading.Chia-I Wu2010-07-061-40/+8
| | | | | | | | | | | | | | | 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.
* egl: Always use EGLAPIENTRY in api function prototypesnobled2010-07-031-15/+15
| | | | Fixes the build on Windows.
* egl: Add support for EGL_MESA_drm_display.Chia-I Wu2010-06-231-0/+14
| | | | | | | 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.
* egl: Introduce platform displays internally.Chia-I Wu2010-06-231-1/+8
| | | | | | | | | | | 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.
* egl: Use SConscript for Windows build.Chia-I Wu2010-05-311-1/+3
| | | | Fix several portability issues and add SConscript for Windows build.
* egl: Silence uninitialized variable warnings.Vinson Lee2010-05-141-1/+1
|
* egl: Implement EGL_NOK_swap_regionKristian Høgsberg2010-05-131-0/+32
| | | | | | | | | 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.
* egl: Allow a prioritized list of default driversKristian Høgsberg2010-05-131-6/+8
| | | | | | | | | | | | | | 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.
* egl: Silence warnings in check/return macros.Chia-I Wu2010-02-191-139/+147
| | | | | | 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.
* egl: Always lock a display before using it.Chia-I Wu2010-02-171-45/+80
| | | | | | | 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.
* egl: Make eglGetDisplay atomic.Chia-I Wu2010-02-171-8/+2
| | | | | Merge _eglNewDisplay and _eglLinkDisplay into _eglFindDisplay. Remove unused _eglUnlinkDisplay.
* egl: eglGetError should return the status of the last call.Chia-I Wu2010-02-171-123/+226
| | | | | | 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.
* egl: Use new error checking macros.Chia-I Wu2010-02-171-115/+110
| | | | Replace all uses of _EGL_DECLARE_* and _eglCheck* by _EGL_CHECK_*.
* egl: Add new error checking macros.Chia-I Wu2010-02-171-94/+134
| | | | | | 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.
* egl: Clean up header inclusions.Chia-I Wu2010-01-301-0/+1
| | | | Mainly to remove eglcurrent.h and egldisplay.h from eglglobals.h.