From 99abcbb2bc3f1696e92681e840658933e05362cb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 18 Jun 2019 14:15:10 -0700 Subject: [PATCH] Fixed bug 4624 - KMS/DRM fails on FreeBSD because /dev/dri/card* nodes are symlinks Jan Martin Mikkelsen Patch to scan /dev/dri based on names rather than file type Loading KMS/DRM on FreeBSD fails because the "available" code in the driver checks for character device nodes under /dev/dri and the /dev/dri/card* files are symlinks rather than device nodes nodes on FreeBSD. The symlink points to /dev/drm/0. The attached patch counts /dev/dri/card* entries rather than directory entries which are character devices. --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 8562d35e1..ea103cb31 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -101,7 +101,7 @@ static int get_dricount(void) folder = opendir(KMSDRM_DRI_PATH); if (folder) { while ((res = readdir(folder))) { - if (res->d_type == DT_CHR) { + if (res->d_namlen > 4 && strncmp(res->d_name, "card", 4)) { devcount++; } }