Commit Graph

1380 Commits

Author SHA1 Message Date
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
Sylvain Becker
035f8f2391 SDL_RecreateWindow: allow clearing VULKAN when recreating the window 2020-12-02 13:37:59 +01:00
Sylvain Becker
93fbab0fac SDL_ReCreateWindow: allow to unload METAL window and switch back to OpenGL.
On older mac, where METAL Renderer METAL fails to create, it allows to switch back to OpenGL SDL_Renderer
by re-creating the window (METAL flags was previously persistent).
2020-12-02 11:04:53 +01:00
Sam Lantinga
a0c5bfa3bd Moved raw input event processing from the main thread to the joystick thread
This allows fast joystick event delivery regardless of what the main thread is doing.
2020-11-27 13:08:40 -08:00
Sylvain Becker
2c079a2f6c SDL_FillRects: prevent empty SDL_surface from raising an error message
It's legitimate to have a surface with 0 width or height (null 'pixels' pointer).
But calling SDL_FillRects would wrongly set the error "You must lock the surface".
2020-11-27 09:42:14 +01:00
Sam Lantinga
4121ab6200 Fixed bug 5354 - DirectFB: Add Vulkan support
Nicolas Caramelli

This patch adds Vulkan support for the DirectFB video driver.
A screenshot with SDL tests running on DirectFB is available on the HiGFXback project:

https://github.com/caramelli/higfxback/wiki/DirectFB#sdl
2020-11-23 21:25:07 -08:00
Ryan C. Gordon
0ff5d55a07 x11: Don't try to grab the pointer on an unmapped window (thanks, Lee!)
Fixes Bugzilla #5352.
2020-11-23 21:07:28 -05:00
Ozkan Sezer
082558db33 SDL_os2messagebox.c (_makeDlg): fix crash if title and/or message is NULL.
c.f.: bug #5253.
2020-11-20 12:20:02 +03:00
Ryan C. Gordon
335cfa107b x11: Don't crash if a messagebox has a NULL title string.
Fixes Bugzilla #5253.
2020-11-18 11:24:08 -05:00
Cameron Gutman
72379ba510 windows: Fix handling of swapped mouse buttons
GetAsyncKeyState() and GetRawInputData() report the state of the physical
buttons without applying the user's primary/secondary mouse button swap
preference. Swap the buttons returned from these functions, so we expose a
consistent view of the buttons to SDL callers. This new behavior also matches
the behavior of macOS and X11 backends.

See the Remarks section of the GetAsyncKeyState() function on MSDN.
2020-08-25 21:22:00 -07:00
Cameron Gutman
771732ed32 windows: Fix numpad arrow key scancodes with numlock off
We should only perform the VK_LEFT, VK_UP, etc. mapping if none of the other
special mappings apply. This allows the scancode normalization for the number
pad to take place as intended.
2020-08-27 17:54:52 -07:00
Ozkan Sezer
53b166797d SIZE_MAX need not be defined in limits.h
it can be in limits.h (windows) or stdint.h.
2020-11-11 12:33:55 +03:00
Ryan C. Gordon
7b5a0a9f97 uikit: Don't implement main() twice for iOS static libs.
I think this was a leftover from before the two Xcode projects were merged.
2020-11-10 13:12:10 -05:00
Sam Lantinga
1ef45c1801 Fixed bug 5339 - Minor memory leak in SDL_x11events.c
wcodelyokoyt

The atom name that X11_GetAtomName() returns never gets freed, which result in a minor memory leak (14 bytes?) every time the user drops a file on a window.
You can see the line in question here:
6b6170caf6/src/video/x11/SDL_x11events.c (L1350)

Fix: call XFree on name after the while loop.
2020-11-08 23:40:17 -08:00
Sam Lantinga
723d76c8ec Fixed bug 5333 - Replace character of legacy code page with utf-8 one.
Joel Linn

This patch fixes a MSVC warning, which is dependent on the regional settings of the build system. Although the character is inside a comment and harmless, it is undesirable to disable the warning for this.
2020-11-08 23:34:59 -08:00
Ryan C. Gordon
de6d0ac55a uikit: Patched to compile on older iOS SDKs. 2020-11-08 18:11:42 -05:00
Ryan C. Gordon
010d5fba93 kmsdrm: Make this build with significantly older system libraries.
This allows one to build Raspberry Pi versions on an ancient version of
Raspbian and get both the KMSDRM and RPI video targets built into SDL, giving
maximum binary compatibility from linking against an older glibc, etc, but
also making one library that can access video on all RPi models and OS
releases.
2020-10-26 09:49:09 -04:00
Ozkan Sezer
f0c5841714 SDL_shape_internals.h: forward-declare struct SDL_ShapeTree. 2020-10-25 10:10:10 +03:00
Ozkan Sezer
bfc80d83c2 minor coding style cleanup 2020-10-25 03:55:02 +03:00
Sam Lantinga
5dc6c3c951 Updated Vulkan headers to version 1.2.158
https://github.com/KhronosGroup/Vulkan-Headers
2020-10-24 10:46:18 -07:00
Manuel Alfayate Corchete
5682b066e9 kmsdrm: Add comment about KMSDRM_VideoQuit() changes. 2020-10-22 19:51:57 +02:00