summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
Commit message (Collapse)AuthorAgeFilesLines
* egl: Fix crashes in eglCreate*Surface()Chad Versace2016-12-161-2/+2
| | | | | | | | | | | | | | Don't dereference a null EGLDisplay. Fixes tests dEQP-EGL.functional.negative_api.create_pbuffer_surface dEQP-EGL.functional.negative_api.create_pixmap_surface Reviewed-by: Mark Janes <mark.a.janes@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99038 Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 5e97b8f5ce975dfb66cc46e6b4cc1e89eb8c1dc0)
* egl: make interop ABI visible againMarek Olšák2016-11-091-2/+2
| | | | | | | | | | This was broken when the GLAPI use was removed from mesa_glinterop.h. Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit ee39d4456e7551b257343551d59e7c6a3388fdc0)
* egl: add check that eglCreateContext gets a valid configTapani Pälli2016-10-271-1/+3
| | | | | | | | | | | | | | Fixes following dEQP test: dEQP-EGL.functional.negative_api.create_context v2: don't break EGL_KHR_no_config_context (Eric Engestrom) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 5876f3c85a61d73bb4863331bd641152a40a7b0c)
* egl: Implement EGL_MESA_platform_surfacelessChad Versace2016-10-141-1/+41
| | | | Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: add eglSwapBuffersWithDamageKHREric Engestrom2016-10-111-6/+26
| | | | | | | | | | | EGL_KHR_swap_buffers_with_damage is actually already supported, as it is technically nothing but a rename of EGL_EXT_swap_buffers_with_damage. To that effect, both extension are advertised depending on the same condition, and the new entrypoint simply redirects to the previous one. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Unify the EGLint/EGLAttrib paths in eglCreateSync* (v3)Chad Versace2016-10-101-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Pre-patch, there were two code paths for parsing EGLSync attribute lists: one path for old-style EGLint lists, used by eglCreateSyncKHR, and another for new-style EGLAttrib lists, used by eglCreateSync (1.5) and eglCreateSync64 (EGL_KHR_cl_event2). There were two attrib_list parsing functions, _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) _eglParseSyncAttribList64(_EGLSync *sync, const EGLattrib *attrib_list) This patch unifies the two attrib_list parsing functions into one, _eglParseSyncAttribList(_EGLSync *sync, const EGLattrib *attrib_list) Many internal EGLSync function signatures had *two* attrib_list parameters to accomodate both code paths: one parameter was an EGLint list and other an EGLAttrib list. At most one of the parameters was allowed to be non-null. This patch removes the `EGLint *attrib_list` parameter, leaving only the `EGLAttrib *attrib_list` parameter, for all internal EGLSync functions. v2: - Consistently use condition (sizeof(int_list[0]) == sizeof(attrib_list[0])). [for emil] v3: - Don't double-unlock the display in eglCreateSyncKHR. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v2)
* egl: Implement EGL_KHR_debug (v2)Kyle Brenneman2016-10-051-0/+145
| | | | | | | | | | | | | | | | Wire up the debug entrypoints to EGL dispatch, and add the extension string to the client extension list. v2: - Lots of style fixes - Fix missing EGLAPIENTRYs - Factor out valid attribute check - Lock display in eglLabelObjectKHR as needed, and use RETURN_EGL_* - Move "EGL_KHR_debug" into asciibetical order in client extension string Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.veliko@collabora.com>
* egl: Track EGL_KHR_debug state when going through EGL API calls (v3)Kyle Brenneman2016-10-051-9/+142
| | | | | | | | | | | | | | | | | | | | | | This decorates every EGL entrypoint with _EGL_FUNC_START, which records the function name and primary dispatch object label in the current thread state. It also adds debug report functions and calls them when appropriate. This would be useful enough for debugging on its own, if the user set a breakpoint when the report function was called. We will also need this state tracked in order to expose EGL_KHR_debug. v2: - Clear the object label in more cases in _eglSetFuncName - Pass draw surface (if any) to _EGL_FUNC_START in eglSwapInterval v3: - Set dummy thread's CurrentAPI to EGL_OPENGL_ES_API not zero - Less ?: in _eglSetFuncName Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.veliko@collabora.com>
* egl: Add _eglConvertIntsToAttribs()Chad Versace2016-10-041-0/+41
| | | | | | | This function converts an attribute list from EGLint[] to EGLAttrib[]. Will be used in following patches to cleanup EGLSync attribute parsing. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Fix an error path in eglCreateSync*Chad Versace2016-10-041-2/+12
| | | | | | | | | | When the user called eglCreateSync64KHR on a display without EGL_KHR_cl_event2 (the only extension that exposes it), we returned EGL_NO_SYNC but did not update the error code. We also did the same for eglCreateSync on a display without EGL 1.5. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Fix missing unlock in eglGetSyncAttribKHRChad Versace2016-10-041-1/+1
| | | | | | | | | | | On the error path, eglGetSyncAttribKHR neglected to unlock the EGLDisplay before returning. Fixes deadlock in dEQP-EGL.functional.fence_sync.invalid.get_invalid_value. Cc: mesa-stable@lists.freedesktop.org Cc: Mark Janes <mark.a.janes@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Factor out _eglGetSyncAttribCommonKyle Brenneman2016-09-141-5/+13
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Factor out _eglWaitSyncCommonKyle Brenneman2016-09-141-5/+13
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Lock the display in _eglCreateSync's callersKyle Brenneman2016-09-141-6/+8
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Factor out _eglCreateImageCommon (v2)Kyle Brenneman2016-09-141-5/+13
| | | | | | | | v2: - Pass disp to RETURN_EGL_ERROR so we unlock the display Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Factor out _eglWaitClientCommonKyle Brenneman2016-09-141-3/+8
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Use _eglCreatePixmapSurfaceCommon consistentlyKyle Brenneman2016-09-141-15/+21
| | | | | | | | This moves the native pixmap fixup to a helper function so we don't repeat ourselves. Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Use _eglCreateWindowSurfaceCommon consistentlyKyle Brenneman2016-09-141-10/+18
| | | | | | | | This moves the native window fixup to a helper function so we don't repeat ourselves. Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Factor out _eglGetPlatformDisplayCommonKyle Brenneman2016-09-141-5/+13
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Rename MESA_configless_context bit to KHR_no_config_contextAdam Jackson2016-09-121-2/+4
| | | | | | | | | Keep the old name in the extension string, but refer to the KHR extension internally. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
* EGL: Combine the GL and GLES current contexts (v2)Kyle Brenneman2016-09-071-30/+12
| | | | | | | | | | | | | | | | | | | | | | Only keep track of a single current context, instead of separate contexts for GL and GLES. In EGL 1.4 (and 1.5), EGL_OPENGL_API and EGL_OPENGL_ES_API are supposed to be interchangeable for all purposes except for eglCreateContext. The _EGLThreadInfo::CurrentContexts array is now a single pointer to the current context, which may be a GL or GLES context. In addition, it now keeps track of the current API as an enum instead of an index. eglMakeCurrent will now replace the current context, regardless of which client API is used for for the current and new contexts. It no longer checks for a conflicting context. In addition, calling eglMakeCurrent with EGL_NO_CONTEXT will now release the current context regardless of the current API. v2: Rebased against master (Adam Jackson) Reviewed-by: Adam Jackson <ajax@redhat.com>
* Revert "egl: Check if API is supported when using eglBindAPI."Marek Olšák2016-06-031-65/+0
| | | | | | This reverts commit e8b38ca202fbe8c281aeb81a4b64256983f185e0. It broke Glamor for Gallium at least.
* egl: Check if API is supported when using eglBindAPI.Plamena Manolova2016-06-021-0/+65
| | | | | | | | | 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>
* mesa_glinterop: remove mesa_glinterop typedefsEmil Velikov2016-05-301-3/+3
| | | | | | | | | | | | | | | | As is there are two places that do the typedefs - dri_interface.h and this header. As we cannot include the former in here, just drop the typedefs and use the struct directly (as needed). This is required because typedef redefinition is C11 feature which is not supported on all the versions of GCC used to build mesa. v2: Kill the typedef alltogether, as per Marek. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96236 Cc: Vinson Lee <vlee@freedesktop.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa_glinterop: make GL interop version field bidirectionalEmil Velikov2016-05-241-1/+1
| | | | | | | | | | | | | | This allows clear and easy communication between the two. Caller: Requesting information (struct vN) Callee: I know how to deal with older version (vN-1) only. Here is your data and the version I support. Caller: Older version ? Sure I'll cap all access to the fields provided by the older version (vN-1) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* mesa_glinterop: remove unneeded GLAPI/GLAPIENTRY/APIENTRYP symbolsEmil Velikov2016-05-241-2/+2
| | | | | | | | | | | | | | | | These come from windows.h, gl.h, glcorearb.h and/or glext.h. The interop interface is aimed at non-Windows platforms while the macros are used/derived due to Windows specifics. Thus we can safely remove them. Strictly speaking there should be GLXAPIENTRY/EGLAPIENTRY and alike macros, although a) there is no GLX ones and b) this brings us even further from decoupling the file from the GLX/EGL header dependency. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* egl: Add OpenGL_ES to API string regardless of GLES versionPlamena Manolova2016-05-231-7/+4
| | | | | | | | | | | | | | | | | According to the EGL specifications eglQueryString(EGL_CLIENT_APIS) should return a string containing a combination of "OpenGL", "OpenGL_ES" and "OpenVG", any other values would be considered invalid. Due to this when the API string is constructed, the version of GLES should be disregarded and "OpenGL_ES" should be attached once instead of "OpenGL_ES2" and "OpenGL_ES3". Fixes: dEQP-EGL.functional.negative_api* and dEQP-EGL.functional.query_context.simple.query_api Signed-off-by: Plamena Manolova <plamena.manolova@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
* egl: implement EGL part of interop interface (v2)Marek Olšák2016-04-201-0/+72
| | | | v2: - use const
* egl: add EGL_KHR_reusable_sync to egl_driDongwon Kim2016-04-051-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables an EGL extension, EGL_KHR_reusable_sync. This new extension basically provides a way for multiple APIs or threads to be excuted synchronously via a "reusable sync" primitive shared by those threads/API calls. This was implemented based on the specification at https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_reusable_sync.txt v2 - use thread functions defined in C11/threads.h instead of using direct pthread calls - make the timeout set with reference to CLOCK_MONOTONIC - cleaned up the way expiration time is calculated - (bug fix) in dri2_client_wait_sync, case EGL_SYNC_CL_EVENT_KHR has been added. - (bug fix) in dri2_destroy_sync, return from cond_broadcast call is now stored in 'err' intead of 'ret' to prevent 'ret' from being reset to 'EGL_FALSE' even in successful case - corrected minor syntax problems v3 - dri2_egl_unref_sync now became 'void' type. No more error check is needed for this function call as a result. - (bug fix) resolved issue with duplicated unlocking of display in eglClientWaitSync when type of sync is "EGL_KHR_REUSABLE_SYNC" Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
* egl: Add EGL_RECORDABLE_ANDROID attributeRob Herring2016-04-011-0/+1
| | | | | | | | | | This is used by Android to select an eglconfig compatible with screen recording. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Rob Herring <robh@kernel.org> [Emil Velikov: add the _eglIsConfigAttribValid check] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Add EGL_FRAMEBUFFER_TARGET_ANDROID attributeRob Herring2016-04-011-0/+1
| | | | | | | | | This is used by Android to select an eglconfig compatible with HWComposer. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Rob Herring <robh@kernel.org> [Emil Velikov: add the _eglIsConfigAttribValid check] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl: remove remnants of MESA_drm_displayEmil Velikov2016-03-091-9/+0
| | | | | | | Last set in st/egl, unused in mesa-demos and superseded by EGL_KHR_platform_gbm. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* egl: remove final pieces of KHR_vg_parent_imageEmil Velikov2016-03-091-1/+0
| | | | | | Similar to previous commit - unused/unset for a long time. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* egl: move Null check to eglGetSyncAttribKHR to prevent SegfaultDongwon Kim2016-02-191-2/+8
| | | | | | | | | | | | | | Null-check on "*value" is currently done in _eglGetSyncAttrib, which is after eglGetSyncAttribKHR dereferences it. Move the check a layer up (in the beginning of eglGetSyncAttribKHR) to avoid segfaults. Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> [Emil Velikov: tweak commit message, add stable tag] Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: remove ifdef $(egl_extension) compile guardsEmil Velikov2015-08-011-35/+1
| | | | | | All of these are already defined in the headers provided. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* egl: remove custom string functionsEmil Velikov2015-07-221-2/+1
| | | | | | | | Support for Windows has been removed for a while now, and virtually every POSIX compliant system provides strcasecmp, strdup and snprintf. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* egl: sort extension lists alphabeticallyMarek Olšák2015-07-031-27/+26
| | | | and add the missing KHR_gl_colorspace case.
* egl: expose EGL 1.5 if all requirements are metMarek Olšák2015-06-051-0/+15
| | | | | | | | There's no driver support yet, because EGL_KHR_gl_colorspace isn't implemented. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: return correct invalid-type error from eglCreateSyncMarek Olšák2015-06-051-8/+19
| | | | | Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: add new platform functions (v2)Marek Olšák2015-06-051-0/+54
| | | | | | | | These are just wrappers around the existing extension functions. v2: return BAD_ALLOC if _eglConvertAttribsToInt fails Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: add eglCreateImage (v2)Marek Olšák2015-06-051-0/+42
| | | | | | | v2: - use calloc - return BAD_ALLOC if calloc fails Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: add eglGetSyncAttrib (v2)Marek Olšák2015-06-051-3/+22
| | | | | | | | | v2: - don't modify "value" in eglGetSyncAttribKHR after an error - rename _egl_api::GetSyncAttribKHR -> GetSyncAttrib - rename GetSyncAttribKHR_t -> GetSyncAttrib_t - rename _eglGetSyncAttribKHR to _eglGetSyncAttrib Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: add eglWaitSyncMarek Olšák2015-06-051-0/+12
| | | | | Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: add EGL 1.5 functions that don't need any changes from extensionsMarek Olšák2015-06-051-12/+16
| | | | | | | Declare the functions without the suffix, so that the core names are exported. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: use EGL 1.5 types without suffixesMarek Olšák2015-06-051-20/+20
| | | | | Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: combine VersionMajor and VersionMinor into one variableMarek Olšák2015-06-051-5/+4
| | | | | Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: set the EGL version in common codeMarek Olšák2015-06-051-0/+7
| | | | | Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl: remove remaining EGL_MESA_copy_context skeletonEmil Velikov2015-05-141-1/+0
| | | | | | | | | | With earlier commit (7a58262e58d egl: Remove skeleton implementation of EGL_MESA_screen_surface) we've removed the skeleton implementation of eglCopyContextMESA(). Just like EGL_MESA_screen_surface this extension was never implemented in mesa. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
* egl/main: fix EGL_KHR_get_all_proc_addressesEmil Velikov2015-05-141-3/+3
| | | | | | | | | | | | | | | | The extension requires that the address of the core functions should be available via eglGetProcAddress. Currently the list is guarded by _EGL_GET_CORE_ADDRESSES, which was only set for the scons (windows) build. Unconditionally enable it for all the builds (automake, android and haiku) considering that the extension is not platform specific and is always enabled. v2: Drop the _EGL_GET_CORE_ADDRESSES macro altogether. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* egl: more define fixes for EGL_MESA_image_dma_buf_exportMarc-André Lureau2015-05-141-1/+1
| | | | | | s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by the spec Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Chad Versace <chad.versace@intel.com>