Manuel Alfayate Corchete
ead3c406a2
[KMS/DRM] Refactor, improve and re-comment async pageflips code.
2021-01-13 20:11:01 +01:00
Manuel Alfayate Corchete
aac74db685
[KMS/DRM] Enable async pageflips.
2021-01-13 15:54:26 +01:00
Manuel Alfayate Corchete
85e8adf78d
[KMS/DRM] Unused code cleaning.
2021-01-11 22:28:27 +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
21003b7db2
[KMS/DRM] Small refactoring on the SwapWindow function.
2020-12-31 14:31:29 +01:00
Manuel Alfayate Corchete
e34caa9779
[KMS/DRM] Correct EGL/GL library loading on window creation, thus saving window re-creation.
2020-12-31 01:31:57 +01: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
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
f60f8d5d84
[Video/KMSDRM]: Add Vulkan support to the KMSDRM backend.
2020-12-18 22:53:51 +01: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
5bed30dd61
kmsdrm: also do pending modeseting in SwapWindowDoubleBuffered().
2020-09-12 04:56:55 +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
a6d182d326
kmsdrm: no need to reconnect/reactivate things in SwapWindowDoubleBuffered().
2020-09-11 23:47:26 +02:00
Manuel Alfayate Corchete
47e2d0304e
kmsdrm: greatly improve comments in SwapBuffersFenced() for future reference.
2020-09-10 23:26: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
Ryan C. Gordon
c7e761f872
kmsdrm: Patched to compile if EGL headers lack EGL_ANDROID_native_fence_sync.
2020-09-10 15:05:55 -04:00
Ryan C. Gordon
224aa45b59
kmsdrm: Implement GL_DefaultProfileConfig for Raspberry Pi compatibility.
...
If we think this might be a Raspberry Pi device, default to ES2. Otherwise,
accept SDL's higher-level defaults.
2020-09-10 15:04:35 -04:00
Manuel Alfayate Corchete
055cad49b6
kmsdrm: no need to re-connect/reactivate things in SwapWindow() anymore because we use a dumb buffer on KMS buffers destruction now.
2020-09-10 02:15:53 +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
68ac9349aa
kmsdrm: more coherent returns for SwapWindow.
2020-09-06 12:48:39 +02:00
Manuel Alfayate Corchete
d3d9d432ac
kmsdrm: Remove debug printfs in SwapWindow.
2020-09-06 12:17:27 +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
Manuel Alfayate Corchete
9b43464d81
kmsdrm: Add programmer credits to the Atomic KMSDRM driver.
2020-08-25 16:30:23 +02:00
Manuel Alfayate Corchete
9316a8d979
kmsdrm: move FENCE FD props setting to SwapWindow(), where it belongs.
2020-08-25 16:18:49 +02:00
Manuel Alfayate Corchete
d43e666eed
kmsdrm: Buffer management refactoring. Fixes for compatibility with more video drivers.
2020-08-25 04:05:36 +02:00
Manuel Alfayate Corchete
0d593d7ead
kmsdrm: Add error control to plane prop setting function. Do most plane prop setting with a single function.
2020-08-23 23:44:07 +02:00
Manuel Alfayate Corchete
0b7b7721b9
kmsdrm: remove redundant function, use drm_atomic_setbuffers() for disconnecting planes instead.
2020-08-23 03:13:50 +02:00
Manuel Alfayate Corchete
16c04f266a
kmsdrm: Init cursor surface on SetCursor() ONLY. Removal of dynamic modeset because it causes A LOT of problems with some kernel video drivers. Some refactoring and cleanups.
2020-08-23 02:58:57 +02:00
Manuel Alfayate Corchete
5d32eda956
kmsdrm: implement smarter surface recreation function to be used in videomode changes. Other minor arrangements.
2020-08-19 01:31:22 +02:00
Manuel Alfayate Corchete
92cb9192e3
kmsdrm: move hardware cursor functionality to the ATOMIC interface. Disconnect the display plane from the GBM surface buffers before destroying the GBM surface.
2020-08-17 18:35:04 +02:00
Manuel Alfayate Corchete
c437729b21
kmsdrm: separate requests in different functions so we only need one atomic commit for everything, as expected by atomic design.
2020-08-08 14:27:55 +02:00
Manuel Alfayate Corchete
3b9f1073c6
kmsdrm: wait for possible pending atomic commits before destroying surfaces, and before restoring video on quit. Move messages to the SDL_Log* functions.
2020-08-07 11:53:04 +02:00
Manuel Alfayate Corchete
96c99693a2
kmsdrm: wait for pending atomic commits before restoring videomode and crtc->buffer on VideoQuit, and simplify double-buffer SwapWindow() implementation.
2020-08-06 01:36:56 +02:00
Manuel Alfayate Corchete
09692b6170
kmsdrm: move videomode restoration on VideoQuit() to using the atomic interface instead of the legacy drmModeSetCrtc() function. Refactoring of get_plane_id().
2020-08-05 18:55:22 +02:00
Manuel Alfayate Corchete
2d69ce08ba
kmsdrm: double and triple buffered versions of SwapWindow() are now both reimplemented in atomic pageflipping versions, and can be selected via SDL_VIDEO_DOUBLE_BUFFER env variable.
2020-08-05 02:06:59 +02:00
Manuel Alfayate Corchete
8996ee1786
kmsdrm: update SwapWindow fn, moving it to triple-buffer.
2020-08-03 22:24:49 +02:00
Manuel Alfayate Corchete
b131661c6d
kmsdrm: rewrite the new SwapWindow() fn to avoid tearing. Double-buffer only for now.
2020-08-01 18:23:34 +02:00
Manuel Alfayate Corchete
1a5503ce9f
kmsdrm: Moved to the ATOMIC KMS/DRM interface for buffer swapping, leaving DRM-legacy behind.
2020-07-28 21:11:25 +02:00
Manuel Alfayate Corchete
412b21b0e8
Rename the gbm device struct from gbm to gbm_dev for better readabilty.
2020-07-20 11:42:23 +02:00
Manuel Alfayate Corchete
b6a818b6a2
Fix SDL_Window recreation: drmModeSetCrtc() has to be called everytime the EGL and GBM surfaces are recreated.
2020-07-19 18:45:29 +02:00
Sam Lantinga
1df0a1e497
Fixed bug 5140 - KMSDRM: Dynamic vsync toggle does not work
...
Manuel Alfayate Corchete
The KMSDRM backend was doing things wrong because of some small (but important) misconceptions on how KMS/DRM works: to implement a largely broken non-vsync refresh mechanism, the SwapWindow() function was issuing new pageflips before previous ones had completed, thus causing EBUSY returns, buffer mismanagement, etc... resulting in general breakage on vsync disabling from apps, that would not allow vsync to work again without KMSDRM video re-initialization.
To further clarify, on most DRM drivers async pageflips are NOT working nowadays, so all issued pageflips will complete on next VBLANK, NOT ASAP (calling drmModePageFlip() with the DRM_MODE_PAGE_FLIP_ASYNC flag will return error).
The old code was assuming that can just issue a synchronous (=on VBLANK) pageflip and then pass a 0 timeout to the pull() function so we do not wait for the pageflip event, thinking that this will lead to correct non-vsynced screen updates from the program: That is plain wrong.
Each pageflip has to be waite before issuing a new one, ALWAYS. And if we do not support ASYNC pageflips on the DRM driver level, then we are forced to wait for the next VBLANK. There is no way around it.
I have also added many comments on the KMSDRM code. This is needed for future reference for me or others who may need to look at this code: KMS/DRM terminology regarding what SYNC and ASYNC mean in pageflip terms, and where to do certain things and why, is not trivial. It is not desirable or possible to invest time on researching the same concepts every time there is need to dive into this code. So please leave all these comments in the patch.
2020-05-26 16:27:00 -07:00