0004-bb_nvidia_drm_detection_bug699_01.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From bcfe4dd16dd6194f1edbdc53b874a4f408343c5c Mon Sep 17 00:00:00 2001
  2. From: Abuzer Rafey <abuzer@rafey.xyz>
  3. Date: Wed, 13 Apr 2016 01:11:09 -0400
  4. Subject: [PATCH] Workaround for nvidia_drm in newer drivers
  5. ---
  6. src/module.c | 20 ++++++++++++++++++++
  7. 1 file changed, 20 insertions(+)
  8. diff --git a/src/module.c b/src/module.c
  9. index b5a4d79..db9736a 100644
  10. --- a/src/module.c
  11. +++ b/src/module.c
  12. @@ -113,6 +113,25 @@ int module_unload(char *driver) {
  13. }
  14. }
  15. + else if (module_is_loaded("nvidia_drm") == 1) {
  16. + int retries = 30;
  17. + bb_log(LOG_INFO, "Unloading nvidia_drm driver\n");
  18. + char *mod_argv[] = {
  19. + "modprobe",
  20. + "-r",
  21. + "nvidia_drm",
  22. + NULL
  23. + };
  24. + bb_run_fork_wait(mod_argv, 10);
  25. + while (retries-- > 0 && module_is_loaded("nvidia_drm") == 1) {
  26. + usleep(100000);
  27. + }
  28. + if (module_is_loaded(driver) == 1) {
  29. + bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
  30. + return 0;
  31. + }
  32. + }
  33. +
  34. else if (module_is_loaded("nvidia_modeset") == 1) {
  35. int retries = 30;
  36. bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
  37. @@ -175,3 +194,4 @@ int module_is_available(char *module_name) {
  38. };
  39. return bb_run_fork(mod_argv, 1) == EXIT_SUCCESS;
  40. }
  41. +