[Intel-gfx] [PATCH 09/10] drm/i915: Add intel_modeset_probe_defer() helper
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ä Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/display/intel_display.c | 13 + drivers/gpu/drm/i915/display/intel_display.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 9 ++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 4f0badb11bbb..86dbe366a907 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -12766,6 +12767,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)) diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 3028072c2cf3..d3d34acb6c08 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -633,6 +633,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); diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 169837de395d..8fc45d8119b6 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -22,8 +22,6 @@ * */ -#include - #include #include @@ -1189,11 +1187,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); -- 2.31.1
Re: [Intel-gfx] [PATCH 09/10] drm/i915: Add intel_modeset_probe_defer() helper
On Sat, Oct 02, 2021 at 06:36:17PM +0200, Hans de Goede wrote: > 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. > > Signed-off-by: Hans de Goede > --- > drivers/gpu/drm/i915/display/intel_display.c | 13 + > drivers/gpu/drm/i915/display/intel_display.h | 1 + > drivers/gpu/drm/i915/i915_pci.c | 9 ++--- > 3 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c > b/drivers/gpu/drm/i915/display/intel_display.c > index 60b2bc3ad011..e67f3207ba54 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -12690,6 +12691,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; > +} Seems fine. Presumably Jani isn't too grumpy about it :P Reviewed-by: Ville Syrjälä > + > void intel_display_driver_register(struct drm_i915_private *i915) > { > if (!HAS_DISPLAY(i915)) > diff --git a/drivers/gpu/drm/i915/display/intel_display.h > b/drivers/gpu/drm/i915/display/intel_display.h > index 3028072c2cf3..d3d34acb6c08 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.h > +++ b/drivers/gpu/drm/i915/display/intel_display.h > @@ -633,6 +633,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); > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c > index d4a6a9dcf182..cf4ad648b742 100644 > --- a/drivers/gpu/drm/i915/i915_pci.c > +++ b/drivers/gpu/drm/i915/i915_pci.c > @@ -22,8 +22,6 @@ > * > */ > > -#include > - > #include > #include > > @@ -1187,11 +1185,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); > -- > 2.31.1 -- Ville Syrjälä Intel
[Intel-gfx] [PATCH 09/10] drm/i915: Add intel_modeset_probe_defer() helper
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. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/display/intel_display.c | 13 + drivers/gpu/drm/i915/display/intel_display.h | 1 + drivers/gpu/drm/i915/i915_pci.c | 9 ++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 60b2bc3ad011..e67f3207ba54 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -12690,6 +12691,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)) diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 3028072c2cf3..d3d34acb6c08 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -633,6 +633,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); diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index d4a6a9dcf182..cf4ad648b742 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -22,8 +22,6 @@ * */ -#include - #include #include @@ -1187,11 +1185,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); -- 2.31.1