[Intel-gfx] [PATCH 03/10] drm/i915/display: move intel_modeset_probe_defer() to intel_display_driver.[ch]

Gustavo Sousa gustavo.sousa at intel.com
Thu Apr 13 16:56:26 UTC 2023


Quoting Jani Nikula (2023-04-13 06:47:29)
> High level display functionality only called from driver top level code.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Gustavo Sousa <gustavo.sousa at intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 23 -------------------
>  drivers/gpu/drm/i915/display/intel_display.h  |  1 -
>  .../drm/i915/display/intel_display_driver.c   | 23 +++++++++++++++++++
>  .../drm/i915/display/intel_display_driver.h   |  4 ++++
>  drivers/gpu/drm/i915/i915_pci.c               |  1 +
>  5 files changed, 28 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 7c66b9ce0db5..dfec17bb3a7a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -31,7 +31,6 @@
>  #include <linux/module.h>
>  #include <linux/slab.h>
>  #include <linux/string_helpers.h>
> -#include <linux/vga_switcheroo.h>
>  
>  #include <drm/display/drm_dp_helper.h>
>  #include <drm/drm_atomic.h>
> @@ -40,7 +39,6 @@
>  #include <drm/drm_damage_helper.h>
>  #include <drm/drm_edid.h>
>  #include <drm/drm_fourcc.h>
> -#include <drm/drm_privacy_screen_consumer.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_rect.h>
>  
> @@ -8810,27 +8808,6 @@ 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)
> -{
> -  struct drm_privacy_screen *privacy_screen;
> -
> -  /*
> -   * 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;
> -
> -  /* If the LCD panel has a privacy-screen, wait for it */
> -  privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL);
> -  if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER)
> -          return true;
> -
> -  drm_privacy_screen_put(privacy_screen);
> -
> -  return false;
> -}
> -
>  bool intel_scanout_needs_vtd_wa(struct drm_i915_private *i915)
>  {
>         return DISPLAY_VER(i915) >= 6 && i915_vtd_active(i915);
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index e46732d26b7c..6ff8faa1b5ac 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -521,7 +521,6 @@ void intel_plane_fixup_bitmasks(struct intel_crtc_state *crtc_state);
>  void intel_update_watermarks(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/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index d4a1893e9218..1386f2001613 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -7,8 +7,10 @@
>   * details here.
>   */
>  
> +#include <linux/vga_switcheroo.h>
>  #include <acpi/video.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_privacy_screen_consumer.h>
>  #include <drm/drm_probe_helper.h>
>  
>  #include "i915_drv.h"
> @@ -19,6 +21,27 @@
>  #include "intel_fbdev.h"
>  #include "intel_opregion.h"
>  
> +bool intel_modeset_probe_defer(struct pci_dev *pdev)
> +{
> +  struct drm_privacy_screen *privacy_screen;
> +
> +  /*
> +   * 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;
> +
> +  /* If the LCD panel has a privacy-screen, wait for it */
> +  privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL);
> +  if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER)
> +          return true;
> +
> +  drm_privacy_screen_put(privacy_screen);
> +
> +  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_driver.h b/drivers/gpu/drm/i915/display/intel_display_driver.h
> index 4f6deef5a23f..4c18792fcafd 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.h
> @@ -6,8 +6,12 @@
>  #ifndef __INTEL_DISPLAY_DRIVER_H__
>  #define __INTEL_DISPLAY_DRIVER_H__
>  
> +#include <linux/types.h>
> +
>  struct drm_i915_private;
> +struct pci_dev;
>  
> +bool intel_modeset_probe_defer(struct pci_dev *pdev);
>  void intel_display_driver_register(struct drm_i915_private *i915);
>  void intel_display_driver_unregister(struct drm_i915_private *i915);
>  
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index cddb6e197972..bda5caa33f12 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -27,6 +27,7 @@
>  #include <drm/i915_pciids.h>
>  
>  #include "display/intel_display.h"
> +#include "display/intel_display_driver.h"
>  #include "gt/intel_gt_regs.h"
>  #include "gt/intel_sa_media.h"
>  
> -- 
> 2.39.2
>


More information about the Intel-gfx mailing list