Guest User

Linux 5.5 patch for nvidia-kernel-dkms 430.64-4~bpo10+1

a guest
Jan 11th, 2020
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/common/inc/nv-drm.h b/common/inc/nv-drm.h
  2. new file mode 100644
  3. index 0000000..07e9f3c
  4. --- /dev/null
  5. +++ b/common/inc/nv-drm.h
  6. @@ -0,0 +1,36 @@
  7. +#ifndef _NV_DRM_H_
  8. +#define _NV_DRM_H_
  9. +
  10. +#include "conftest.h"
  11. +
  12. +#if defined(NV_DRM_DRMP_H_PRESENT)
  13. +#include <drm/drmP.h>
  14. +#else
  15. +#include <linux/agp_backend.h>
  16. +#include <linux/file.h>
  17. +#include <linux/init.h>
  18. +#include <linux/jiffies.h>
  19. +#include <linux/kernel.h>
  20. +#include <linux/mutex.h>
  21. +#include <linux/slab.h>
  22. +#include <linux/types.h>
  23. +#include <asm/pgalloc.h>
  24. +#include <linux/uaccess.h>
  25. +
  26. +#include <uapi/drm/drm.h>
  27. +#include <uapi/drm/drm_mode.h>
  28. +
  29. +#include <drm/drm_agpsupport.h>
  30. +#include <drm/drm_crtc.h>
  31. +#include <drm/drm_drv.h>
  32. +#include <drm/drm_prime.h>
  33. +#include <drm/drm_pci.h>
  34. +#include <drm/drm_ioctl.h>
  35. +#include <drm/drm_sysfs.h>
  36. +#include <drm/drm_vblank.h>
  37. +#include <drm/drm_device.h>
  38. +
  39. +#include <drm/drm_gem.h>
  40. +#endif
  41. +
  42. +#endif
  43. diff --git a/conftest.sh b/conftest.sh
  44. index 9ad9d25..6005543 100644
  45. --- a/conftest.sh
  46. +++ b/conftest.sh
  47. @@ -1080,6 +1080,9 @@ compile_test() {
  48. CODE="
  49. #if defined(NV_DRM_DRMP_H_PRESENT)
  50. #include <drm/drmP.h>
  51. + #else
  52. + #include <drm/drm_drv.h>
  53. + #include <drm/drm_prime.h>
  54. #endif
  55. #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
  56. #error DRM not enabled
  57. @@ -1769,6 +1772,8 @@ compile_test() {
  58. echo "$CONFTEST_PREAMBLE
  59. #if defined(NV_DRM_DRMP_H_PRESENT)
  60. #include <drm/drmP.h>
  61. + #else
  62. + #include <drm/drm_drv.h>
  63. #endif
  64. #include <drm/drm_atomic.h>
  65. #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
  66. @@ -1897,7 +1902,11 @@ compile_test() {
  67. # attached drivers") in v3.14 (2013-12-11)
  68. #
  69. CODE="
  70. + #if defined(NV_DRM_DRMP_H_PRESENT)
  71. #include <drm/drmP.h>
  72. + #else
  73. + #include <drm/drm_drv.h>
  74. + #endif
  75. int conftest_drm_driver_has_legacy_dev_list(void) {
  76. return offsetof(struct drm_driver, legacy_dev_list);
  77. }"
  78. @@ -1921,7 +1930,11 @@ compile_test() {
  79. # 2017-07-23 e6fc3b68558e4c6d8d160b5daf2511b99afa8814
  80. #
  81. CODE="
  82. + #if defined(NV_DRM_DRMP_H_PRESENT)
  83. #include <drm/drmP.h>
  84. + #else
  85. + #include <drm/drm_crtc.h>
  86. + #endif
  87.  
  88. int conftest_drm_crtc_init_with_planes_has_name_arg(void) {
  89. return
  90. @@ -1937,7 +1950,11 @@ compile_test() {
  91. compile_check_conftest "$CODE" "NV_DRM_CRTC_INIT_WITH_PLANES_HAS_NAME_ARG" "" "types"
  92.  
  93. CODE="
  94. + #if defined(NV_DRM_DRMP_H_PRESENT)
  95. #include <drm/drmP.h>
  96. + #else
  97. + #include <drm/drm_encoder.h>
  98. + #endif
  99.  
  100. int conftest_drm_encoder_init_has_name_arg(void) {
  101. return
  102. @@ -1952,7 +1969,11 @@ compile_test() {
  103. compile_check_conftest "$CODE" "NV_DRM_ENCODER_INIT_HAS_NAME_ARG" "" "types"
  104.  
  105. echo "$CONFTEST_PREAMBLE
  106. + #if defined(NV_DRM_DRMP_H_PRESENT)
  107. #include <drm/drmP.h>
  108. + #else
  109. + #include <drm/drm_plane.h>
  110. + #endif
  111.  
  112. int conftest_drm_universal_plane_init_has_format_modifiers_arg(void) {
  113. return
  114. @@ -1979,7 +2000,11 @@ compile_test() {
  115. echo "#undef NV_DRM_UNIVERSAL_PLANE_INIT_HAS_FORMAT_MODIFIERS_ARG" | append_conftest "types"
  116.  
  117. echo "$CONFTEST_PREAMBLE
  118. + #if defined(NV_DRM_DRMP_H_PRESENT)
  119. #include <drm/drmP.h>
  120. + #else
  121. + #include <drm/drm_plane.h>
  122. + #endif
  123.  
  124. int conftest_drm_universal_plane_init_has_name_arg(void) {
  125. return
  126. @@ -3119,7 +3144,9 @@ compile_test() {
  127. # Introduce drm_framebuffer_{get,put}()) on 2017-02-28.
  128. #
  129. CODE="
  130. + #if defined(NV_DRM_DRMP_H_PRESENT)
  131. #include <drm/drmP.h>
  132. + #endif
  133. #if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT)
  134. #include <drm/drm_framebuffer.h>
  135. #endif
  136. @@ -3138,7 +3165,9 @@ compile_test() {
  137. # Introduce drm_gem_object_{get,put}()) on 2017-02-28.
  138. #
  139. CODE="
  140. + #if defined(NV_DRM_DRMP_H_PRESENT)
  141. #include <drm/drmP.h>
  142. + #endif
  143. #if defined(NV_DRM_DRM_GEM_H_PRESENT)
  144. #include <drm/drm_gem.h>
  145. #endif
  146. @@ -3157,7 +3186,9 @@ compile_test() {
  147. # introduce drm_dev_{get/put} functions) on 2017-09-26.
  148. #
  149. CODE="
  150. + #if defined(NV_DRM_DRMP_H_PRESENT)
  151. #include <drm/drmP.h>
  152. + #endif
  153. #if defined(NV_DRM_DRM_DRV_H_PRESENT)
  154. #include <drm/drm_drv.h>
  155. #endif
  156. diff --git a/nvidia-drm/nvidia-drm-connector.c b/nvidia-drm/nvidia-drm-connector.c
  157. index 857bb2c..4996257 100644
  158. --- a/nvidia-drm/nvidia-drm-connector.c
  159. +++ b/nvidia-drm/nvidia-drm-connector.c
  160. @@ -20,6 +20,8 @@
  161. * DEALINGS IN THE SOFTWARE.
  162. */
  163.  
  164. +#include <linux/version.h>
  165. +
  166. #include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
  167.  
  168. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  169. @@ -71,7 +73,11 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
  170. struct nv_drm_encoder *nv_detected_encoder = NULL;
  171.  
  172. struct NvKmsKapiDynamicDisplayParams *pDetectParams = NULL;
  173. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
  174. unsigned int i;
  175. +#else
  176. + struct drm_encoder *encoder = NULL;
  177. +#endif
  178.  
  179. BUG_ON(!mutex_is_locked(&dev->mode_config.mutex));
  180.  
  181. @@ -87,11 +93,16 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
  182. goto done;
  183. }
  184.  
  185. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
  186. for (i = 0;
  187. i < DRM_CONNECTOR_MAX_ENCODER && detected_encoder == NULL; i++) {
  188. struct drm_encoder *encoder;
  189. +#else
  190. + drm_connector_for_each_possible_encoder(connector, encoder) {
  191. +#endif
  192. struct nv_drm_encoder *nv_encoder;
  193.  
  194. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
  195. if (connector->encoder_ids[i] == 0) {
  196. break;
  197. }
  198. @@ -102,6 +113,7 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
  199. BUG_ON(encoder != NULL);
  200. continue;
  201. }
  202. +#endif
  203.  
  204. /*
  205. * DVI-I connectors can drive both digital and analog
  206. @@ -169,6 +181,10 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
  207. }
  208.  
  209. detected_encoder = encoder;
  210. +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
  211. +#else
  212. + break;
  213. +#endif
  214. }
  215. }
  216.  
  217. diff --git a/nvidia-drm/nvidia-drm-connector.h b/nvidia-drm/nvidia-drm-connector.h
  218. index f74e22c..099390d 100644
  219. --- a/nvidia-drm/nvidia-drm-connector.h
  220. +++ b/nvidia-drm/nvidia-drm-connector.h
  221. @@ -27,7 +27,7 @@
  222.  
  223. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  224.  
  225. -#include <drm/drmP.h>
  226. +#include "nv-drm.h"
  227.  
  228. #include "nvtypes.h"
  229. #include "nvkms-api-types.h"
  230. diff --git a/nvidia-drm/nvidia-drm-crtc.h b/nvidia-drm/nvidia-drm-crtc.h
  231. index 0a70f2f..5ccc96a 100644
  232. --- a/nvidia-drm/nvidia-drm-crtc.h
  233. +++ b/nvidia-drm/nvidia-drm-crtc.h
  234. @@ -29,7 +29,7 @@
  235.  
  236. #include "nvidia-drm-helper.h"
  237.  
  238. -#include <drm/drmP.h>
  239. +#include "nv-drm.h"
  240. #include "nvtypes.h"
  241. #include "nvkms-kapi.h"
  242.  
  243. diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
  244. index e861e3a..829db72 100644
  245. --- a/nvidia-drm/nvidia-drm-drv.c
  246. +++ b/nvidia-drm/nvidia-drm-drv.c
  247. @@ -39,7 +39,7 @@
  248.  
  249. #include "nvidia-drm-ioctl.h"
  250.  
  251. -#include <drm/drmP.h>
  252. +#include "nv-drm.h"
  253.  
  254. /*
  255. * Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
  256. diff --git a/nvidia-drm/nvidia-drm-encoder.h b/nvidia-drm/nvidia-drm-encoder.h
  257. index bbaf986..af341a8 100644
  258. --- a/nvidia-drm/nvidia-drm-encoder.h
  259. +++ b/nvidia-drm/nvidia-drm-encoder.h
  260. @@ -32,7 +32,7 @@
  261. #if defined(NV_DRM_DRM_ENCODER_H_PRESENT)
  262. #include <drm/drm_encoder.h>
  263. #else
  264. -#include <drm/drmP.h>
  265. +#include "nv-drm.h"
  266. #endif
  267.  
  268. #include "nvkms-kapi.h"
  269. diff --git a/nvidia-drm/nvidia-drm-fb.h b/nvidia-drm/nvidia-drm-fb.h
  270. index 7f292ce..d13bc4c 100644
  271. --- a/nvidia-drm/nvidia-drm-fb.h
  272. +++ b/nvidia-drm/nvidia-drm-fb.h
  273. @@ -27,7 +27,7 @@
  274.  
  275. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  276.  
  277. -#include <drm/drmP.h>
  278. +#include "nv-drm.h"
  279. #include "nvidia-drm-gem-nvkms-memory.h"
  280. #include "nvkms-kapi.h"
  281.  
  282. diff --git a/nvidia-drm/nvidia-drm-gem.h b/nvidia-drm/nvidia-drm-gem.h
  283. index a717d3d..052fef7 100644
  284. --- a/nvidia-drm/nvidia-drm-gem.h
  285. +++ b/nvidia-drm/nvidia-drm-gem.h
  286. @@ -29,7 +29,7 @@
  287.  
  288. #include "nvidia-drm-priv.h"
  289.  
  290. -#include <drm/drmP.h>
  291. +#include "nv-drm.h"
  292. #include "nvkms-kapi.h"
  293.  
  294. #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
  295. diff --git a/nvidia-drm/nvidia-drm-helper.c b/nvidia-drm/nvidia-drm-helper.c
  296. index da602ac..e5d6daa 100644
  297. --- a/nvidia-drm/nvidia-drm-helper.c
  298. +++ b/nvidia-drm/nvidia-drm-helper.c
  299. @@ -31,7 +31,7 @@
  300.  
  301. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  302.  
  303. -#include <drm/drmP.h>
  304. +#include "nv-drm.h"
  305. #if defined(NV_DRM_DRM_ATOMIC_UAPI_H_PRESENT)
  306. #include <drm/drm_atomic_uapi.h>
  307. #endif
  308. diff --git a/nvidia-drm/nvidia-drm-helper.h b/nvidia-drm/nvidia-drm-helper.h
  309. index 8f050d8..71c4b90 100644
  310. --- a/nvidia-drm/nvidia-drm-helper.h
  311. +++ b/nvidia-drm/nvidia-drm-helper.h
  312. @@ -27,7 +27,7 @@
  313.  
  314. #if defined(NV_DRM_AVAILABLE)
  315.  
  316. -#include <drm/drmP.h>
  317. +#include "nv-drm.h"
  318.  
  319. /*
  320. * drm_dev_put() is added by commit 9a96f55034e41b4e002b767e9218d55f03bdff7d
  321. diff --git a/nvidia-drm/nvidia-drm-modeset.h b/nvidia-drm/nvidia-drm-modeset.h
  322. index e2cb5c3..b377a80 100644
  323. --- a/nvidia-drm/nvidia-drm-modeset.h
  324. +++ b/nvidia-drm/nvidia-drm-modeset.h
  325. @@ -27,7 +27,7 @@
  326.  
  327. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  328.  
  329. -#include <drm/drmP.h>
  330. +#include "nv-drm.h"
  331.  
  332. struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev);
  333. void nv_drm_atomic_state_clear(struct drm_atomic_state *state);
  334. diff --git a/nvidia-drm/nvidia-drm-os-interface.h b/nvidia-drm/nvidia-drm-os-interface.h
  335. index f43f851..7f4ff8b 100644
  336. --- a/nvidia-drm/nvidia-drm-os-interface.h
  337. +++ b/nvidia-drm/nvidia-drm-os-interface.h
  338. @@ -29,7 +29,7 @@
  339.  
  340. #if defined(NV_DRM_AVAILABLE)
  341.  
  342. -#include <drm/drmP.h>
  343. +#include "nv-drm.h"
  344.  
  345. /* Set to true when the atomic modeset feature is enabled. */
  346. extern bool nv_drm_modeset_module_param;
  347. diff --git a/nvidia-drm/nvidia-drm-prime-fence.h b/nvidia-drm/nvidia-drm-prime-fence.h
  348. index 20da923..f3cc2b4 100644
  349. --- a/nvidia-drm/nvidia-drm-prime-fence.h
  350. +++ b/nvidia-drm/nvidia-drm-prime-fence.h
  351. @@ -27,7 +27,7 @@
  352.  
  353. #if defined(NV_DRM_AVAILABLE)
  354.  
  355. -#include <drm/drmP.h>
  356. +#include "nv-drm.h"
  357.  
  358. #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
  359.  
  360. diff --git a/nvidia-drm/nvidia-drm-priv.h b/nvidia-drm/nvidia-drm-priv.h
  361. index f16bea9..2b2cf23 100644
  362. --- a/nvidia-drm/nvidia-drm-priv.h
  363. +++ b/nvidia-drm/nvidia-drm-priv.h
  364. @@ -27,7 +27,7 @@
  365.  
  366. #if defined(NV_DRM_AVAILABLE)
  367.  
  368. -#include <drm/drmP.h>
  369. +#include "nv-drm.h"
  370.  
  371. #if defined(NV_DRM_DRM_GEM_H_PRESENT)
  372. #include <drm/drm_gem.h>
  373. diff --git a/nvidia-drm/nvidia-drm-utils.h b/nvidia-drm/nvidia-drm-utils.h
  374. index 33bf60c..1cdebe1 100644
  375. --- a/nvidia-drm/nvidia-drm-utils.h
  376. +++ b/nvidia-drm/nvidia-drm-utils.h
  377. @@ -27,7 +27,7 @@
  378.  
  379. #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
  380.  
  381. -#include <drm/drmP.h>
  382. +#include "nv-drm.h"
  383. #include "nvkms-kapi.h"
  384.  
  385. struct NvKmsKapiConnectorInfo*
RAW Paste Data