summaryrefslogtreecommitdiffstats
path: root/src/egl/main
Commit message (Collapse)AuthorAgeFilesLines
* egl: EXT_pixel_format_float plumbingTapani Pälli2017-11-134-0/+13
| | | | | | | | | | | | | | | Patch adds support and capability to match with new surface attribute, component type. Currently no configs with floating point type are exposed. With this change, following dEQP test starts to pass: dEQP-EGL.functional.choose_config.color_component_type_ext.dont_care dEQP-EGL.functional.choose_config.color_component_type_ext.fixed dEQP-EGL.functional.choose_config.color_component_type_ext.float Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* egl: Implement EGL_KHR_context_flush_controlAdam Jackson2017-11-064-0/+13
| | | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* egl: Support IMG_context_priorityChris Wilson2017-10-204-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-183-12/+9
| | | | | | This reverts commit 8cb84c8477a57ed05d703669fee1770f31b76ae6. This fixes crashing shader-db/run.
* Revert "egl: drop EGL driver `name`"Marek Olšák2017-10-183-1/+6
| | | | | | This reverts commit 6414d6bd8d2897f4ba643357fe3037f3acd60879. This is needed to apply the next revert.
* egl: set UseFallback if LIBGL_ALWAYS_SOFTWARE is setEric Engestrom2017-10-181-1/+4
| | | | | Suggested-by: Emil Velikov <[email protected]> Signed-off-by: Eric Engestrom <[email protected]>
* egl: drop EGL driver `name`Eric Engestrom2017-10-183-6/+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-184-14/+9
| | | | Signed-off-by: Eric Engestrom <[email protected]>
* egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku}Eric Engestrom2017-10-183-9/+12
| | | | | | | | 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: 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-122-10/+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: Simplify the "driver" interfaceAdam Jackson2017-10-052-248/+20
| | | | | | | | | | | | | | | | | | "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: 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)
* egl: use _eglError's 'msg' as an actual message in EGL_KHR_debugEmil Velikov2017-09-191-1/+1
| | | | | | | | | | | | | | | | Seemingly, the original intent behind _eglError's 'msg' was aimed to provide a function name. At some point, people started using it the way EGL_KHR_debug's callback() message is meant to be used. Aka providing meaningful information to the developer/user. Swap the funcName/msg argument order in the _eglDebugReport() call. The 'funcName' variable is implicitly set, props to the _eglSetFuncName() call at the start of each public entrypoint. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: remove unused 'Screens' array from _egl_displayTapani Pälli2017-09-061-1/+0
| | | | | | | | | This was used by EGL_MESA_screen_surface that has been removed in commit 7a58262e58d8edac3308777def0950032628edee. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: Fix inclusion of egl.h+mesa_glinterop.hMatt Turner2017-08-211-1/+1
| | | | | | | | Previously clang would warn about redefinition of typedef EGLDisplay. Avoid this by adding preprocessor guards to mesa_glinterop.h and including it after EGL.h is indirectly included. Reviewed-by: Jordan Justen <[email protected]>
* egl: avoid eglCreatePlatform*Surface{EXT,} crash with invalid dpyEmil Velikov2017-08-101-2/+2
| | | | | | | | | | | | | | | | | | If we have an invalid display fed into the functions, the display lookup will return NULL. Thus as we attempt to get the platform type, we'll deref. it leading to a crash. Keep in mind that this will not happen if Mesa is built without X11 or when the legacy eglCreate*Surface codepaths are used. A similar check was added with earlier commit 5e97b8f5ce9 ("egl: Fix crashes in eglCreate*Surface), although it was only applicable when the surfaceless platform is built. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* egl: handle BAD_NATIVE_PIXMAP further up the stackEmil Velikov2017-08-101-0/+3
| | | | | | | | | | | | The basic (null) check is identical across all backends. Just move it to the top. v2: - Split the WINDOW vs PIXMAP into separate patches - Move check after the dpy and config - dEQP expects so Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: whitespace cleanup in eglapi.cEric Engestrom2017-08-091-25/+25
| | | | Signed-off-by: Eric Engestrom <[email protected]>
* egl: check the correct function pointerEric Engestrom2017-08-021-1/+1
| | | | | | | | | | `.swap_interval` != `.SwapInterval`... Fixes: 991ec1b81a76de24fd01 "egl: make platform's SwapInterval() optional" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102015 Cc: Cedric Sodhi <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Cedric Sodhi <[email protected]>
* egl: remove unnecessary empty array elementEric Engestrom2017-08-011-3/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: split enums to make use of -WswitchEric Engestrom2017-08-011-10/+8
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: use designated initaliser for _eglGlobalEric Engestrom2017-08-011-9/+9
| | | | | | | | Turn comments into actual code, that the compiler can check for us :) (Speaking of, one of the comments had a typo. Challenge: find it) Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: make platform's SwapInterval() optionalEric Engestrom2017-08-011-1/+1
| | | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* egl: deduplicate swap interval clamping logicEric Engestrom2017-08-012-19/+12
| | | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* egl: move KHR_no_error vs debug/robustness check further downGrigori Goronzy2017-07-261-11/+10
| | | | | | | | | | | | We'll fail to flag an error if the context flags appear after the no-error attribute in the context attribute list. Delay the check to after attribute parsing to fix this. Fixes: 4909519a665 ("egl: Add EGL_KHR_create_context_no_error support") Cc: [email protected] [Emil Velikov: add fixes/stable tags, commit message polish] Reviewed-by: Emil Velikov <[email protected]>
* egl: fix whitespace issues from eglimage codeTapani Pälli2017-07-251-10/+10
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: Fix _eglPointerIsDereferencable() to ignore page residencyMiguel A. Vico2017-07-241-1/+12
| | | | | | | | | | | | | | | | | mincore() returns 0 on success, and -1 on failure. The last parameter is a vector of bytes with one entry for each page queried. mincore returns page residency information in the first bit of each byte in the vector. Residency doesn't actually matter when determining whether a pointer is dereferenceable, so the output vector can be ignored. What matters is whether mincore succeeds. See: http://man7.org/linux/man-pages/man2/mincore.2.html Signed-off-by: Miguel A. Vico <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]Miguel A. Vico2017-07-243-33/+37
| | | | | | | | | | Move _eglPointerIsDereferencable() to eglglobals.[ch] and make it a non-static function so it can be used out of egldisplay.c Signed-off-by: Miguel A. Vico <[email protected]> Reviewed-by: James Jones <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: propagate EGL_BAD_ATTRIBUTE during EGLImage attr parsingEmil Velikov2017-07-191-0/+7
| | | | | | | | | | | | | | Earlier commit refactored/split the parsing into separate hunks. While no functional change was intended, it did not attribute that different error is set when the attrib. value is incorrect. Fixes: 3ee2be4113d ("egl: split _eglParseImageAttribList into per extension functions") Cc: Michel Dänzer <[email protected]> Reported-by: Michel Dänzer <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Tested-by: Michel Dänzer <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: Add EGL_KHR_create_context_no_error supportGrigori Goronzy2017-07-144-0/+34
| | | | | | | | This only adds the EGL side, needs to be plumbed into Mesa frontend. v2: Add check for extension availability. Reviewed-by: Marek Olšák <[email protected]>
* egl: check for extensions' presence during attr parsingEmil Velikov2017-07-121-4/+18
| | | | | | | | If the respective extension is not supported, one should return EGL_BAD_PARAMETER as mentioned in earlier commits. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: add width/height as EXT_image_dma_buf_import attrsEmil Velikov2017-07-121-0/+6
| | | | | | | | | | | | | | | | | Although not listed amongst the initial EGL_LINUX_DRM_FOURCC_EXT and friends list, the spec reads ... Required attributes and their values are as follows: * EGL_WIDTH & EGL_HEIGHT: The logical dimensions of the buffer in pixels * EGL_LINUX_DRM_FOURCC_EXT: The pixel format of the buffer, as specified by drm_fourcc.h and used as the pixel_format parameter of the drm_mode_fb_cmd2 ioctl. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: polish EXT_image_dma_buf_import attr parsingEmil Velikov2017-07-121-29/+22
| | | | | | | | Simplify the existing if/else + temporary variable into if (foo) return X. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: simplify EXT_image_dma_buf_import_modifiers attr parsingEmil Velikov2017-07-121-26/+4
| | | | | | | Move the common extension check at the top. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: split _eglParseImageAttribList into per extension functionsEmil Velikov2017-07-121-186/+260
| | | | | | | | | | Will allow us to simplify existing code and make further improvements short and simple. No functional change intended. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: call _eglError within _eglParseImageAttribListEmil Velikov2017-07-122-11/+12
| | | | | | | | | | | | | | | | | | | | | | | As per EGL_KHR_image_base: If an attribute specified in <attrib_list> is not one of the attributes listed in Table bbb, the error EGL_BAD_PARAMETER is generated. We should set the error as opposed to simply log it. Currently we have a partial solution, whereby only some of the callers call _eglError(). Since that has proven to be less robust, simply set the error by the function itself and change the return type to EGLBoolean, updating the callers. So now the code is slightly simpler. Plus the follow-up fixes will be easier to manage. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: fold _eglError() + return EGL_FALSEEmil Velikov2017-06-263-60/+30
| | | | | | | | | | | The function _eglError() already explicitly returns EGL_FALSE, explicitly to simplify the callers. Make use of it. While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO, storage is not the same so we cannot use it for "everything". Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: drop _eglInitImage() return typeEmil Velikov2017-06-262-11/+5
| | | | | | | | | Function cannot fail and always returns true. v2: Inline the one line function in the header Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl/display: make platform detection thread-safeEric Engestrom2017-06-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Imagine there are 2 threads that both call _eglGetNativePlatform() simultaneously: - thread 1 completes the first "if (native_platform == _EGL_INVALID_PLATFORM)" check and is preempted to do something else - thread 2 executes the whole function, does "native_platform = _EGL_NATIVE_PLATFORM" and just before returning it's preempted - thread 1 wakes up and calls _eglGetNativePlatformFromEnv() which returns _EGL_INVALID_PLATFORM because no env vars are set, updates native_platform and then gets preempted again - thread 2 wakes up and returns wrong _EGL_INVALID_PLATFORM Solve this by doing the detection in a local var and only overwriting the global one at the end, if no other thread has updated it since. This means the platform detected in the thread might not be the platform returned by the function, but this is a different issue that will need to be discussed when this becomes possible. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101252 Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]> Acked-by: Emil Velikov <[email protected]>
* egl/display: only detect the platform onceEric Engestrom2017-06-161-14/+17
| | | | | | | | | | | | | | My refactor missed the fact that `native_platform` is static. Add the proper guard around the detection code, as it might not be necessary, and only print the debug message when a detection was actually performed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101252 Fixes: 7adb9b094894a512c019 ("egl/display: remove unnecessary code and make it easier to read") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]> Acked-by: Emil Velikov <[email protected]>
* egl/android: support for EGL_KHR_partial_updateHarish Krupo2017-06-117-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the EGL_KHR_partial_update extension for android platform. It passes 36/37 tests in dEQP for EGL_KHR_partial_update. 1 test not supported. v2: add fallback for eglSetDamageRegionKHR (Tapani) v3: The native_window_set_surface_damage call is available only from Android version 6.0. Reintroduce the ANDROID_VERSION guard and advertise extension only if version is >= 6.0. (Emil Velikov) v4: use newly introduced ANDROID_API_LEVEL guard rather than ANDROID_VERSION guard to advertise the extension.The extension is advertised only if ANDROID_API_LEVEL >= 23 (Android 6.0 or greater). Add fallback function for platforms other than Android. Fix possible math overflow. (Emil Velikov) Return immediately when n_rects is 0. Place function's entrypoint in alphabetical order. (Eric Engestrom) v5: Replace unnecessary calloc with malloc (Eric) Check for BAD_ALLOC error (Emil) Check for error in native_window_set_damage_region. (Emil, Tapani, Eric). Signed-off-by: Harish Krupo <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* egl: fix _eglQuerySurface in EGL_BUFFER_AGE_EXT caseTapani Pälli2017-06-091-1/+5
| | | | | | | | | | | | | | | | | | Specification states that in case of error, value should not be written, patch changes buffer age queries to return -1 in case of error so that we can skip changing the value. In addition, small change to droid_query_buffer_age to return 0 in case buffer does not have a back buffer available. Fixes: dEQP-EGL.functional.negative_partial_update.not_postable_surface Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: [email protected]
* egl: advertise EGL_EXT_image_dma_buf_import_modifiersVarad Gautam2017-05-301-0/+1
| | | | | | | | | v2: check for DRIimageExtension version 15 (Jason Ekstrand) Signed-off-by: Varad Gautam <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: implement eglQueryDmaBufModifiersEXTVarad Gautam2017-05-303-0/+26
| | | | | | | | | | | | | | | | | | | query and return supported dmabuf format modifiers for EGL_EXT_image_dma_buf_import_modifiers. v2: move format check to the driver instead of making format queries here and then checking. v3: Check DRIimageExtension version before query (Daniel Stone) v4: - move to DRIimageExtension version 15, check queryDmaBufModifiers before calling (Jason Ekstrand) - pass external_only to the driver instead of setting as EGL_TRUE here (Emil Velikov, Daniel Stone) Signed-off-by: Varad Gautam <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: implement eglQueryDmaBufFormatsEXTVarad Gautam2017-05-303-0/+23
| | | | | | | | | | | | | | allow egl clients to query the dmabuf formats supported on this platform. v2: return EGLBoolean. v3: Check DRIimageExtension version before querying (Daniel Stone). v4: move to DRIimageExtension version 15, error checking (Jason Ekstrand). Signed-off-by: Louis-Francis Ratté-Boulianne <[email protected]> Signed-off-by: Varad Gautam <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl/dri2: Create EGLImages with dmabuf modifiersVarad Gautam2017-05-302-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | Allow creating EGLImages with dmabuf format modifiers when target is EGL_LINUX_DMA_BUF_EXT for EGL_EXT_image_dma_buf_import_modifiers. v2: - clear modifier assembling and error label name (Eric Engestrom) v3: - remove goto jumps within switch-case (Emil Velikov) - treat zero as valid modifier (Daniel Stone) - ensure same modifier across all dmabuf planes (Emil Velikov) v4: - allow modifiers to add extra planes (Louis-Francis Ratté-Boulianne) v5: - fix error checking, some cleanups (Jason Ekstrand) - pass single copy of the modifier to createImageFromDmaBufs2 Signed-off-by: Pekka Paalanen <[email protected]> Signed-off-by: Varad Gautam <[email protected]> Signed-off-by: Louis-Francis Ratté-Boulianne <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>