Commit graph

79 commits

Author SHA1 Message Date
Sam Lantinga e9b86eebf3 Functions which return function pointers now return SDL_FunctionPointer instead of void*
This fixes the clang warning "Cast between pointer-to-function and pointer-to-object is an extension"

You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.

Fixes https://github.com/libsdl-org/SDL/issues/2866
2023-01-09 15:46:21 -08:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sylvain Becker 07808d6a03
Remove underscore in guard header defines (#6922) 2022-12-27 12:31:12 -08:00
Sam Lantinga 63724c113b Removed the vi format comments from the source
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style.

Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Sam Lantinga 5750bcb174
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
2022-11-30 12:51:59 -08:00
Sam Lantinga c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
slime 52f4cc843d Remove SDL_SetWindowBrightness and SDL_SetWindowGammaRamp. 2022-11-25 13:28:56 -08:00
Sam Lantinga b0840eb32e Updated SDL_syswm.h for SDL 3.0
* The header is no longer dependent on SDL build configuration
* The structures are versioned separately from the rest of SDL
* SDL_GetWindowWMInfo() now returns a standard result code and is passed the version expected by the application
* Updated WhatsNew.txt and docs/README-migration.md with the first API changes in SDL 3.0
2022-11-23 14:05:59 -08:00
antonino e3ea9b5b7c restore vrr state on exit 2022-08-22 18:43:43 -07:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Davis Mosenkovs 66b0a6ee15 workaround for libmali gbm_device_get_fd()
gbm_device_get_fd() in at least some libmali versions duplicates handle.
Other implementations do not do duplication. To prevent handle leak save
drm_fd in SDL_DisplayData.
2021-11-30 16:20:24 -08:00
Anthony Pesch 5a296e2589 kmsdrm: avoid overriding the mode requested by SDL_SetWindowDisplayMode
when recreating surfaces
2021-06-24 12:12:29 -07:00
Anthony Pesch fc508eabe2 kmsdrm: remove redundant modeset_pending flag
this variable was added in commit 2067a7db8e and
ultimately tracks if this is a surface's first present. checking if the current
bo is NULL provides the same functionality and cuts down on a redundant piece
of state potentially getting out of sync in the future
2021-06-01 15:32:02 -07:00
Anthony Pesch 4c965b7a8d kmsdrm: fix SetDisplayMode binding the the wrong surface / context
SetDisplayMode needs to recreate the EGL surfaces, which then need to be
bound along with the correct context in each rendering thread

commit 3a1d7d9c9a removed this behavior which
has broken using SetDisplayMode when rendering with multiple contexts

the commit message was rather vague, but if the surfaces do need to be
created immediately, this process probably needs to be split such that
surface is created immediately, but the binding is deferred
2021-06-01 15:32:02 -07:00
Anthony Pesch fd5de93a02 kmsdrm: fix gbm surface dimensions not matching the mode being set
commit 2067a7db8e introduced new surface_w and surface_h
variables which were passed to gbm_surface_create rather than the dimensions from the
drmModeModeInfo structure. commit 5105ecf8b1 further
refactored this code and no longer synchronized these variables inside
KMSDRM_SetDisplayMode, breaking it

this change removes the variables since they're seemingly redundant to begin with
2021-06-01 15:32:02 -07:00
vanfanel 100166d7d7 [KMSDRM] Improve cursor management. 2021-03-22 10:48:02 -07:00
vanfanel 281a7bdbb3 [KMSDRM] Make the gbm_init flag a viddata member to avoid GBM re-init when several displays are connected. 2021-03-18 11:04:28 -07:00
Cacodemon345 d2d834b990 KMSDRM: Add gamma support 2021-02-25 11:39:10 -08:00
Manuel Alfayate Corchete bfa51c3845 [KMS/DRM] Fix for bug #5518: only do async pageflips when hardware supports them. 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete 8d95aba174 [KMS/DRM] Remove unused KMSDRM_SetWindowGrab prototype in header file. 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete b17c49509b [KMS/DRM] Patch for bug #5513. KMSDRM backend can now manage and use several displays. 2021-02-10 10:22:18 -05:00
Sam Lantinga f23022ef97 Removed non-functional window grab implementations 2021-02-10 10:22:16 -05:00
Cameron Gutman a0d3c6c63c Rename SetWindowGrab() to SetWindowMouseGrab() 2021-02-10 10:22:16 -05:00
Manuel Alfayate Corchete 03665004d0 [KMS/DRM] Small fix to KMSDRM_Waitpageflip(). More comments on how it works. 2021-01-24 00:51:23 -05:00
Manuel Alfayate Corchete aac74db685 [KMS/DRM] Enable async pageflips. 2021-01-13 15:54:26 +01:00
Manuel Alfayate Corchete 5105ecf8b1 [KMS/DRM] Move surface size info to window driverdata, for coherency. 2021-01-11 21:02:07 +01:00
Manuel Alfayate Corchete 2067a7db8e [KMS/DRM] Fix fullscreen to windowed transition. Fix aspect ratio correction without using planes. 2021-01-11 20:29:09 +01:00
Manuel Alfayate Corchete 850d9c8c0d [KMS/DRM] Cleanup remainings from plane/scaling usage. 2021-01-09 02:25:13 +01:00
Manuel Alfayate Corchete 2aeb317743 [KMS/DRM] Fix vkQuake3 in OpenGL mode. 2021-01-08 22:00:28 +01:00
Manuel Alfayate Corchete b24494734b [KMS/DRM] Go back to the LEGACY interface only because using planes breaks compatibility with HW, so no advantage on using ATOMIC. 2021-01-08 18:57:12 +01:00
Manuel Alfayate Corchete cef1bd0639 [KMS/DRM] Prevent creating another default cursor everytime a window is created. Other fixes and cleanups. 2021-01-08 13:14:42 +01:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Manuel Alfayate Corchete 427c96ec11 [KMS/DRM] Rework some functions. 2020-12-29 14:24:38 +01:00
Manuel Alfayate Corchete 0feaf7d196 [KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created). 2020-12-28 14:37:58 +01:00
Manuel Alfayate Corchete 46d31d570d [KMS/DRM][Vulkan] Fix segfault when changing fullscren mode and permanent cursor when changing between Vulkan and GL renderers in vkQuake3. Tidy up window destruction code. 2020-12-27 00:43:06 +01:00
Manuel Alfayate Corchete 2fc987c28f [Buildsystem] Add guards for not building with KMSDRM support if EGL is not available. 2020-12-22 14:15:33 +01:00
Manuel Alfayate Corchete cf71e01734 [Video/KMSDRM] Remove auxiliary AMDGPU compatibility workarounds not needed anymore. 2020-12-19 23:32:09 +01:00
Manuel Alfayate Corchete f60f8d5d84 [Video/KMSDRM]: Add Vulkan support to the KMSDRM backend. 2020-12-18 22:53:51 +01:00
Manuel Alfayate Corchete 63b7827709 kmsdrm: properly exit with an error when ATOMIC interface is not yet available, instead of just segfaulting. 2020-10-22 19:44:38 +02:00
Manuel Alfayate Corchete 87a86675ed kmsdrm: Always use spaces for indentation. Always use SDL_calloc() for calloc. 2020-10-22 16:01:51 +02:00
Manuel Alfayate Corchete 0cb9bfa502 kmsdrm: less excessive error checkhing 2020-09-12 15:58:47 +02:00
Manuel Alfayate Corchete 9e9227add3 kmsdrm: reimplement modesetting for fullscreen window scaling and AR-correction. 2020-09-12 04:52:56 +02:00
Manuel Alfayate Corchete 4575c6942a kmsdrm: delete ununsed variable. 2020-09-12 02:36:02 +02:00
Ryan C. Gordon 3c6004feb7 kmsdrm: Choose how to swap buffers based on EGL extension availability. 2020-09-10 15:07:23 -04:00
Manuel Alfayate Corchete 0f807fd607 kmsdrm: use a black dumb buffer for keeping the PRIMARY PLANE occupied when we destroy the KMS buffers, instead of using the TTY buffer, to avoid flickering. 2020-09-07 22:54:15 +02:00
Manuel Alfayate Corchete cce6c60518 kmsdrm: fix errors when trying to free up videomode driverdata pointers on quit. 2020-09-07 01:33:04 +02:00
Manuel Alfayate Corchete daa752b10e kmsdrm: fix first frame display: no need to wait for SwapWindow() for EGL surface creation. 2020-09-06 23:19:54 +02:00
Manuel Alfayate Corchete d7aebbd58f kmsdrm: Don't create surfaces until EGL context is available. 2020-09-06 12:08:22 +02:00
Manuel Alfayate Corchete f4e02a5c1b kmsdrm: Do NOT modify window size manually from the backend: doing so caused renderer scaling params miscalculation. 2020-08-31 19:17:17 +02:00
Manuel Alfayate Corchete 31b1794534 kmsdrm: use PLANE and CRTC to do hardware-driven window scaling and AR-correction. 2020-08-28 22:38:26 +02:00