Guest User

Untitled

a guest
Apr 2nd, 2025
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. --- intel_display_driver.c
  2. +++ intel_display_driver.c
  3. @@ -30,6 +30,7 @@
  4. #include "intel_display_debugfs.h"
  5. #include "intel_display_driver.h"
  6. #include "intel_display_irq.h"
  7. +#include "intel_display_params.h"
  8. #include "intel_display_power.h"
  9. #include "intel_display_types.h"
  10. #include "intel_display_wa.h"
  11. @@ -221,9 +222,11 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915)
  12.  
  13. intel_bios_init(display);
  14.  
  15. - ret = intel_vga_register(display);
  16. - if (ret)
  17. - goto cleanup_bios;
  18. + if (!display->params.enable_hd_vgaarb || !HAS_PCH_SPLIT(i915)) {
  19. + ret = intel_vga_register(display);
  20. + if (ret)
  21. + goto cleanup_bios;
  22. + }
  23.  
  24. /* FIXME: completely on the wrong abstraction layer */
  25. ret = intel_power_domains_init(i915);
  26. @@ -520,6 +523,12 @@ int intel_display_driver_probe(struct drm_i915_private *i915)
  27.  
  28. intel_overlay_setup(i915);
  29.  
  30. + /*
  31. + * Must do this after fbcon init so that
  32. + * vgacon_save_screen() works during the handover.
  33. + */
  34. + intel_vga_disable_mem(display);
  35. +
  36. /* Only enable hotplug handling once the fbdev is fully set up. */
  37. intel_hpd_init(i915);
  38.  
  39. @@ -566,9 +575,13 @@ void intel_display_driver_register(struct drm_i915_private *i915)
  40. /* part #1: call before irq uninstall */
  41. void intel_display_driver_remove(struct drm_i915_private *i915)
  42. {
  43. + struct intel_display *display = &i915->display;
  44. +
  45. if (!HAS_DISPLAY(i915))
  46. return;
  47.  
  48. + intel_vga_enable_mem(display);
  49. +
  50. flush_workqueue(i915->display.wq.flip);
  51. flush_workqueue(i915->display.wq.modeset);
  52.  
  53. @@ -599,6 +612,7 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915)
  54. intel_unregister_dsm_handler();
  55.  
  56. /* flush any delayed tasks or pending work */
  57. + intel_vga_enable_mem(display);
  58. flush_workqueue(i915->unordered_wq);
  59.  
  60. intel_hdcp_component_fini(display);
  61. --- intel_display_driver.h
  62. +++ intel_display_driver.h
  63. @@ -13,6 +13,7 @@ struct drm_i915_private;
  64. struct drm_modeset_acquire_ctx;
  65. struct pci_dev;
  66.  
  67. +extern void intel_vga_disable_mem(struct intel_display *display);
  68. bool intel_display_driver_probe_defer(struct pci_dev *pdev);
  69. void intel_display_driver_init_hw(struct drm_i915_private *i915);
  70. void intel_display_driver_early_probe(struct drm_i915_private *i915);
  71. --- intel_display_params.c
  72. +++ intel_display_params.c
  73. @@ -94,6 +94,9 @@ intel_display_param_named_unsafe(force_reset_modeset_test, bool, 0400,
  74. intel_display_param_named(disable_display, bool, 0400,
  75. "Disable display (default: false)");
  76.  
  77. +intel_display_param_named(enable_hd_vgaarb, bool, 0400,
  78. + "Enable support for VGA arbitration on Intel HD IGD. (default: false)");
  79. +
  80. intel_display_param_named(verbose_state_checks, bool, 0400,
  81. "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
  82.  
  83. --- intel_display_params.h
  84. +++ intel_display_params.h
  85. @@ -40,6 +40,7 @@ struct drm_printer;
  86. param(bool, load_detect_test, false, 0600) \
  87. param(bool, force_reset_modeset_test, false, 0600) \
  88. param(bool, disable_display, false, 0400) \
  89. + param(bool, enable_hd_vgaarb, false, 0600) \
  90. param(bool, verbose_state_checks, true, 0400) \
  91. param(bool, nuclear_pageflip, false, 0400) \
  92. param(bool, enable_dp_mst, true, 0600) \
  93. --- intel_vga.c
  94. +++ intel_vga.c
  95. @@ -12,6 +12,7 @@
  96. #include "i915_drv.h"
  97. #include "i915_reg.h"
  98. #include "intel_de.h"
  99. +#include "intel_display_params.h"
  100. #include "intel_vga.h"
  101.  
  102. static i915_reg_t intel_vga_cntrl_reg(struct intel_display *display)
  103. @@ -46,6 +47,37 @@ void intel_vga_disable(struct intel_display *display)
  104. intel_de_posting_read(display, vga_reg);
  105. }
  106.  
  107. +void intel_vga_enable_mem(struct intel_display *display)
  108. +{
  109. + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
  110. + struct drm_i915_private *i915 = pdev_to_i915(pdev);
  111. + /* Enable VGA memory on Intel HD */
  112. + if (display->params.enable_hd_vgaarb && HAS_PCH_SPLIT(i915)) {
  113. + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
  114. + outb(inb(VGA_MIS_R) | (1 << 1), VGA_MIS_W);
  115. + vga_set_legacy_decoding(pdev, VGA_RSRC_LEGACY_IO |
  116. + VGA_RSRC_LEGACY_MEM |
  117. + VGA_RSRC_NORMAL_IO |
  118. + VGA_RSRC_NORMAL_MEM);
  119. + vga_put(pdev, VGA_RSRC_LEGACY_IO);
  120. + }
  121. +}
  122. +
  123. +void intel_vga_disable_mem(struct intel_display *display)
  124. +{
  125. + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
  126. + struct drm_i915_private *i915 = pdev_to_i915(pdev);
  127. + /* Disable VGA memory on Intel HD */
  128. + if (display->params.enable_hd_vgaarb && HAS_PCH_SPLIT(i915)) {
  129. + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
  130. + outb(inb(VGA_MIS_R) & ~(1 << 1), VGA_MIS_W);
  131. + vga_set_legacy_decoding(pdev, VGA_RSRC_LEGACY_IO |
  132. + VGA_RSRC_NORMAL_IO |
  133. + VGA_RSRC_NORMAL_MEM);
  134. + vga_put(pdev, VGA_RSRC_LEGACY_IO);
  135. + }
  136. +}
  137. +
  138. void intel_vga_redisable_power_on(struct intel_display *display)
  139. {
  140. i915_reg_t vga_reg = intel_vga_cntrl_reg(display);
  141. @@ -54,6 +86,7 @@ void intel_vga_redisable_power_on(struct intel_display *display)
  142. drm_dbg_kms(display->drm,
  143. "Something enabled VGA plane, disabling it\n");
  144. intel_vga_disable(display);
  145. + intel_vga_disable_mem(display);
  146. }
  147. }
  148.  
  149. --- intel_vga.h
  150. +++ intel_vga.h
  151. @@ -15,4 +15,8 @@ void intel_vga_redisable_power_on(struct intel_display *display);
  152. int intel_vga_register(struct intel_display *display);
  153. void intel_vga_unregister(struct intel_display *display);
  154.  
  155. +/* i915 vga arb patch */
  156. +void intel_vga_enable_mem(struct intel_display *display);
  157. +void intel_vga_disable_mem(struct intel_display *display);
  158. +
  159. #endif /* __INTEL_VGA_H__ */
  160. --- i915_drv.h
  161. +++ i915_drv.h
  162. @@ -22,6 +22,13 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
  163. return container_of(dev, struct drm_i915_private, drm);
  164. }
  165.  
  166. +static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
  167. +{
  168. + struct drm_device *drm = pci_get_drvdata(pdev);
  169. +
  170. + return drm ? to_i915(drm) : NULL;
  171. +}
  172. +
  173. #define IS_PLATFORM(xe, x) ((xe)->info.platform == x)
  174. #define INTEL_INFO(dev_priv) (&((dev_priv)->info))
  175. #define IS_I830(dev_priv) (dev_priv && 0)
  176.  
Add Comment
Please, Sign In to add comment