SunOS: support swap & opengl detection

This commit is contained in:
Carter Li
2024-06-17 16:43:52 +08:00
parent 72d332772d
commit 1d6a48e49a
4 changed files with 44 additions and 7 deletions
+4 -4
View File
@@ -61,9 +61,9 @@ cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR B
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR BSD OR APPLE" OFF)
cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD OR SunOS" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF)
cmake_dependent_option(ENABLE_LIBNM "Enable libnm" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
@@ -791,7 +791,7 @@ elseif(SunOS)
src/detection/processes/processes_linux.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/swap/swap_nosupport.c
src/detection/swap/swap_sunos.c
src/detection/terminalfont/terminalfont_linux.c
src/detection/terminalshell/terminalshell_linux.c
src/detection/terminalsize/terminalsize_linux.c
+5 -1
View File
@@ -259,7 +259,11 @@ static const char* glxPrint(FFOpenGLResult* result)
#endif //FF_HAVE_GLX
#ifdef FF_HAVE_OSMESA
#include <GL/osmesa.h>
#if __has_include(<GL/osmesa.h>)
#include <GL/osmesa.h>
#else
#include <mesa/osmesa.h> // for sunos
#endif
typedef struct OSMesaData
{
+33
View File
@@ -0,0 +1,33 @@
#include "swap.h"
#include <sys/stat.h>
#include <sys/swap.h>
#include <limits.h>
enum { FFMaxNSwap = 8 };
const char* ffDetectSwap(FFSwapResult* swap)
{
char strings[FFMaxNSwap][PATH_MAX];
uint8_t buffer[sizeof(swaptbl_t) + sizeof(swapent_t) * (FFMaxNSwap - 1)] = {};
swaptbl_t* table = (swaptbl_t*) buffer;
table->swt_n = FFMaxNSwap;
for (int i = 0; i < FFMaxNSwap; ++i)
table->swt_ent[i].ste_path = strings[i];
int size = swapctl(SC_LIST, table);
if (size < 0)
return "swapctl() failed";
swap->bytesTotal = swap->bytesUsed = 0;
for (int i = 0; i < size; ++i)
{
swap->bytesTotal += (uint64_t) table->swt_ent[i].ste_pages;
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
}
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
swap->bytesTotal *= instance.state.platform.pageSize;
swap->bytesUsed *= instance.state.platform.pageSize;
return NULL;
}
+2 -2
View File
@@ -4,7 +4,7 @@
#include "common/option.h"
#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
typedef enum FFOpenGLLibrary
{
FF_OPENGL_LIBRARY_AUTO,
@@ -19,7 +19,7 @@ typedef struct FFOpenGLOptions
FFModuleBaseInfo moduleInfo;
FFModuleArgs moduleArgs;
#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
FFOpenGLLibrary library;
#endif
} FFOpenGLOptions;