Commit Graph

1400 Commits

Author SHA1 Message Date
Sylvain Becker
f08b9a5b6b SDL_BlitScaled: prevent crash if dest width or height is 0 2020-12-29 16:02:52 +01:00
Manuel Alfayate Corchete
427c96ec11 [KMS/DRM] Rework some functions. 2020-12-29 14:24:38 +01:00
Sam Lantinga
3cb0e840e6 Fixed bug 5422 - KMSDRM_LEGACY: Add OpenBSD support
wahil1976

This patch adds support for OpenBSD to KMSDRM_LEGACY. Note that the patch won't be ported to the atomic KMSDRM backend because OpenBSD does not support atomic KMS properly yet.
2020-12-28 11:47:53 -08:00
Manuel Alfayate Corchete
7539ac8087 [KMS/DRM] Restore hacky code to point to TTY buffer on surface destruction b/c I lack alternatives. 2020-12-28 18:22:07 +01:00
Manuel Alfayate Corchete
86b81abea6 [KMS/DRM_LEGACY] Prevent mouse cursor from staying onscreen after window destruction. Patch by Ozkan Sezer. 2020-12-28 16:19:19 +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
Sylvain Becker
7186584b8d fix indentation (bug 5313) 2020-12-28 10:41:37 +01:00
Sylvain Becker
c2735c0bb9 Better scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:53:28 +01:00
Ozkan Sezer
a6beb2d264 SDL_PrivateLowerBlitScaled: remove unused local var 'a' 2020-12-28 01:10:02 +03:00
Sylvain Becker
30df2e4e36 Scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:00:11 +01:00
Sylvain Becker
f9b5f6cc0f Forward scale mode to SW renderer (Bug 5313) 2020-12-27 20:28:24 +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
Sam Lantinga
9838611a8b Fixed compiler crash building for iOS with clang 11.0.3 2020-12-23 15:52:12 -08:00
Sylvain Becker
4aebad77bd SDL_SoftStretchLowerLinear: try to make xcode buildbot compile (Bug 5313) 2020-12-23 22:50:50 +01:00
Sam Lantinga
93ccdee8c1 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley

stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf

The default implementation is based on the one used in the Windows RT video driver.
2020-12-23 13:47:49 -08:00
Sylvain Becker
8e20376f1a SDL_SoftStretchLinear: use SDL_INLINE (bug 5313) 2020-12-23 22:09:01 +01:00
Sylvain Becker
7b8d5b7dc3 SDL_SoftStretchLinear: fix implicit conversion (bug 5313) 2020-12-23 22:02:28 +01:00
Sylvain Becker
ae8a270f61 Add SDL_SoftStretchLowerLinear() (Bug 5313) 2020-12-23 21:37:40 +01:00
Sylvain Becker
050ee9a410 Split SDL_SoftStretch in Lower and Uppler functions (Bug 5313) 2020-12-23 21:32:01 +01:00
Manuel Alfayate Corchete
09fcc9ed17 [KMS/DRM][Vulkan] Fix small warning, thanks to Ozkan Sezer for spotting it. 2020-12-23 16:45:23 +01:00
Manuel Alfayate Corchete
a6dc838d52 [KMS/DRM][Vulkan] Only try to create a display mode when no suitable mode is found. 2020-12-23 16:22:46 +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
Sam Lantinga
4cd981609b Fixed whitespace 2020-12-21 09:44:25 -08:00
Manuel Alfayate Corchete
8766d6040b [Video/KMSDRM] Fix potetial access to freed structure and complete errorchecks. 2020-12-21 17:29:24 +01:00
Manuel Alfayate Corchete
b06ef3a18c [Video/KMSDRM] Manually re-show the cursor on window creation, if needed. 2020-12-21 01:53:11 +01:00
Ozkan Sezer
4198f0e52c fix uninitialized warnings in KMSDRM_CreateCursor() 2020-12-21 01:20:30 +03:00
Manuel Alfayate Corchete
a8dbcab132 [Video/KMSDRM] Don't copy the cursor bitmap to the cursor GBM BO until we're showing it. 2020-12-20 21:48:05 +01:00
Manuel Alfayate Corchete
2756b0f337 [Video/KMSDRM] Init and deinit mouse stuff at the same time that GBM stuff. 2020-12-20 14:29:58 +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
af1f91cb36 [Video/KMSDRM] Correct typo. 2020-12-19 20:21:07 +01:00
Manuel Alfayate Corchete
cf48955680 [Video/KMSDRM] Honor the device index in Vulkan. Add notes about the display index. 2020-12-19 20:15:50 +01:00
Manuel Alfayate Corchete
ab3a390e26 [Video/KMSDRM] Better ATOMIC caps testing: patch by Oskan Sezer. 2020-12-19 17:35:04 +01:00
Manuel Alfayate Corchete
436499f3ec [Video/KMSDRM] Comment out some debug info, adjust comments for future work. 2020-12-19 02:08:59 +01:00
Ozkan Sezer
6b81cac420 remove duplicated SDL_SetError after calling check_atomic_modesetting() 2020-12-19 01:25:50 +03:00
Manuel Alfayate Corchete
8952a61324 [Video/KMSDRM] Re-arrange display members setup. 2020-12-18 23:17:42 +01:00
Manuel Alfayate Corchete
f60f8d5d84 [Video/KMSDRM]: Add Vulkan support to the KMSDRM backend. 2020-12-18 22:53:51 +01:00
Ozkan Sezer
6ac0b23d3a SDL_DirectFB_video.c: DSPF_ABGR requires directfb >= 1.5.0 -- add guard. 2020-12-18 21:37:20 +03:00
Ozkan Sezer
6c4ab48471 SDL_kmsdrmvideo.c: check atomic modesetting in check_modesetting()
.. so that KMSDRM_CreateDevice() can fail and SDL_VideoInit() would
move on to next bootstrap member which is kmsdrm_legacy.  hopefully
fixes bug #5393.
2020-12-18 17:50:02 +03:00
Ozkan Sezer
10625f9d89 SDL_windowsmessagebox.c: go back to hg rev 14458 state.
encountering a NULL caption in AddDialogString() is intended, i.e.
AddDialogStaticIcon() sends it as NULL on purpose.
2020-12-17 23:50:00 +03:00
Ozkan Sezer
4d6eb30523 SDL_windowsmessagebox.c (AddDialogControl): add back NULL caption check.
because AddDialogStaticIcon() sends a NULL caption -- fixes bug #5401.
2020-12-17 23:28:20 +03:00
Ozkan Sezer
90456670b5 more "'for' loop initial declarations are only allowed in C99 mode" fixes 2020-12-17 14:11:00 +03:00
Ozkan Sezer
ed4fcb2cfc kmsdrm_legacy build fixes:
- add missing '_LEGACY' to symbol names
- perform missing 2.0.14 portage
- fix 'for' loop initial declarations are only allowed in C99 mode errors
2020-12-16 03:24:10 +03:00
Ozkan Sezer
9940e71088 Import two post-2.0.12 fixes to kmsdrm_legacy:
Fix build breakage without EGL:
https://hg.libsdl.org/SDL/rev/f2606fe53654e305ab9badb821d9d3afb7f92f49

