summaryrefslogtreecommitdiffstats
path: root/src/egl
Commit message (Collapse)AuthorAgeFilesLines
...
* egl/surfaceless: trivial coding style fixesEmil Velikov2016-10-142-5/+1
| | | | | | | | | Remove a few gratious blank lines and use the correct level of indentation. Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/surfaceless: don't check the mask(s) prior to calling dri2_add_configEmil Velikov2016-10-141-20/+3
| | | | | | | | | | | The latter already does it for us. As we're here annotate the masks as const and use unsigned for the index(es). Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/surfaceless: remove unused dri2_loader_extension implementationEmil Velikov2016-10-141-33/+0
| | | | | | | | | Earlier commit introduced support for image_loader and left the dri2_loader code dangling/unused. Let's remove it. Fixes: 63c5d5c6c46 ("Added pbuffer hooks for surfaceless platform") Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* egl/android: don't populate dri2_dpy->dri2_loader_extensionEmil Velikov2016-10-142-7/+17
| | | | | | | | The extension stored in struct dri2_egl_display isn't used, thus we can create a static const instance of the extension and point extensions[] to it. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: rework dri2_make_current code flowEmil Velikov2016-10-141-36/+36
| | | | | | | | Fold duplicate conditional blocks and add a few extra comments ;-) v2: Bring back the explicit "unbind" logic (Eric), remove NULL derefs. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: drop NULL checks prior to dri2_destroy_surfaceEmil Velikov2016-10-141-4/+2
| | | | | | The function already have the respective check within. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: call static functions directly, not via _EGLDriver::APIEmil Velikov2016-10-141-14/+14
| | | | | | | | | | | The indirection is meant to be used by the core EGL implementation in main. Not in the drivers themselves. Move the dri2_destroy_surface definition to avoid forward declaration of the static function. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: use dri2_egl_display inline wrapper where possibleEmil Velikov2016-10-141-9/+6
| | | | | | | | This way the only places that reference DriverData are the ones that manipulate it. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: bail out on NULL dpy in dri2_display_release()Emil Velikov2016-10-141-1/+6
| | | | | | | | Currently all callers are careful enough not to do that, yet that will not be the case in the future. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: move surface refcounting out of the platform codeEmil Velikov2016-10-147-18/+4
| | | | | | | | All the platforms are duplicating what should be a driver/dri2 thing - refcounting. Just fold it accordingly. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: coding style fixEmil Velikov2016-10-141-1/+2
| | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: non-shared glapi cleanupsEmil Velikov2016-10-141-14/+17
| | | | | | | | | For a while now we require shared glapi for EGL, thus we can drop a few bits from the olden days. Namely - dlopen(NULL...) is not possible, error out at build stage if so and drop the guard around dlclose(). Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: glFlush is not optional, treat it as suchEmil Velikov2016-10-141-3/+8
| | | | | | | | | | The documentation is clear - one must glFlush the old context on eglMakeCurrent. Thus keeping it optional is not something we should be doing. Furthermore if we cannot get the entry point we're likely having a broken setup/stack. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.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-105-52/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* loader/dri3: add get_dri_screen() to the vtableMartin Peres2016-10-071-0/+12
| | | | | | | | | This allows querying the current active screen from the loader's common code. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
* 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/android: replace call to dup(2) with fcntl(F_DUPFD_CLOEXEC)Matt Whitlock2016-10-041-1/+2
| | | | | | | | | | Without this fix, duplicated file descriptors leak into child processes. See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance where the same fix was employed. Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Matt Whitlock <freedesktop@mattwhitlock.name> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* egl: stop claiming support for pbuffer + msaaTapani Pälli2016-10-031-0/+9
| | | | | | | | | | | | | | | | | | | This fixes a crash in egl-create-msaa-pbuffer-surface Piglit test and same crash in many dEQP EGL tests. I also found that some Qt example did a workaround because of this crash: https://bugreports.qt.io/browse/QTBUG-47509 v2: Ian pointed out that v1 removed support for all multisample configs, including window ones. This one removes pbuffer bit when adding configs, now only pbuffer+msaa gets rejected and window+msaa continues to work. Fixed also comment (Emil) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* egl: return corresponding offset of EGLImage instead of 0.Chuanbo Weng2016-09-211-2/+9
| | | | | | | | | | | | | | | | | | The offset should not always be 0. For example, if EGLImage is created from a 2D texture with EGL_GL_TEXTURE_LEVEL=1, then the offset should be the actual start of miplevel 1 in bo. v2: Add version check of __DRIimageExtension implementation (Suggested by Axel Davy). v3: Don't add version check of __DRIimageExtension implementation. Set the offset only when queryImage() succeeds. (Suggested by Emil Velikov) Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [Emil Velikov: coding style fixes] Signed-off-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-124-6/+8
| | | | | | | | | 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/android: Set EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHTHaixia Shi2016-09-091-0/+2
| | | | | | | | | | | | Set config attributes EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHT to hard-coded non-zero values. These two attributes are required on Android. v2: use _EGL_MAX_PBUFFER_WIDTH/HEIGHT from egldefines.h (based on discussion on the first version) Signed-off-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.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>
* gbm: wire up fence extensionRob Clark2016-09-071-0/+1
| | | | | | | | v2: make fence extension optional to not break non-i965 classic drivers, and move __DRI2_FENCE into core extensions, based on comments from Emil Signed-off-by: Rob Clark <robdclark@gmail.com>
* wayland-drm: add missing NULL checkFrank Binns2016-09-011-0/+2
| | | | | | | | Although malloc is unlikely to fail check its return value nevertheless. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: only store device name when Wayland support is builtFrank Binns2016-09-015-18/+24
| | | | | | | | The device name is only needed for WL_bind_wayland_display so make this clear by only storing the device name when Wayland support is built. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* Introduce .editorconfigEric Engestrom2016-08-312-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | A few weeks ago, Jose Fonseca suggested [0] we use .editorconfig files to try and enforce the formatting of the code, to which Michel Dänzer suggested [1] we start by importing the existing .dir-locals.el settings. The first draft was discussed in the RFC [2]. These .editorconfig are a first step, one that has the advantage of requiring little to no intervention from the devs once the settings files are in place, but the settings are very limited. This does have the advantage of applying while the code is being written. This doesn't replace the need for more comprehensive formatting tools such as clang-format & clang-tidy, but those reformat the code after the fact. [0] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121545.html [1] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121639.html [2] https://lists.freedesktop.org/archives/mesa-dev/2016-July/123431.html Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* egl/x11_dri3: provide an authentication functionFrank Binns2016-08-311-1/+18
| | | | | | | | | | | To support WL_bind_wayland_display an authentication function needs to be provided but this was not being done for this platform as it's not strictly necessary. However, as this isn't an optional function there's the potential for a segfault to occur if authentication is mistakenly performed. Protect against this by providing a function that prints an error. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Axel Davy <axel.davy@ens.fr>