diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-19 16:20:35 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-19 16:20:35 +0900 |
commit | 77aae06e6ce61ed2e8d67870195af6b892fd7529 (patch) | |
tree | 6e6d3fecf87434b8e18c2a1764f81f0bcdea143b /src/gpu.c | |
parent | ca970a654801650f4b99d2198dccd89da7b5e27c (diff) |
FreeBSD: GPU情報の修正
Diffstat (limited to 'src/gpu.c')
-rw-r--r-- | src/gpu.c | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -6,14 +6,6 @@ #include <unistd.h> const char *run_gpu_command(const char *command) { - if ( - access("/bin/glxinfo", F_OK) == -1 && - access("/usr/bin/glxinfo", F_OK) == -1 && - access("/usr/local/bin/glxinfo", F_OK) == -1 && - access("/usr/X11R6/bin/glxinfo", F_OK) == -1 && - access("/usr/X11R7/bin/glxinfo", F_OK) == -1 && - access("/usr/pkg/bin/glxinfo", F_OK) == -1 - ) return NULL; char buf[128]; char *out = NULL; size_t outsize = 0; @@ -49,7 +41,22 @@ const char *run_gpu_command(const char *command) { } const char *display_gpu() { +#if defined(__FreeBSD__) || defined(__DragonFly__) + return run_gpu_command("pciconf -lv | grep -B 4 -F \"VGA\" | " + "grep -F \"device\" | sed 's/^.* device//' | " + "sed \"s/^.* '//\" | sed \"s/'//\" | tail -1 | " + "sed 's/ Core Processor Integrated Graphics Controller//'"); +#else + if ( + access("/bin/glxinfo", F_OK) == -1 && + access("/usr/bin/glxinfo", F_OK) == -1 && + access("/usr/local/bin/glxinfo", F_OK) == -1 && + access("/usr/X11R6/bin/glxinfo", F_OK) == -1 && + access("/usr/X11R7/bin/glxinfo", F_OK) == -1 && + access("/usr/pkg/bin/glxinfo", F_OK) == -1 + ) return NULL; return run_gpu_command("glxinfo -B | grep -F 'OpenGL renderer string' | " "sed 's/OpenGL renderer string: //' | sed 's/Mesa //' | " "sed 's/DRI //' | sed 's/(R)//' | sed 's/(.*$//'"); +#endif } |