mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
Distinguish open source and proprietary nvidia drivers in detect_proprietary
This commit is contained in:
parent
ffc603d451
commit
5be82a8574
1 changed files with 19 additions and 1 deletions
20
sway/main.c
20
sway/main.c
|
|
@ -58,7 +58,25 @@ void detect_proprietary(int allow_unsupported_gpu) {
|
||||||
size_t line_size = 0;
|
size_t line_size = 0;
|
||||||
while (getline(&line, &line_size, f) != -1) {
|
while (getline(&line, &line_size, f) != -1) {
|
||||||
if (strncmp(line, "nvidia ", 7) == 0) {
|
if (strncmp(line, "nvidia ", 7) == 0) {
|
||||||
if (allow_unsupported_gpu) {
|
FILE *taint_info = fopen("/sys/module/nvidia/taint", "r");
|
||||||
|
int taints_kernel = 1;
|
||||||
|
if (taint_info) {
|
||||||
|
char *flags = NULL;
|
||||||
|
size_t flag_len = 0;
|
||||||
|
if(getline(&flags, &flag_len, taint_info) != -1){
|
||||||
|
taints_kernel = strchr(flags, 'P') ? 1 : 0;
|
||||||
|
}
|
||||||
|
free(flags);
|
||||||
|
fclose(taint_info);
|
||||||
|
} else {
|
||||||
|
sway_log(SWAY_ERROR,
|
||||||
|
"Could not get Nvidia module taint information. "
|
||||||
|
"Assuming proprietary drivers are in use.");
|
||||||
|
}
|
||||||
|
if (!taints_kernel) {
|
||||||
|
sway_log(SWAY_INFO,
|
||||||
|
"Open source Nvidia drivers are in use. Bugs may still occour.");
|
||||||
|
} else if (allow_unsupported_gpu) {
|
||||||
sway_log(SWAY_ERROR,
|
sway_log(SWAY_ERROR,
|
||||||
"!!! Proprietary Nvidia drivers are in use !!!");
|
"!!! Proprietary Nvidia drivers are in use !!!");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue