SDL/src/video/kmsdrm
Eric Curtin c0eada2019
Fix assumption that DRI_DEVNAME begins at 0 (#5865)
* Fix assumption that DRI_DEVNAME begins at 0

The existing logic of the code was to count every possible entry in
KMSDRM_DRI_PATH. After this a for loop would start trying to open
filename0, filename1, filename2, etc. In recent Linux kernels (say
5.18) with simpledrm, the lowest KMSDRM_DRI_DEVNAME is often
/dev/dri/card1, rather than /dev/dri/card0, causing the code to fail
once /dev/dri/card0 has failed to open. Running:

modprobe foodrm && modprobe bardrm && rmmod foodrm

before you try to run an application with SDL KMSDRM would have also
made this fail.

* Various changes from review

- Removed newline and period from SDL error
- Explicitely compare memcmp to zero (also changed to SDL_memcmp)
- Changed memcpy to strncpy
- Less aggressive line wrapping

* Various changes from review

- strncpy to SDL_strlcpy
- removed size hardcodings for KMSDRM_DRI_PATHSIZE and
  KMSDRM_DRI_DEVNAMESIZE
- made all KMSDRM_DRI defines, run-time variables to reduce bugs caused
  by these defines being more build-time on Linux and more run-rime on
  OpenBSD
- renamed openbsd69orgreater variable to moderndri
- altered comment from "if on OpenBSD" to add difference in 6.9

* Various changes from review

- Use max size of destination, rather than max size of source
- Less hardcodings
2022-07-06 09:00:16 -07:00
..
SDL_kmsdrmdyn.c Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmdyn.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmevents.c Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmevents.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmmouse.c Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmmouse.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmopengles.c Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmopengles.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmsym.h Add clang-format on/off comments where necessary. 2022-05-19 01:31:29 -07:00
SDL_kmsdrmvideo.c Fix assumption that DRI_DEVNAME begins at 0 (#5865) 2022-07-06 09:00:16 -07:00
SDL_kmsdrmvideo.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00
SDL_kmsdrmvulkan.c Fix some typos in diagnostic messages 2022-06-13 08:33:27 -07:00
SDL_kmsdrmvulkan.h Updated copyright for 2022 2022-01-03 09:40:21 -08:00