summaryrefslogtreecommitdiffstats
path: root/src/egl/main
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: use util/macros.hMarek Olšák2016-11-091-3/+2
| | | | | | | | | | I need the definition of PUBLIC. 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 bf51b45313c7cc5ca792401f0cc29574aa9122cf)
* egl: set preserved behavior for surface only if config supports itTapani Pälli2016-10-271-1/+5
| | | | | | | | | | | | | | | Otherwise we can end up with mismatching behavior between config and surface when client queries surface attributes. As example, configs for DRI3 do not support preserved behavior but here we were setting preserved behavior for pixmap and pbuffer. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326 Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Chad Versace <chadversary@chromium.org> Tested-by: Mark Janes <mark.a.janes@intel.com> (cherry picked from commit 2035930966b05a7c4dd1f6559d66b5a3b41e01a5)
* 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-144-1/+70
| | | | Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Don't advertise unsupported platform extensionsChad Versace2016-10-141-2/+8
| | | | | | | | | | | | | Mesa's set of supported platform extensions depends on the autoconf option --with-egl-platforms=foo,bar,baz. If --with-egl-platforms lacks foo, then eglGetPlatformDisplay(EGL_PLATFORM_FOO, ...) unconditonally fails. So, if --with-egl-platforms lacks foo, then remove EGL_VENDOR_platform_foo from the EGL client extension string. Cc: mesa-stable@lists.freedesktop.org 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-104-48/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-052-0/+146
| | | | | | | | | | | | | | | | 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-054-12/+257
| | | | | | | | | | | | | | | | | | | | | | 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: Drop duplicate check on EGLSync typeChad Versace2016-10-041-6/+0
| | | | | | | | | | _eglInitSync checked that the display supported the sync type (such as EGL_SYNC_FENCE), and did it wrong. When the check failed it emitted EGL_BAD_ATTRIBUTE, but sometimes EGL_BAD_PARAMETER is needed. _eglCreateSync already does the error checking, and it does it right. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Cleanup control flow in _eglParseSyncAttribListChad Versace2016-10-041-6/+8
| | | | | | | | | | When the function encountered an error, it effectively returned immediately. However, it did so indirectly by breaking out of a loop. Replace the loop breakout with a explicit 'return'. Do the same for _eglParseSyncAttribList64 too. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Add _eglConvertIntsToAttribs()Chad Versace2016-10-042-0/+43
| | | | | | | 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 truncation error in _eglParseSyncAttribList64Chad Versace2016-10-041-3/+4
| | | | | | | | The function stores EGLAttrib values in EGLint variables. On 64-bit systems, this truncated the values. Cc: mesa-stable@lists.freedesktop.org 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: Add storage for EGL_KHR_debug's state to EGL objectsKyle Brenneman2016-09-145-3/+27
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.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: Fix typoKyle Brenneman2016-09-141-1/+1
| | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Tear down images and syncs at eglTerminateAdam Jackson2016-09-141-0/+22
| | | | | Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
* egl: Rename MESA_configless_context bit to KHR_no_config_contextAdam Jackson2016-09-123-5/+7
| | | | | | | | | 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: QueryContext on a configless context returns zeroAdam Jackson2016-09-121-3/+8
| | | | | | | | | | | | MESA_configless_context does not specify the interaction with QueryContext at all, and the code to generate an error in this case predates the Mesa extension. Since EGL_NO_CONFIG_{KHR,MESA} are numerically identical there's no way to distinguish which one the application asked for, so use the KHR behaviour. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
* egl: fix gcc warning braces around scalar initializerTimothy Arceri2016-09-121-1/+1
| | | | Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
* egl: Fix up indentation on previous commitAdam Jackson2016-09-081-2/+2
| | | | | | This was requested in review but I pushed the wrong version. Signed-off-by: Adam Jackson <ajax@redhat.com>
* egl: Document why EGL_OPENGL{, _ES}_API are mostly identicalAdam Jackson2016-09-081-0/+10
| | | | | Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
* EGL: Combine the GL and GLES current contexts (v2)Kyle Brenneman2016-09-074-107/+22
| | | | | | | | | | | | | | | | | | | | | | 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>
* egl: treat EGL_OPENGL_API as invalid on AndroidEmil Velikov2016-08-301-1/+7
| | | | | | | | At the moment one can use OpenGL in eglBindAPI() only to clear the EGL_OPENGL_BIT from RenderableType and Conformant for _each_ config. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
* egl: turn a couple asserts static (compile-time)Eric Engestrom2016-08-241-3/+4
| | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Fix the bad surface attributes combination checking for pbuffers. (v3)Guillaume Charifi2016-07-071-21/+15
| | | | | | | | | | | | | | | | | Fixes a regression induced by commit a0674ce5c41903ccd161e89abb149621bfbc40d2: When EGL_TEXTURE_FORMAT and EGL_TEXTURE_TARGET were both specified (and both != EGL_NO_TEXTURE), an error was instantly triggered, before the other one had even a chance to be checked, which is obviously not the intended behaviour. v2: Full commit hash, remove useless variables. v3: [chadv] Add Fixes footers. Fixes: piglit "spec/egl 1.4/eglcreatepbuffersurface and then glclear" Fixes: piglit "spec/egl 1.4/largest possible eglcreatepbuffersurface and then glclear" Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* egl/display: remove unnecessary code and make it easier to readEric Engestrom2016-07-071-15/+14
| | | | | | | | | 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>
* Revert "egl: Check if API is supported when using eglBindAPI."Marek Olšák2016-06-034-72/+10
| | | | | | This reverts commit e8b38ca202fbe8c281aeb81a4b64256983f185e0. It broke Glamor for Gallium at least.
* egl: Account for default values of texture target and formatPlamena Manolova2016-06-021-0/+6
| | | | | | | | | | When validating attributes during surface creation we should account for the default values of texture target and format (EGL_NO_TEXTURE) since the user is not obligated to explicitly set both via the attribute list passed to eglCreatePbufferSurface. Signed-off-by: Plamena Manolova <plamena.manolova@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* egl: Check if API is supported when using eglBindAPI.Plamena Manolova2016-06-024-10/+72
| | | | | | | | | 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-302-9/+9
| | | | | | | | | | | | | | | | 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>
* egl: Additional attribute validation for eglCreatePbufferSurfacePlamena Manolova2016-05-261-0/+13
| | | | | | | | | | | | | eglCreatePbufferSurface should generate an EGL_BAD_MATCH error if: 1: The EGL_TEXTURE_FORMAT attribute is EGL_NO_TEXTURE and EGL_TEXTURE_TARGET is something other than EGL_NO_TEXTURE 2: EGL_TEXTURE_FORMAT is something other than EGL_NO_TEXTURE and EGL_TEXTURE_TARGET is EGL_NO_TEXTURE. This fixes the dEQP-EGL.functional.negative_api.create_pbuffer_surface test. Signed-off-by: Plamena Manolova <plamena.manolova@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
* mesa_glinterop: make GL interop version field bidirectionalEmil Velikov2016-05-242-2/+2
| | | | | | | | | | | | | | 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-202-0/+81
| | | | v2: - use const
* egl: add EGL_KHR_reusable_sync to egl_driDongwon Kim2016-04-052-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-014-0/+9
| | | | | | | | | | 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-014-1/+10
| | | | | | | | | 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>