src/video/SDL_egl.c


Log

Author Commit Date CI Message
Ryan C. Gordon e758dd53 2020-09-10T15:02:00 egl: Make SDL_EGL_HasExtension() available outside of SDL_egl.c.
Sam Lantinga 8709f67e 2020-09-08T08:42:30 Fixed bug 5215 - Fixing filenames passed to dlopen for OpenBSD Brad Smith Attached is a patch to use the proper filenames when trying to dlopen the respective shared libraries on OpenBSD.
Manuel Alfayate Corchete 1a5503ce 2020-07-28T21:11:25 kmsdrm: Moved to the ATOMIC KMS/DRM interface for buffer swapping, leaving DRM-legacy behind.
Ryan C. Gordon 8babda2c 2020-07-16T13:18:19 egl: SDL_EGL_LoadLibaryOnly() shouldn't set _this->gl_config.driver_loaded = 1 This is handled in in the higher-level SDL_GL_LoadLibrary(). All uses of SDL_EGL_LoadLibrary (which calls the Only version) are just target-specific wrappers for their own GL_LoadLibrary hook, with two exceptions which now handle driver_loaded correctly (although it's questionable if these init-if-no-one-did-it-correctly-already code blocks should exist at all, fwiw). Fixes Bugzilla #5190.
Ryan C. Gordon 132f87c3 2020-04-13T22:06:12 opengl: Don't try to do Desktop OpenGL stuff if support isn't available.
Ryan C. Gordon e96b05c3 2020-04-13T18:21:28 egl: Attempt to make this compile on WinRT, etc.
Conn O'Griofa c0a875fa 2020-04-13T14:48:38 SDL_EGL_ChooseConfig: don't fall through if no matching format exists On Raspberry Pi 3 via the VC4 driver in firmware KMS mode, none of the found configs match the desired format, causing the function to fall through without any config being selected. Fix by first iterating over the found configs, and if no match exists, don't exclude the non-matching configs. This should fix RPI3 and possibly other targets without breaking targets that have a matching native format (such as RPI4).
Ryan C. Gordon 64617d25 2020-04-13T14:45:40 opengl: Convert an int to an SDL_bool.
Ryan C. Gordon 389c8995 2020-04-13T14:44:21 opengl: Allow SDL_GL_MakeCurrent() to accept a NULL window (thanks, Martin!). This allows you to bind surfaceless contexts on a background thread to, for example, load assets in a separate context, for platforms that have different requirements about sharing surfaces, etc. Martin's notes on the matter: "Here's a patch that enables passing NULL windows to SDL_GL_MakeCurrent, if the involved APIs allow it. Currently, this is only the case for EGL, and even then only if some specific extensions are present (which they usually are). If "surfaceless" contexts are not supported, SDL_GL_MakeCurrent continues to generate an error (albeit with a more specific error message than it used to), so this should not break anything that wasn't broken before." (Please see https://bugzilla.libsdl.org/show_bug.cgi?id=3695 for more discussion.) Fixes Bugzilla #3695.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Ryan C. Gordon 90f9e8f8 2020-03-20T15:13:09 egl: Don't use SDL_LoadFunction to get GL entry points on Emscripten. This results in a dlsym() call, which causes Emscripten to panic if the game wasn't explicitly built dlopen support. eglGetProcAddress works just fine on this platform, so just let that codepath handle it.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sylvain Becker 3a8b8994 2019-10-23T11:07:11 Android: remove eglGetProcAdded busted comment (bug #4040)
Sylvain Becker 24bee6e5 2019-10-18T21:47:30 Add internal function SDL_EGL_GetVersion()
Sylvain Becker e5bd2003 2019-10-18T14:08:07 Android: enable eglGetProcAddress (bug #4040, bug #4794)
Sylvain Becker 03f27a3a 2019-10-18T13:27:58 Add robustness getting the EGL version (see bug #4040)
Ryan C. Gordon 3ecce847 2019-10-18T00:07:32 egl: adjust how we load symbols in SDL_EGL_GetProcAddress. Use eglGetProcAddress for everything on EGL >= 1.5. Try SDL_LoadFunction first for EGL <= 1.4 in case it's a core symbol, and as a fallback if eglGetProcAddress fails. Finally, for EGL <= 1.4, fallback to eglGetProcAddress to catch extensions not exported from the shared library. (Maybe) Fixes Bugzilla #4794.
Brandon Schaefer ee6d504a 2019-09-24T17:49:53 offscreen: Define missing define on a older EGL for an EXT function which it wont have
Brandon Schaefer 8a41948e 2019-09-24T17:27:51 offscreen: Avoid using EGLDeviceEXT as it causes issues with older platforms, which is just a void*
Brandon Schaefer 68985371 2019-09-24T16:36:48 offscreen: Add new video driver backend Offscreen The Offscreen video driver is intended to be used for headless rendering as well as allows for multiple GPUs to be used for headless rendering Currently only supports EGL (OpenGL / ES) or Framebuffers Adds a hint to specifiy which EGL device to use: SDL_HINT_EGL_DEVICE Adds testoffscreen.c which can be used to test the backend out Disabled by default for now
Sam Lantinga 2b6473dc 2019-06-08T15:10:20 Fixed bug 4533 - Update ANGLE to load d3dcompiler_47.dll instead of d3dcompiler_46.dll msmshazan Update ANGLE Libraries to support d3dcompiler_47.dll since chrome does not ship with d3dcompiler_46.dll and d3dcompiler_43.dll
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sylvain Becker a95f91bc 2019-01-02T18:06:33 Fixed bug 3250 - Wrong backbuffer pixel format on Android, keep getting RGB_565 Use the egl format to reconfigure java SurfaceView holder format. If there is a change, it triggers a surfaceDestroyed/Created/Change sequence.
Sam Lantinga aeee424f 2018-10-31T15:16:51 Fixed bug 4349 - SDL_CreateWindow fails with KMS/DRM after upgrading Mesa to 18.2.3 Rainer Sabelka After I did an upgrade of my arch Linux installation (resulting in an update of Mesa to version 18.2.3), all my SDL2 applications which use the KMS/DRM driver stopped working. Reason: Creating a Window with SDL_CreateWindow failed because the call to EGL eglCreateWindowSurface() returns an error "EGL_BAD_MATCH". After investigating with the debugger I figured, that the configuration, which has been selected from the output of eglChooseConfig(), has an "EGL_NATIVE_VISUAL_ID" which does not match the "format" of the underlying gbm surface. The attached patch fixes the problem. It does so, by mimicking Weston's behavior. All configurations returned from eglChooseConfig() which have an visual_id different from the gbm format are discarded, and only from the remaining ones the "best" match is selected.
Sam Lantinga 95579f5f 2018-10-01T09:40:58 Fixed bug 4220 - SDL_GL_CONTEXT_DEBUG_FLAG can fail silently on some Android devices
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Tomeu Vizoso fe682827 2018-06-14T06:12:12 egl: Don't change context when deleting current. If we change the current context behind the app's back, those tracking the current context to minimize context changes are going to get confused. This brings the EGL backend in line with the GLX one. Fixes Bugzilla #4199.
Sam Lantinga 999af809 2018-05-18T13:09:30 Merged latest changes from Steam Link app
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Guillermo A. Amaral bd0def06 2018-02-07T14:12:26 Set rpath instead of changing environment for RPi Credit goes to Adrian Perez de Castro for the improvement. Signed-off-by: Guillermo A. Amaral <g@maral.me>
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Guillermo A. Amaral 35554caf 2018-01-17T13:17:10 Make rpi video cross-compiler friendly. * Stops using fixed path to find GLES/EGL libs. * Tries pkg-config to locate bcm_host. Signed-off-by: Guillermo A. Amaral <g@maral.me>
Dawid Gan 61261e59 2018-01-16T21:29:32 EGL: Request sRGB framebuffer in correct place. The EGL_GL_COLORSPACE_KHR is an attribute for eglCreate*Surface. As written in EGL_KHR_gl_colorspace documentation: Accepted as an attribute name by eglCreateWindowSurface, eglCreatePbufferSurface and eglCreatePixmapSurface EGL_GL_COLORSPACE_KHR 0x309D (...)
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 57ebc727 2017-12-04T20:35:01 Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library Andrey Seems latest google angle library successfully built & tested under macOS'es. https://github.com/google/angle We need to use GLES2 to implement true cross-platform code.
Sam Lantinga 67950e10 2017-12-03T20:27:08 Fixed name of eglCreatePbufferSurface function
Sam Lantinga e943d1ce 2017-12-03T20:25:55 Fixed bug 3945 - Add eglCreatePbufferSurface function tomwardio Proposed patch loads eglCreatePbufferSurface in same manner as other 1.1 functors. This allows custom video drivers to create pbuffer surfaces.
Sam Lantinga 7334a2a1 2017-11-04T09:07:33 Fixed bug 3940 - Add support for EGL_SURFACE_TYPE tomwardio Add support to be able to set EGL_SURFACE_TYPE bits when creating an EGL config. This is usefule when wanting to create pixel buffer surfaces in custom video drivers.
Conn O'Griofa bf3e363d 2017-11-04T09:04:19 Raspberry Pi: fix ES 1/PVR support & autodetect Mesa driver * The brcmGLESv2 vendor library also supports ES PVR/1 profiles * Fallback to standard Mesa libraries if the VC4 driver is loaded
Brandon Schaefer e564da78 2017-09-29T10:15:44 revert files I didnt mean to commit!
Brandon Schaefer e27f12e0 2017-09-29T10:07:37 wayland: Fix bug 3814 -Wmissing-field-initializers
Brandon Schaefer 466ba57d 2017-09-21T18:38:07 [egl/mir] Need eglGetProc to find gl 4.5 core profile extensions
Ryan C. Gordon 0c892abc 2017-09-06T19:34:23 raspberrypi: The latest Raspbian moved its EGL and GLES2 libs elsewhere. Now we try the new (hardware-specific) pathnames first, and if those fail to load, we'll try the more generic names that earlier versions of Raspbian used. Fixes Bugzilla #3800.
Ryan C. Gordon 21e32bac 2017-08-29T16:30:49 egl: Cast to size_t, in case platform's NativeDisplayType isn't a pointer. (fixes compiler warnings on QNX.)
Sam Lantinga 003d491f 2017-08-27T19:05:57 Fixed bug 3724 - Allow Angle Static Link Carlos We would like to add a switch (define) that allows us to compile Angle statically with SDL. That is, getting rid of the OpenGL DLL. Usually you need OpenGL to be loaded dynamically as DLL because implementation is provided by the system but no need with Angle. Only 2 files need modification and it shouldn't affect current behaivor: include/SDL_egl.h and src/video/SDL_egl.c, as in here https://github.com/native-toolkit/sdl/pull/10/files The flag name could be SDL_VIDEO_STATIC_ANGLE (instead of NATIVE_TOOLKIT_STATIC_ANGLE) as discussed here https://github.com/native-toolkit/sdl/pull/10 We have tested this with both Windows and UWP, using NME engine (https://github.com/haxenme/nme). Releated issue: https://bugzilla.libsdl.org/show_bug.cgi?id=1820
Ethan Lee 685890a2 2017-08-24T22:57:42 Fix KHR_no_error support
Ryan C. Gordon d8fc70ea 2017-08-24T21:30:53 opengl: add support for GL_KHR_no_error. This is completely untested! Fixes Bugzilla #3721.
Sam Lantinga 96305832 2017-08-11T10:21:19 Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries Simon Hug Some code in SDL loads libraries with SDL_LoadObject to get more information or use newer APIs. SDL_LoadObject may fail, set an error message and SDL will continue with some fallback code. Since SDL will overwrite the error or exit the function with a return value that indicates success, the error form SDL_LoadObject for the optional stuff might as well be cleared right away.
Philipp Wiesemann 27de835d 2017-08-05T22:10:55 emscripten: Fixed compiler warnings about integer to pointer conversions. Found by buildbot.
Sam Lantinga 56363ebf 2017-08-02T10:22:48 Fixed bug 3690 - SDL2 KMS/DRM render context support Manuel The attached patch adds support for KMS/DRM context graphics. It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation. Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition. X86 systems use KMS right away in every current GNU/Linux system. Simple build instructions: $./autogen.sh $./configure --enable-video-kmsdrm $make
Sam Lantinga 9171f71d 2017-02-10T09:41:16 Fixed warning in Android build
Sam Lantinga 67ed8943 2017-01-01T19:10:36 Fixed bug 3529 - SDL_EGL_UnloadLibrary is not called at all on SDL_Quit kaisyu In case of OpenGLES, the sequences of loading and unloading driver library should be like that: SDL_Init ... SDL_GL_LoadLibrary SDL_EGL_LoadLibrary ... SDL_Quit ... SDL_GL_UnloadLibrary SDL_EGL_UnloadLibrary ... However, according to my test results, the varible '_this->gl_config.driver_loaded' does not allow 'SDL_GL_UnloadLibrary' to call 'SDL_EGL_UnloadLibrary'.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
David Ludwig 0cfa0aa1 2016-12-29T11:49:18 improved SDL_GetError() output generated by EGL code This change attempts to report the EGL error codes generated by SDL's calls into EGL, along with the name of the EGL function that failed.
Sam Lantinga fed8cbcd 2016-12-09T05:00:35 Fixed build for EGL platforms
Sam Lantinga 5d5127c4 2016-10-04T03:38:39 Fixed compiler warning - this should have been a const char pointer
Philipp Wiesemann 748b0528 2016-05-11T21:10:41 EGL: Fixed SDL_GL_GetSwapInterval() returning -1 on error. It should return 0 as a safe default on errors. -1 is returned for late swaps.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Alex Szpakowski 5a3cc7f5 2015-08-01T15:16:57 EGL: Added support for sRGB system framebuffers, when the required EGL extension is present.
Sam Lantinga e93f90ae 2015-07-30T10:01:04 Trivial integer truncation warning fixes.
Philipp Wiesemann 72590685 2015-06-21T19:36:35 Backed out changeset 4ad56dbf4a6f
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Alex Szpakowski a4f0daed 2015-05-26T19:34:56 EGL: OpenGL ES 3.0 contexts can now be created without the EGL_KHR_create_context extension. Fixes bugzilla #2994.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Sam Lantinga 7de242e7 2015-05-13T22:39:20 Added SDL_SetWindowsMessageHook() to facilitate full IME support on Windows
Alex Szpakowski f1a7c00d 2015-05-11T21:03:36 Refactored SDL_EGL_CreateContext: It now supports context flags and OpenGL ES 3+ contexts, and its behavior more closely matches the GLX and WGL context creation code. Improved the code style consistency of SDL_egl.c. Fixes bugzilla #2865.
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Sam Lantinga 251ca855 2014-10-15T09:18:17 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga 3b70f65d 2014-10-15T09:13:36 Fixed bug where EGL function pointers wouldn't get saved in optimized gcc builds
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 1ee96bb9 2014-07-07T10:26:28 Fixed mingw64 build and warnings
Gabriel Jacobo 5a3c553d 2014-07-03T17:36:08 Maybe fixes bug #2291 (red tinted screen on some Samsung Android devices) Then again, maybe not!
Gabriel Jacobo 765894e3 2014-06-28T13:05:16 Better fix to support EGL_KHR_create_context and not fail to build on Android ...or Raspberry Pi (EGL < 1.4 systems)
Gabriel Jacobo a9bb8898 2014-06-28T12:48:29 Disable desktop OpenGL for EGL under Android
Knut Andre Tidemann 02e9f81e 2014-06-28T12:17:29 SDL_egl: allow creation of versioned OpenGL contexts with EGL_KHR_create_context If the EGL extension EGL_KHR_create_context is available, we can use it to set the core/compatability profile and the minimum OpenGL version. Use this if it is available to get the context requested by the GL attributes.
Gabriel Jacobo 9e55ace8 2014-06-16T09:47:23 Fixes #2583, clean up EGL initialization
Gabriel Jacobo 536dd013 2014-05-10T16:13:22 Fixes #2519, clear error if using the default library path for EGL succeeds.
Brandon Schaefer b6148092 2014-05-06T15:08:43 eglGetProcAddress fails the same way on MIR as ANDROID does on arm. Thanks Sylvain Becker for the patch!
Sam Lantinga d2fb8a2a 2014-04-26T11:23:55 Better compiler for Windows XP systems
Sam Lantinga a5ce57bc 2014-04-23T13:47:52 Fixed compiler warning
Sam Lantinga acbc321c 2014-04-23T13:47:42 Don't try to load d3dcompiler_46.dll on Windows XP
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
David Ludwig b51a3206 2014-03-22T20:48:18 WinRT: Got OpenGL ES 2 working with the latest version of ANGLE/WinRT. SDL/WinRT did have support for OpenGL ES 2 via an older version of ANGLE/WinRT, however its API changed a few months ago, and SDL/WinRT would crash when trying to use it. It would also occasionally crash when using the older version. This changeset should make SDL/WinRT work with the latest version, as available via MS Open Tech's git repository of it at https://github.com/msopentech/angle Older versions of ANGLE/WinRT (from either https://github.com/stammen/angleproject or https://bitbucket.org/DavidLudwig/angleproject) will need to be updated to MS Open Tech's latest version.
Sam Lantinga 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo c0d86b92 2014-01-14T21:29:38 Make EGL loading more resilient. Lesson learned while trying to run L4D2 under Wayland :)
Gabriel Jacobo ec1cb49e 2013-12-14T20:18:43 Wayland support Based on the original port to Wayland by: Joel Teichroeb, Benjamin Franzke, Scott Moreau, et al. Additional changes in this commit, done by me: * Wayland uses the common EGL framework * EGL can now create a desktop OpenGL context * testgl2 loads GL functions dynamically, no need to link to libGL anymore * Assorted fixes to the Wayland backend Tested on the Weston Compositor (v1.0.5) that ships with Ubuntu 13.10, running Weston under X. Tests ran: testrendercopyex (all backends), testgl2, testgles2,testintersections
Gabriel Jacobo 4a8c2967 2013-12-13T09:48:12 Context sharing for EGL
Sam Lantinga 013d9982 2013-12-02T23:54:35 Fixed error return value in SDL_EGL_CreateSurface(), thanks to Mike Kasprzak
Gabriel Jacobo 7d9e42f2 2013-12-02T10:08:57 Select EGL config when creating the EGL surface
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
David Ludwig ecfbb3f5 2013-11-28T22:59:21 WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Gabriel Jacobo 61959aa6 2013-11-22T13:24:53 OpenGL ES support for Windows
Gabriel Jacobo 131a0725 2013-11-19T11:04:05 Find the best EGL config available between those returned by eglChooseConfig This existed in the old Android Java code, it got lost in the migration to the commong EGL code.