]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/display: Created exclusive version of vga decode setup
authorUma Shankar <uma.shankar@intel.com>
Fri, 29 Sep 2023 07:43:06 +0000 (13:13 +0530)
committerUma Shankar <uma.shankar@intel.com>
Thu, 5 Oct 2023 07:07:08 +0000 (12:37 +0530)
Current vga arbiter implementation in i915 needs a re-design.
The current approach would cause real problems if anyone actually
needs to talk another GPU using legacy VGA resources.

The main issue is that X becomes a slideshow if it thinks there
are multiple GPUs that have VGA decoding enabled as it insists
on adjusting the VGA routing pretty much for every little operation
involving any of the GPUs.

The cleanup will be planned for i915. Meanwhile to focus on Xe
upstreaming and have a cleaner separation, the said functionality
is being moved to a different file exclusive for i915. Xe driver
will re-use rest of the display code from i915.

v2: Addressed Jani Nikula's review comments.

v3: Dropped a duplicate function (Jani)

v4: Updated commit message with reasoning as sugested by Ville.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230929074306.1533859-1-uma.shankar@intel.com
drivers/gpu/drm/i915/display/intel_vga.c
drivers/gpu/drm/i915/soc/intel_gmch.c
drivers/gpu/drm/i915/soc/intel_gmch.h

index 286a0bdd28c66d8654d8b5de82676d6e500e04d8..4b98833bfa8cc280648b6005e1bec460a74753f7 100644 (file)
@@ -3,11 +3,9 @@
  * Copyright © 2019 Intel Corporation
  */
 
-#include <linux/pci.h>
 #include <linux/vgaarb.h>
 
 #include <video/vga.h>
-
 #include "soc/intel_gmch.h"
 
 #include "i915_drv.h"
@@ -99,20 +97,6 @@ void intel_vga_reset_io_mem(struct drm_i915_private *i915)
        vga_put(pdev, VGA_RSRC_LEGACY_IO);
 }
 
-static unsigned int
-intel_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
-{
-       struct drm_i915_private *i915 = pdev_to_i915(pdev);
-
-       intel_gmch_vga_set_state(i915, enable_decode);
-
-       if (enable_decode)
-               return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
-                      VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-       else
-               return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
-}
-
 int intel_vga_register(struct drm_i915_private *i915)
 {
 
@@ -127,7 +111,7 @@ int intel_vga_register(struct drm_i915_private *i915)
         * then we do not take part in VGA arbitration and the
         * vga_client_register() fails with -ENODEV.
         */
-       ret = vga_client_register(pdev, intel_vga_set_decode);
+       ret = vga_client_register(pdev, intel_gmch_vga_set_decode);
        if (ret && ret != -ENODEV)
                return ret;
 
index 49c7fb16e934f56d158ea90d124497a1a56e0b07..f32e9f78770a29de5bd46df680e7f3d79c85ec64 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <linux/pci.h>
 #include <linux/pnp.h>
+#include <linux/vgaarb.h>
 
 #include <drm/drm_managed.h>
 #include <drm/i915_drm.h>
@@ -167,3 +168,16 @@ int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
 
        return 0;
 }
+
+unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
+{
+       struct drm_i915_private *i915 = pdev_to_i915(pdev);
+
+       intel_gmch_vga_set_state(i915, enable_decode);
+
+       if (enable_decode)
+               return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
+                      VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
+       else
+               return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
+}
index d0133eedc7203bbf8432fc6fac51597d1ff74ff4..23be2d113afd0f3b40ff2d1977199fa119e7eba5 100644 (file)
@@ -8,11 +8,13 @@
 
 #include <linux/types.h>
 
+struct pci_dev;
 struct drm_i915_private;
 
 int intel_gmch_bridge_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_teardown(struct drm_i915_private *i915);
 int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
+unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode);
 
 #endif /* __INTEL_GMCH_H__ */