Fix KMSDRM_CreateWindow segfault when starting L?VE2D engine (bug 5199)
https://hg.libsdl.org/SDL/rev/d2e69a78939463d9ff9448a5f4efd1e208bb97b0
2020-12-16 00:10:30 +03:00
Sam Lantinga
f8839289b0 Potential fix for bug 5393 - KMSDRM: using atomic mode setting breaks GPU compatibility
Substring

I was trying the KMSDRM video backend with some very simple programs that were working ok on 2.0.12. The same code won?t work on the current dev branch and I get:

DEBUG: check_modesetting: probing ?/dev/dri/card0?
DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6
DEBUG: check_modesetting: probing ?/dev/dri/card0?
DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6
DEBUG: KMSDRM_VideoInit()
DEBUG: Opening device /dev/dri/card0
DEBUG: Opened DRM FD (3)
DEBUG: no atomic modesetting support.
DEBUG: Video subsystem has not been initialized
INFO: Using SDL video driver: (null)
DEBUG: Video subsystem has not been initialized

After carefully checking, the radeon driver doesn?t support atomic modesetting. That?s not the only problem : the same happens with the amdgpu driver if we disable Display Core (kernel parameter amdgpu.dc=0, which is required to get analogue outputs working).

This is a major regression in the KMSDRM driver.

Using atomic mode setting is great, but having no fallback to the "standard KMS" is bad.
2020-12-15 12:22:48 -08:00
Sam Lantinga
ee85a41a32 Fixed compile warning 2020-12-13 02:10:46 -08:00
Ozkan Sezer
5c212cb0c5 remove a few stale NULL message/title checks after commit e2b729b1756a
top-level guarantees non-NULL message / title passed in messageboxdata
2020-12-10 12:24:24 +03:00
Ozkan Sezer
f1cab8aea6 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData
- SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title
  or message field to "" if either of them is NULL.
- SDL_video.c (SDL_ShowSimpleMessageBox):  set title or message to ""
  if either of them is NULL for EMSCRIPTEN builds.
- SDL_bmessagebox.cc: add empty string check along with NULL check for
  title and message fields.
- SDL_windowsmessagebox.c (AddDialogString): remove NULL string check
- SDL_windowsmessagebox.c (AddDialogControl):  add empty string check
  along with the NULL check.
- SDL_x11messagebox.c: revert commit 677c4cd68069
- SDL_os2messagebox.c: revert commit 2c2a489d76e7
- test/testmessage.c: Add NULL title and NULL message tests.
2020-12-10 11:20:56 +03:00
Sam Lantinga
d46dd103d9 Fixed typo in Vulkan load logic 2020-12-09 07:49:07 -08:00
Sam Lantinga
cb36189692 Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon

We should really stick this in SDL_internal.h or something so it's always available.
2020-12-09 07:16:22 -08:00
Sam Lantinga
50203d58b3 Fixed bug 5329 - SDL_SetWindowGrab(SDL_FALSE) fails to unlock cursor if window is partially offscreen
Ivan Mogilko

With SDL 2.0.12 under MS Windows, if the window is partially offscreen calling SDL_SetWindowGrab(w, SDL_TRUE) works, but subsequent call to SDL_SetWindowGrab(w, SDL_FALSE) does not work.

I tested this in both real program, and a small test app, where unlocking cursor worked perfectly while window is fully in desktop bounds, but did not work if it was at least few pixels outside.

For the reference, following code is enough to reproduce the issue:

#include <windows.h>
#include <SDL.h>

int WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR     lpCmdLine,
    int       nShowCmd)
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window* w = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 400, 0);

    bool grabbed = false;
    bool want_quit = false;
    while (!want_quit)
    {
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
            case SDL_QUIT: want_quit = true; break;
            case SDL_KEYDOWN:
                if (event.key.keysym.scancode == SDL_SCANCODE_SPACE)
                {
                    SDL_SetWindowGrab(w, static_cast<SDL_bool>(!grabbed));
                    grabbed = !grabbed;
                }
            }
        }
    }

    SDL_DestroyWindow(w);
    SDL_Quit();
    return 0;
}
2020-12-08 22:00:06 -08:00