aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-04-12 10:04:28 -0400
committerDrew DeVault <sir@cmpwn.com>2017-04-12 10:04:44 -0400
commitb3541d9dc5e3037889026d3d918b174d9ecc9567 (patch)
treeda7b2dbe82457d3f446cf094cc02e809bcd72a19
parentb036ad9b547f6b0bdc7ee248fbf3166621f733bb (diff)
downloadsway-b3541d9dc5e3037889026d3d918b174d9ecc9567.zip
sway-b3541d9dc5e3037889026d3d918b174d9ecc9567.tar.gz
sway-b3541d9dc5e3037889026d3d918b174d9ecc9567.tar.bz2
Implement more thourough nvidia config check
-rw-r--r--sway/main.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/sway/main.c b/sway/main.c
index ab6ecc1..39bf225 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -57,24 +57,55 @@ void detect_proprietary() {
if (!f) {
return;
}
+ bool nvidia = false, nvidia_modeset = false, nvidia_uvm = false, nvidia_drm = false;
while (!feof(f)) {
char *line;
if (!(line = read_line(f))) {
break;
}
if (strstr(line, "nvidia")) {
- fprintf(stderr, "\x1B[1;31mWarning: Proprietary nvidia driver support is considered experimental.\x1B[0m\n");
- free(line);
- break;
+ nvidia = true;
+ }
+ if (strstr(line, "nvidia_modeset")) {
+ nvidia_modeset = true;
+ }
+ if (strstr(line, "nvidia_uvm")) {
+ nvidia_uvm = true;
+ }
+ if (strstr(line, "nvidia_drm")) {
+ nvidia_drm = true;
}
if (strstr(line, "fglrx")) {
- fprintf(stderr, "\x1B[1;31mWarning: Proprietary AMD drivers do NOT support Wayland. Use radeon.\x1B[0m\n");
+ fprintf(stderr, "\x1B[1;31mWarning: Proprietary AMD drivers do "
+ "NOT support Wayland. Use radeon.\x1B[0m\n");
free(line);
break;
}
free(line);
}
fclose(f);
+ if (nvidia) {
+ fprintf(stderr, "\x1B[1;31mWarning: Proprietary nvidia driver support "
+ "is considered experimental. Nouveau is strongly recommended."
+ "\x1B[0m\n");
+ if (!nvidia_modeset || !nvidia_uvm || !nvidia_drm) {
+ fprintf(stderr, "\x1B[1;31mWarning: You do not have all of the "
+ "necessary kernel modules loaded for nvidia support. "
+ "You need nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm."
+ "\x1B[0m\n");
+ }
+ f = fopen("/proc/cmdline", "r");
+ if (f) {
+ char *line = read_line(f);
+ if (line && !strstr(line, "nvidia-drm.modeset=1")) {
+ fprintf(stderr, "\x1B[1;31mWarning: You must add "
+ "nvidia-drm.modeset=1 to your kernel command line to use "
+ "the proprietary driver.\x1B[0m\n");
+ }
+ fclose(f);
+ free(line);
+ }
+ }
}
void run_as_ipc_client(char *command, char *socket_path) {