src/video/wayland/SDL_waylandopengles.c


Log

Author Commit Date CI Message
Frank Praznik b5483f2c 2022-12-01T18:03:36 Fix formatting on Wayland and Pipewire function signatures Fixes the formatting on some function signatures that clang-format missed. (cherry picked from commit 378b1c286a9c3206e827a47f0147384e92c4c2b2)
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Sylvain Becker fb0ce375 2022-11-27T17:38:43 Cleanup add brace (#6545) * Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line (cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
Frank Praznik 78698a0b 2022-05-17T12:37:16 wayland: Use a separate frame callback for setting the surface damage region Previously, the surface damage region was being set in the same callback used for preventing render hangs in the GL backend when the surface was not visible. This was not ideal, as the callback was never fired in the case of using a different render backend or having a swap interval of 0. Use a separate frame callback for setting the surface damage region to ensure that it fires reliably, regardless of the backend being used or swap interval.
Frank Praznik 4d76c9cb 2022-03-25T20:35:07 video: wayland: Use wp-viewporter for fullscreen with non-native resolutions Wayland doesn't support mode switching, however Wayland compositors can support the wp_viewporter protocol, which allows for the mapping of arbitrarily sized buffer regions to output surfaces. Use this functionality, when available, for fullscreen output when using non-native display modes and/or when dealing with scaled desktops, which can incur significant overdraw without this extension. This also allows for the exposure of arbitrarily sized, emulated display modes, which can be useful for legacy compatability.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Cameron Gutman c97c4687 2021-10-30T15:56:54 core: Convert SDL_IOReady()'s 2nd parameter to flags
Cameron Gutman 408a93a1 2021-10-23T15:43:04 wayland: Use multi-thread event reading APIs Wayland provides the prepare_read()/read_events() family of APIs for reading from the display fd in a deadlock-free manner across multiple threads in a multi-threaded application. Let's use those instead of trying to roll our own solution using a mutex. This fixes an issue where a call to SDL_GL_SwapWindow() doesn't swap buffers if it happens to collide with SDL_PumpEvents() in the main thread. It also allows coexistence with other code or toolkits in our process that may want read and dispatch events themselves.
Väinö Mäkelä ad520573 2021-10-06T09:52:06 wayland: Only dispatch frame events in Wayland_GLES_SwapWindow Dispatching all events in Wayland_GLES_SwapWindow leads to resizes being acked before the program has a chance to handle the resize. This change reduces jumping on fullscreen transition with apps that call SDL_PollEvent before issuing any render calls.
David Gow eadc8f93 2021-10-02T23:08:39 wayland: Cleanup some SDL_TryLockMutex() calls. Check the result of these against 0 explicitly, so that it's obvious we're bailing out on failure, not success.
David Gow 25f9e32b 2021-10-02T16:52:43 wayland: Don't let multiple threads dispatch wayland events at once wl_display_dispatch() will block if there are no events available, and while we try to avoid this by using SDL_IOReady() to verify there are events before calling it, there is a race condition between SDL_IOReady() and wl_display_dispatch() if multiple threads are involved. This is made more likely by the fact that SDL_GL_SwapWindow() calls wl_display_dispatch() if vsync is enabled, in order to wait for frame events. Therefore any program which pumps events on a different thread from SDL_GL_SwapWindow() could end up blocking in one or other of them until another event arrives. This change fixes this by wrapping wl_display_dispatch() in a new mutex, which ensures only one thread can compete for wayland events at a time, and hence the SDL_IOReady() check should successfully prevent either from blocking.
David Gow 35d04558 2021-09-27T16:57:09 video: wayland: Support displays with a 0 refresh rate Some wayland compositors report the refresh rate as 0. Since we want to force a minimum refresh rate of 10 frames worth, we were dividing by the reported refresh rate, causing a divide-by-zero. If the refresh rate is 0, instead force a frame every second if no frame callbacks are received. This fixes bug #4785
Cameron Gutman 092a20d9 2021-08-08T16:47:34 wayland: Avoid busy waiting for vsync
Ethan Lee 32f909f7 2021-08-03T13:30:57 wayland: Remove redundant waylanddyn.h includes. All files including waylanddyn.h already include waylandvideo.h first.
Ryan C. Gordon 871c1119 2021-07-27T18:24:09 wayland: handle pending resizes immediately, not on SwapWindow. This was originally a workaround for an old Mesa bug, since fixed, apparently, and causes other problems. Fixes #4326.
Simon Zeni 6aae5b44 2021-07-27T17:12:26 Remove wl-shell and xdg-shell-unstable-v6 support (#4323) * wayland-protocol: update wayland.xml to 1.19.0 * wayland: remove shell_surface field from SDL_SysWMinfo * wayland: remove wl_shell support * waypand-protocols: update xdg-shell.xml to 1.20 * wayland: remove xdg-shell-unstable-v6 support * wayland: deprecate wl shell surface syswm info, add xdg surface
Ethan Lee eb15b4e9 2021-06-11T23:40:09 wayland: Drop SwapWindow calls for hidden windows
Ethan Lee 3d47ddc4 2021-05-01T08:57:37 wayland: Use refresh_rate to calculate max_wait in SwapWindow
Ryan C. Gordon c54c16d3 2021-04-30T13:19:36 wayland: don't hang in SDL_GL_SwapBuffers if the compositor is ghosting us. If you hide a window on Mutter, for example, the compositor never requests new frames, which will cause Mesa to block forever in eglSwapBuffers to satisfy the swap interval. We now always set the swap interval to 0 and manage this ourselves, handing the frame to Wayland when it requests a new one, and timing out at 10fps just to keep apps moving if the compositor wants no frames at all. My understanding is that other protocols are coming that might improve upon this solution, but for now it solves the total hang. Fixes #4335.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ryan C. Gordon a77a890d 2020-02-14T00:58:36 wayland: Don't delay pending surface resize handling on Vulkan. OpenGL apparently needs to not do any drawing between wl_egl_window_resize and eglSwapBuffers, but Vulkan apps don't use SDL to present, so they never call into an equivalent of SDL_GL_SwapWindow where our Wayland code was handling pending resize work. Fixes Bugzilla #4722.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sebastian Krzyszkowiak 797b2813 2019-06-12T00:55:05 wayland: HiDPI support
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sebastian Krzyszkowiak 48917e0e 2018-11-07T01:08:35 wayland: fix resizing and fullscreen toggling For starters, we need to correctly respond to 0,0 configure after unsetting fullscreen. Also, turns out that there should be no drawing calls at all in between eglSwapBuffers and wl_egl_window_resize, as otherwise EGL can already allocate a wrongly sized buffer for a next frame, so handle those together.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
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 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 97d05b0d 2016-12-09T05:12:27 Fixed a bunch of SwapWindow calls that needed their return value updated
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
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().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
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.
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
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.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo 272ebb8e 2014-01-09T13:56:21 Dynamic loading support for 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