OSDN Git Service

drm/i915: Add intel_modeset_probe_defer() helper
authorHans de Goede <hdegoede@redhat.com>
Tue, 5 Oct 2021 20:23:21 +0000 (22:23 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 9 Dec 2021 15:09:35 +0000 (16:09 +0100)
The upcoming privacy-screen support adds another check for
deferring probe till some other drivers have bound first.

Factor out the current vga_switcheroo_client_probe_defer() check
into an intel_modeset_probe_defer() helper, so that further
probe-deferral checks can be added there.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005202322.700909-10-hdegoede@redhat.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/i915_pci.c

index 3b411df..241cf0c 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/module.h>
 #include <linux/dma-resv.h>
 #include <linux/slab.h>
+#include <linux/vga_switcheroo.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -10865,6 +10866,18 @@ void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
        intel_bios_driver_remove(i915);
 }
 
+bool intel_modeset_probe_defer(struct pci_dev *pdev)
+{
+       /*
+        * apple-gmux is needed on dual GPU MacBook Pro
+        * to probe the panel if we're the inactive GPU.
+        */
+       if (vga_switcheroo_client_probe_defer(pdev))
+               return true;
+
+       return false;
+}
+
 void intel_display_driver_register(struct drm_i915_private *i915)
 {
        if (!HAS_DISPLAY(i915))
index 8d8725b..4b688a9 100644 (file)
@@ -640,6 +640,7 @@ void intel_display_driver_register(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 
 /* modesetting */
+bool intel_modeset_probe_defer(struct pci_dev *pdev);
 void intel_modeset_init_hw(struct drm_i915_private *i915);
 int intel_modeset_init_noirq(struct drm_i915_private *i915);
 int intel_modeset_init_nogem(struct drm_i915_private *i915);
index a98941b..158d160 100644 (file)
@@ -22,8 +22,6 @@
  *
  */
 
-#include <linux/vga_switcheroo.h>
-
 #include <drm/drm_drv.h>
 #include <drm/i915_pciids.h>
 
@@ -1206,11 +1204,8 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (PCI_FUNC(pdev->devfn))
                return -ENODEV;
 
-       /*
-        * apple-gmux is needed on dual GPU MacBook Pro
-        * to probe the panel if we're the inactive GPU.
-        */
-       if (vga_switcheroo_client_probe_defer(pdev))
+       /* Detect if we need to wait for other drivers early on */
+       if (intel_modeset_probe_defer(pdev))
                return -EPROBE_DEFER;
 
        err = i915_driver_probe(pdev, ent);