diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-24 20:29:06 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-10-30 17:23:27 -0400 |
commit | 1bc91e0a0949e429c96b1bc65a7222cb4797e0c9 (patch) | |
tree | 4210724a73677c96984ab11c63a91a8aa2bb5f18 | |
parent | d0367d1a6708f797bab1a9e2cd744b6e9bf2a49d (diff) | |
download | sway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.zip sway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.tar.gz sway-1bc91e0a0949e429c96b1bc65a7222cb4797e0c9.tar.bz2 |
Merge pull request #1430 from dlrobertson/nvidia_drm
nvidia: Validate the nvidia_drm module options
-rw-r--r-- | sway/main.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 6d13955..cc9147b 100644 --- a/sway/main.c +++ b/sway/main.c @@ -135,6 +135,29 @@ void detect_proprietary() { "You need nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm." "\x1B[0m\n"); } +#ifdef __linux__ + f = fopen("/sys/module/nvidia_drm/parameters/modeset", "r"); + if (f) { + char *line = read_line(f); + if (line && strstr(line, "Y")) { + // nvidia-drm.modeset is set to 0 + fprintf(stderr, "\x1B[1;31mWarning: You must load " + "nvidia-drm with the modeset option on to use " + "the proprietary driver. Consider adding " + "nvidia-drm.modeset=1 to your kernel command line " + "parameters.\x1B[0m\n"); + } + fclose(f); + free(line); + } else { + // nvidia-drm.modeset is not set + fprintf(stderr, "\x1B[1;31mWarning: You must load " + "nvidia-drm with the modeset option on to use " + "the proprietary driver. Consider adding " + "nvidia-drm.modeset=1 to your kernel command line " + "parameters.\x1B[0m\n"); + } +#else f = fopen("/proc/cmdline", "r"); if (f) { char *line = read_line(f); @@ -146,6 +169,7 @@ void detect_proprietary() { fclose(f); free(line); } +#endif } } |