summaryrefslogtreecommitdiffstats
path: root/src/egl
Commit message (Collapse)AuthorAgeFilesLines
* wayland-egl: fix wayland cflagsEric Engestrom2017-10-271-1/+1
| | | | | | | | Fixes: 80bfff5c4f1d4d8c842a0 "wayland-egl: adds CFLAGS for wayland.egl.h include" Suggested-by: Daniel Stone <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Emil Velikov <[email protected]> Acked-by: Tobias Klausmann <[email protected]>
* Android: egl: add dependency on libnativewindowRob Herring2017-10-261-0/+4
| | | | | | | | | | | system/window.h is no longer available by default and is part of libnativewindow, so add it to the shared libraries. It has to be conditional because the library is only present in O and later. Really, we should only be depending on vndk/window.h now, but that's only in O and changing would be pretty invasive. Signed-off-by: Rob Herring <[email protected]>
* meson: wayland-egl depends on wayland-clientDaniel Stone2017-10-261-0/+1
| | | | | | | | | | | | Since wayland-egl.h is currently provided by the core Wayland package, depend on wayland-client to make sure we get it in our include path. Signed-off-by: Daniel Stone <[email protected]> Acked-by: Emil Velikov <[email protected]> Fixes: 108d257a16 ("meson: build libEGL") Cc: Tobias Klausmann <[email protected]> Cc: Dylan Baker <[email protected]> Cc: Gert Wollny <[email protected]>
* meson: fix egl build for meson version < 0.43Dylan Baker2017-10-231-5/+4
| | | | | | | | | | | | | Meson 0.43 added the ability to pass nested lists to include_directories, so the code that we have works for 0.43, but not for 0.42. This patch changes the include_directories list to be flat so it works with 0.42 fixes: 108d257a16859898f5c ("meson: build libEGL") Tested-by: Vinson Lee <[email protected]> Reviewed-by: Rhys Kidd <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* meson: Add support for EGL glvndDylan Baker2017-10-201-2/+44
| | | | | | Signed-off-by: Dylan Baker <[email protected]> Tested-by: Eric Engestrom <[email protected]> Reviewed-by: Lyude Paul <[email protected]>
* meson: build libEGLDylan Baker2017-10-203-0/+200
| | | | | | | | | | | | | | | | | | This is based heavily on Daniel Stone's work for the same, rebased on master and with a number of TODO's fixed. This does not implement glvnd (which is coming in a later patch) Meson builds egl slightly differently than autotools, namely it doesn't build an intermediate shared library. It doesn't do this because meson doesn't have problems with the name of the library being dynamically generated, so the glvnd and non-glvnd code can follow the same path. v2: - Don't reuse variable (Eric E.) Signed-off-by: Dylan Baker <[email protected]> Tested-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* meson: move wayland_drm_protocol generation to wayland-drmDylan Baker2017-10-201-1/+13
| | | | | | | | | | | These files are needed by both vulkan wayland-wsi and by egl wayland-wsi, since the XML file is in src/egl/wayland/wayland-drm and we can include this directory in such a way that it will be loaded before egl and vulkan this allows us to avoid multiple calls to the same generator. Signed-off-by: Dylan Baker <[email protected]> Reviewed-and-Tested-by: Eric Engestrom <[email protected]>
* egl,dri: Propagate context priority hint to driver->CreateContextChris Wilson2017-10-201-7/+31
| | | | | | | | | | | | | | | | | | | | Jump through the layers of abstraction between egl and dri in order to feed the context priority attribute through to the backend. This requires us to read the value from the base _egl_context, convert it to a DRI attribute, parse it again in the generic context creator before passing it to the driver as a function parameter. In order to not require us to pass back the actual value of the context priority after creation, we impose that drivers should report the available set of priorities during screen setup (and then they may chose to fail if given an invalid value as that should have been checked at the user boundary.) Signed-off-by: Chris Wilson <[email protected]> Acked-by: Ben Widawsky <[email protected]> # i915/i965 Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* egl: Support IMG_context_priorityChris Wilson2017-10-205-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IMG_context_priority https://www.khronos.org/registry/egl/extensions/IMG/EGL_IMG_context_priority.txt "This extension allows an EGLContext to be created with a priority hint. It is possible that an implementation will not honour the hint, especially if there are constraints on the number of high priority contexts available in the system, or system policy limits access to high priority contexts to appropriate system privilege level. A query is provided to find the real priority level assigned to the context after creation." The extension adds a new eglCreateContext attribute for choosing a priority hint. This stub parses the attribute and copies into the base struct _egl_context, and hooks up the query similarly. Since the attribute is purely a hint, I have no qualms about the lack of implementation before reporting back the value the user gave! v2: Remember to set the default ContextPriority value to medium. v3: Use the driRendererQuery interface to probe the backend for supported priority values and use those to mask the EGL interface. v4: Treat the priority attrib as a hint and gracefully mask any requests not supported by the driver, the EGLContext will remain at medium priority. Signed-off-by: Chris Wilson <[email protected]> Cc: Rob Clark <[email protected]> Reviewed-by: Ben Widawsky <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* Revert "egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku}"Marek Olšák2017-10-185-18/+31
| | | | | | This reverts commit 8cb84c8477a57ed05d703669fee1770f31b76ae6. This fixes crashing shader-db/run.
* Revert "egl: drop EGL driver `name`"Marek Olšák2017-10-185-1/+10
| | | | | | This reverts commit 6414d6bd8d2897f4ba643357fe3037f3acd60879. This is needed to apply the next revert.
* egl: set UseFallback if LIBGL_ALWAYS_SOFTWARE is setEric Engestrom2017-10-184-6/+7
| | | | | Suggested-by: Emil Velikov <[email protected]> Signed-off-by: Eric Engestrom <[email protected]>
* egl: drop EGL driver `name`Eric Engestrom2017-10-185-10/+1
| | | | | | | | | | | | | | The "DRI2" name was reported as confusing when printing EGL infos (one user reported thinking DRI3 was not working on his X server), and the only alternative is Haiku, which can only be used on a Haiku machine. The name therefore doesn't add any information that the user wouldn't know already, so let's just drop it. Cc: Kai Wasserbäch <[email protected]> Suggested-by: Emil Velikov <[email protected]> Related-to: b174a1ae720cb404738c ("egl: Simplify the "driver" interface") Signed-off-by: Eric Engestrom <[email protected]>
* egl: drop always-false TestOnly optionEric Engestrom2017-10-185-18/+9
| | | | Signed-off-by: Eric Engestrom <[email protected]>
* egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku}Eric Engestrom2017-10-185-31/+18
| | | | | | | | Note: dropping the EGL_BAD_ALLOC in egl_haiku because it's overwritten by the EGL_NOT_INITIALIZED in eglInitialize(). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl_dri2: drop dri2_egl_driver structEric Engestrom2017-10-182-58/+50
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl_dri2: move glFlush out of struct dri2_egl_driverEric Engestrom2017-10-182-27/+22
| | | | | | | There's no reason to store this there, it doesn't depend on the driver. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* wayland-drm: constify the callbacks struct, take 2Emil Velikov2017-10-133-11/+7
| | | | | | | | | | | Now that wayland-drm (correctly) keeps a local copy of the callbacks, this should not longer cause explosions. After all the symbol is a local, constant data. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Tested-by: Derek Foreman <[email protected]>
* wayland-drm: use a copy of the wayland_drm_callbacks structEmil Velikov2017-10-131-5/+5
| | | | | | | | | | | The callbacks may be called even when they are no longer valid. Say, the user is dlclose(ing) libEGL while the buffers are being destroyed. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Tested-by: Derek Foreman <[email protected]>
* egl/dri: don't crash when createImageFromRenderbuffer2 is NULLEmil Velikov2017-10-131-1/+2
| | | | | | | | | | | The __DRI_IMAGE version can be 17 or over, while the function pointer is NULL. Guard for that instead of crashing. Fixes: bad24395d91 ("egl/dri: use createImageFromRenderbuffer2 when available") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* egl_haiku: drop haiku_egl_driver structEric Engestrom2017-10-121-20/+14
| | | | | | | The struct only contained the one field we're interested in. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: remove left over _EGLMain_tEric Engestrom2017-10-121-3/+0
| | | | | | | Fixes: b174a1ae720cb404738c "egl: Simplify the "driver" interface" Cc: Adam Jackson <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: drop memset(0) of calloc'ed memoryEric Engestrom2017-10-121-2/+0
| | | | | | | | `_EGLDriver *drv` is a freshly calloc()'ed object, memset(0)'ing some of it is a no-op. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: replace _egl_driver->Unload() callback with a simple free()Eric Engestrom2017-10-124-28/+1
| | | | | | | Bonus: fixes a memleak on haiku when unloading the driver Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/dri: remove old left-oversNicolai Hähnle2017-10-101-2/+0
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* egl/dri: use createImageFromRenderbuffer2 when availableNicolai Hähnle2017-10-101-3/+20
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* egl/dri: factor out egl_error_from_dri_image_errorNicolai Hähnle2017-10-101-28/+26
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* egl: Simplify the "driver" interfaceAdam Jackson2017-10-054-252/+22
| | | | | | | | | | | | | | | | | | "Driver" isn't a great word for what this layer is, it's effectively a build-time choice about what OS you're targeting. Despite that both of the extant backends totally ignore the display argument, the old code would only set up the backend relative to a display. That causes problems! One problem is it means eglGetProcAddress can generate X or Wayland protocol when it tries to connect to a default display so it can call into the backend, which is, you know, completely bonkers. Any other EGL API that doesn't reference a display, like EGL_EXT_device_query, would have the same issue. Fortunately this is a problem that can be solved with the delete key. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* egl/wayland: Don't use dmabuf with no modifiersDaniel Stone2017-10-041-7/+11
| | | | | | | | | | | | | | | | | The dmabuf interface requires a valid modifier to be sent. If we don't explicitly get a modifier from the driver, we can't know what to send; it must be inferred from legacy side-channels (or assumed to linear, if none exists). If we have no modifier, then we can only have a single-plane format anyway, so fall back to the old wl_drm buffer import path. Fixes: a65db0ad1c ("st/dri: don't expose modifiers in EGL if the driver doesn't implement them") Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers") Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reported-by: Andy Furniss <[email protected]> Cc: Marek Olšák <[email protected]>
* egl/wayland: Check queryImage return for wl_bufferDaniel Stone2017-10-041-15/+41
| | | | | | | | | | | | | | | When creating a wl_buffer from a DRIImage, we extract all the DRIImage information via queryImage. Check whether or not it actually succeeds, either bailing out if the query was critical, or providing sensible fallbacks for information which was not available in older DRIImage versions. Fixes: a65db0ad1c ("st/dri: don't expose modifiers in EGL if the driver doesn't implement them") Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers") Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reported-by: Andy Furniss <[email protected]> Cc: Marek Olšák <[email protected]>
* wayland-egl: adds CFLAGS for wayland.egl.h includeTobias Klausmann2017-10-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with commit ab0589c6ed ("wayland-egl: remove no longer needed wayland-client dependency") the wayland-egl.h include was missing leading to a build failure: CC wayland-egl.lo wayland-egl.c:33:10: fatal error: wayland-egl.h: No such file or directory #include "wayland-egl.h" ^~~~~~~~~~~~~~~ Strictly speaking we should be checking for wayland-egl in configure and propagating its CFLAGS here. Yet again, the current wayland-egl split is bonkers as the Wayland repo provides single header, no pkg-config file or library. That will be resolved at a later stage, but in the meanwhile fix the build. Fixes: ab0589c6ed ("wayland-egl: remove no longer needed wayland-client dependency") Signed-off-by: Tobias Klausmann <[email protected]> Reviewed-by: Emil Velikov <[email protected]> [Emil Velikov: add some text about CFLAGS and current wayland-egl situation] Signed-off-by: Emil Velikov <[email protected]>
* egl/surfaceless: Use KMS swrast fallbackGurchetan Singh2017-10-031-4/+16
| | | | | | | | | | | | The kms_swrast extension is an actively developed software fallback, and platform_surfaceless can use it if there are no available hardware drivers. v2: Split into 2 patches, use booleans, check LIBGL_ALWAYS_SOFTWARE, and modify the eglLog level (Emil, Eric, Tomasz). Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl/surfaceless: add probe device helper functionGurchetan Singh2017-10-031-28/+39
| | | | | | | | This will help us initialize a software driver, if it's needed or requested. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* wayland-egl: rework and simplify wl_egl_window initializationEmil Velikov2017-10-021-10/+16
| | | | | | | | | | | | | | | Use calloc instead of malloc + explicitly zeroing the different fields. We need special handling for the version field which is of type const intptr_t. As we're here document why keeping the constness is a good idea. The wl_egl_window_resize() call is replaced with an explicit set of the width/height. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: move WL_EGL_EXPORT declaration to where it's usedEmil Velikov2017-10-022-7/+7
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: use C99 commentsEmil Velikov2017-10-021-3/+3
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: remove no longer needed wayland-client dependencyEmil Velikov2017-10-023-4/+1
| | | | | | | | | Was required for wl_surface, which is opaque and forward declared with earlier patch. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: add stdint.h include for intptr_tEmil Velikov2017-10-021-0/+1
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: forward declare struct wl_surfaceEmil Velikov2017-10-021-0/+2
| | | | | | | | | It makes the header self-contained and with later commit we'll remove the unnecessary wayland-client.h include. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* wayland-egl: rename wayland-egl-{priv,backend}.hEmil Velikov2017-10-025-5/+5
| | | | | | | | In preparation to lifting the whole thing out as a separate library. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Miguel A. Vico <[email protected]>
* egl/dri: link directly to libglapi.soEmil Velikov2017-10-024-40/+7
| | | | | | | | | | | | | | | | | | | | | | | Shared glapi (libglapi.so) has been a requirement for years, in order to build EGL. Remove the no longer necessary dlopen/dlsym dance and link to the library directly. This allows us to remove a handful of platform specific workarounds, due to the different name of the library. v2: - Android: export the include dir (RobH) - Drop unused local variable (Eric) Cc: Jonathan Gray <[email protected]> Cc: Jon Turney <[email protected]> Cc: Julien Isorce <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) Tested-by: Tomasz Figa <[email protected]> (v1) Tested-by: Rob Herring <[email protected]>
* egl/wayland: simplify LIBGL_ALWAYS_SOFTWARE logicEric Engestrom2017-10-021-8/+4
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/dri2: don't use the template keywordMarek Olšák2017-09-301-3/+3
| | | | | | for C++ editors Reviewed-by: Brian Paul <[email protected]>
* meson: Add build Intel "anv" vulkan driverDylan Baker2017-09-271-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows building and installing the Intel "anv" Vulkan driver using meson and ninja, the driver has been tested against the CTS and has seems to pass the same series of tests (they both segfault when the CTS tries to run wayland wsi tests). There are still a mess of TODO, XXX, and FIXME comments in here. Those are mostly for meson bugs I'm trying to fix, or for additional things to implement for other drivers/features. I have configured all intermediate libraries and optional tools to not build by default, meaning they will only be built if they're pulled in as a dependency of a target that will actually be installed) this allows us to avoid massive if chains, while ensuring that only the bits that need to be built are. v2: - enable anv, x11, and wayland by default - add configure option to disable valgrind v3: - fix typo in meson_options (Nicholas) v4: - Remove dead code (Eric) - Remove change to generator that was from v0 (Eric) - replace if chain with loop (Eric) - Fix typos (Eric) - define HAVE_DLOPEN for both libdl and builtin dl cases (Eric) v5: - rebase on util string buffer implementation Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (v4)
* egl/dri2: Implement swapInterval fallback in a conformant way (v2)Tomasz Figa2017-09-276-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dri2_fallback_swap_interval() currently used to stub out swap interval support in Android backend does nothing besides returning EGL_FALSE. This causes at least one known application (Android Snapchat) to fail due to an unexpected error and my loose interpretation of the EGL 1.5 specification justifies it. Relevant quote below: The function EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval); specifies the minimum number of video frame periods per buffer swap for the draw surface of the current context, for the current rendering API. [...] The parameter interval specifies the minimum number of video frames that are displayed before a buffer swap will occur. The interval specified by the function applies to the draw surface bound to the context that is current on the calling thread. [...] interval is silently clamped to minimum and maximum implementation dependent values before being stored; these values are defined by EGLConfig attributes EGL_MIN_SWAP_INTERVAL and EGL_MAX_SWAP_INTERVAL respectively. The default swap interval is 1. Even though it does not specify the exact behavior if the platform does not support changing the swap interval, the default assumed state is the swap interval of 1, which I interpret as a value that eglSwapInterval() should succeed if called with, even if there is no ability to change the interval (but there is no change requested). Moreover, since the behavior is defined to clamp the requested value to minimum and maximum and at least the default value of 1 must be present in the range, the implementation might be expected to have a valid range, which in case of the feature being unsupported, would correspond to {1} and any request might be expected to be clamped to this value. Fix this by defaulting dri2_dpy's min_swap_interval, max_swap_interval and default_swap_interval to 1 in dri2_setup_screen() and let platforms, which support this functionality set their own values after this function returns. Thanks to patches merged earlier, we can also remove the dri2_fallback_swap_interval() completely, as with a singular range it would not be called anyway. v2: Remove dri2_fallback_swap_interval() completely thanks to higher layer already clamping the requested interval and not calling the driver layer if the clamped value is the same as current. Signed-off-by: Tomasz Figa <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* Revert "wayland-drm: constify the callbacks struct"Daniel Stone2017-09-263-8/+12
| | | | | | | | | | | | | | | The wayland-drm callback struct is referenced, rather than duplicated, inside wayland-drm. Constifying this struct involved moving it on to the stack; as a result, starting any EGL client on Wayland called into random stack memory, and killed the compositor. This reverts commit 1d0be5b3fe548ee33d4520092f583c76d42510a6 and 39d539e321c6c97433a15660c9d9a20ad8657ff0. Signed-off-by: Daniel Stone <[email protected]> Cc: Emil Velikov <[email protected]> Cc: Krzysztof Sobiecki <[email protected]> Fixes: 1d0be5b3fe54 ("wayland-drm: constify the callbacks struct")
* egl: fix build fallouts from 1d0be5b3fe5Krzysztof Sobiecki2017-09-192-2/+2
| | | | | Fixes: 1d0be5b3fe5 ("wayland-drm: constify the callbacks struct") Reviewed-by: Emil Velikov <[email protected]>
* egl: use switch statements over if/else chainEmil Velikov2017-09-191-31/+28
| | | | | | | Shorter, explicit and consistent with the rest of the co debase. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: remove unneeded braces around since line if statementsEmil Velikov2017-09-191-9/+5
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: simplify _eglDebugReport* APIEmil Velikov2017-09-193-49/+14
| | | | | | | | | | | | | | Instead of having three, almost identical but not quite, _eglDebugReport* functions, simply fold them into one. While doing so drop the unnecessary arguments 'command' and 'objectLabel'. Former is identical to funcName, while the latter is already stored (yet unused) in _EGLThreadInfo::CurrentObjectLabel. Cc: Kyle Brenneman <[email protected]> Cc: Adam Jackson <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (IRC)