Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- intel_display_driver.c
- +++ intel_display_driver.c
- @@ -30,6 +30,7 @@
- #include "intel_display_debugfs.h"
- #include "intel_display_driver.h"
- #include "intel_display_irq.h"
- +#include "intel_display_params.h"
- #include "intel_display_power.h"
- #include "intel_display_types.h"
- #include "intel_display_wa.h"
- @@ -221,9 +222,11 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915)
- intel_bios_init(display);
- - ret = intel_vga_register(display);
- - if (ret)
- - goto cleanup_bios;
- + if (!display->params.enable_hd_vgaarb || !HAS_PCH_SPLIT(i915)) {
- + ret = intel_vga_register(display);
- + if (ret)
- + goto cleanup_bios;
- + }
- /* FIXME: completely on the wrong abstraction layer */
- ret = intel_power_domains_init(i915);
- @@ -520,6 +523,12 @@ int intel_display_driver_probe(struct drm_i915_private *i915)
- intel_overlay_setup(i915);
- + /*
- + * Must do this after fbcon init so that
- + * vgacon_save_screen() works during the handover.
- + */
- + intel_vga_disable_mem(display);
- +
- /* Only enable hotplug handling once the fbdev is fully set up. */
- intel_hpd_init(i915);
- @@ -566,9 +575,13 @@ void intel_display_driver_register(struct drm_i915_private *i915)
- /* part #1: call before irq uninstall */
- void intel_display_driver_remove(struct drm_i915_private *i915)
- {
- + struct intel_display *display = &i915->display;
- +
- if (!HAS_DISPLAY(i915))
- return;
- + intel_vga_enable_mem(display);
- +
- flush_workqueue(i915->display.wq.flip);
- flush_workqueue(i915->display.wq.modeset);
- @@ -599,6 +612,7 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915)
- intel_unregister_dsm_handler();
- /* flush any delayed tasks or pending work */
- + intel_vga_enable_mem(display);
- flush_workqueue(i915->unordered_wq);
- intel_hdcp_component_fini(display);
- --- intel_display_driver.h
- +++ intel_display_driver.h
- @@ -13,6 +13,7 @@ struct drm_i915_private;
- struct drm_modeset_acquire_ctx;
- struct pci_dev;
- +extern void intel_vga_disable_mem(struct intel_display *display);
- bool intel_display_driver_probe_defer(struct pci_dev *pdev);
- void intel_display_driver_init_hw(struct drm_i915_private *i915);
- void intel_display_driver_early_probe(struct drm_i915_private *i915);
- --- intel_display_params.c
- +++ intel_display_params.c
- @@ -94,6 +94,9 @@ intel_display_param_named_unsafe(force_reset_modeset_test, bool, 0400,
- intel_display_param_named(disable_display, bool, 0400,
- "Disable display (default: false)");
- +intel_display_param_named(enable_hd_vgaarb, bool, 0400,
- + "Enable support for VGA arbitration on Intel HD IGD. (default: false)");
- +
- intel_display_param_named(verbose_state_checks, bool, 0400,
- "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
- --- intel_display_params.h
- +++ intel_display_params.h
- @@ -40,6 +40,7 @@ struct drm_printer;
- param(bool, load_detect_test, false, 0600) \
- param(bool, force_reset_modeset_test, false, 0600) \
- param(bool, disable_display, false, 0400) \
- + param(bool, enable_hd_vgaarb, false, 0600) \
- param(bool, verbose_state_checks, true, 0400) \
- param(bool, nuclear_pageflip, false, 0400) \
- param(bool, enable_dp_mst, true, 0600) \
- --- intel_vga.c
- +++ intel_vga.c
- @@ -12,6 +12,7 @@
- #include "i915_drv.h"
- #include "i915_reg.h"
- #include "intel_de.h"
- +#include "intel_display_params.h"
- #include "intel_vga.h"
- static i915_reg_t intel_vga_cntrl_reg(struct intel_display *display)
- @@ -46,6 +47,37 @@ void intel_vga_disable(struct intel_display *display)
- intel_de_posting_read(display, vga_reg);
- }
- +void intel_vga_enable_mem(struct intel_display *display)
- +{
- + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
- + struct drm_i915_private *i915 = pdev_to_i915(pdev);
- + /* Enable VGA memory on Intel HD */
- + if (display->params.enable_hd_vgaarb && HAS_PCH_SPLIT(i915)) {
- + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
- + outb(inb(VGA_MIS_R) | (1 << 1), VGA_MIS_W);
- + vga_set_legacy_decoding(pdev, VGA_RSRC_LEGACY_IO |
- + VGA_RSRC_LEGACY_MEM |
- + VGA_RSRC_NORMAL_IO |
- + VGA_RSRC_NORMAL_MEM);
- + vga_put(pdev, VGA_RSRC_LEGACY_IO);
- + }
- +}
- +
- +void intel_vga_disable_mem(struct intel_display *display)
- +{
- + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
- + struct drm_i915_private *i915 = pdev_to_i915(pdev);
- + /* Disable VGA memory on Intel HD */
- + if (display->params.enable_hd_vgaarb && HAS_PCH_SPLIT(i915)) {
- + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
- + outb(inb(VGA_MIS_R) & ~(1 << 1), VGA_MIS_W);
- + vga_set_legacy_decoding(pdev, VGA_RSRC_LEGACY_IO |
- + VGA_RSRC_NORMAL_IO |
- + VGA_RSRC_NORMAL_MEM);
- + vga_put(pdev, VGA_RSRC_LEGACY_IO);
- + }
- +}
- +
- void intel_vga_redisable_power_on(struct intel_display *display)
- {
- i915_reg_t vga_reg = intel_vga_cntrl_reg(display);
- @@ -54,6 +86,7 @@ void intel_vga_redisable_power_on(struct intel_display *display)
- drm_dbg_kms(display->drm,
- "Something enabled VGA plane, disabling it\n");
- intel_vga_disable(display);
- + intel_vga_disable_mem(display);
- }
- }
- --- intel_vga.h
- +++ intel_vga.h
- @@ -15,4 +15,8 @@ void intel_vga_redisable_power_on(struct intel_display *display);
- int intel_vga_register(struct intel_display *display);
- void intel_vga_unregister(struct intel_display *display);
- +/* i915 vga arb patch */
- +void intel_vga_enable_mem(struct intel_display *display);
- +void intel_vga_disable_mem(struct intel_display *display);
- +
- #endif /* __INTEL_VGA_H__ */
- --- i915_drv.h
- +++ i915_drv.h
- @@ -22,6 +22,13 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
- return container_of(dev, struct drm_i915_private, drm);
- }
- +static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
- +{
- + struct drm_device *drm = pci_get_drvdata(pdev);
- +
- + return drm ? to_i915(drm) : NULL;
- +}
- +
- #define IS_PLATFORM(xe, x) ((xe)->info.platform == x)
- #define INTEL_INFO(dev_priv) (&((dev_priv)->info))
- #define IS_I830(dev_priv) (dev_priv && 0)
Add Comment
Please, Sign In to add comment