Commit a2b69ea4 authored by Jani Nikula's avatar Jani Nikula

drm/i915: introduce INTEL_DISPLAY_ENABLED()

Prepare for making a distinction between not having display and having
disabled display. Add INTEL_DISPLAY_ENABLED() and use it where
HAS_DISPLAY() is used after intel_device_info_runtime_init(). This is
initially duplication, as disabling display still leads to ->pipe_mask =
0 and HAS_DISPLAY() being false.

Note that ever since i915.display_disable was introduced, it has not
affected PCH detection even if it uses HAS_DISPLAY(), as display disable
happens after that.

Since INTEL_DISPLAY_ENABLED() will not make sense unless HAS_DISPLAY()
is true, include a warning for catching misuses making decisions on
INTEL_DISPLAY_ENABLED() when HAS_DISPLAY() is false.

v2: Remove INTEL_DISPLAY_ENABLED() check from intel_detect_pch() (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913100407.30991-1-jani.nikula@intel.com
parent 2f715562
...@@ -1833,7 +1833,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv) ...@@ -1833,7 +1833,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv)
const struct bdb_header *bdb; const struct bdb_header *bdb;
u8 __iomem *bios = NULL; u8 __iomem *bios = NULL;
if (!HAS_DISPLAY(dev_priv)) { if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv)) {
DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n"); DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n");
return; return;
} }
......
...@@ -15381,7 +15381,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) ...@@ -15381,7 +15381,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
intel_pps_init(dev_priv); intel_pps_init(dev_priv);
if (!HAS_DISPLAY(dev_priv)) if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
return; return;
if (INTEL_GEN(dev_priv) >= 12) { if (INTEL_GEN(dev_priv) >= 12) {
...@@ -17293,7 +17293,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv) ...@@ -17293,7 +17293,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
BUILD_BUG_ON(ARRAY_SIZE(transcoders) != ARRAY_SIZE(error->transcoder)); BUILD_BUG_ON(ARRAY_SIZE(transcoders) != ARRAY_SIZE(error->transcoder));
if (!HAS_DISPLAY(dev_priv)) if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
return NULL; return NULL;
error = kzalloc(sizeof(*error), GFP_ATOMIC); error = kzalloc(sizeof(*error), GFP_ATOMIC);
......
...@@ -444,7 +444,7 @@ int intel_fbdev_init(struct drm_device *dev) ...@@ -444,7 +444,7 @@ int intel_fbdev_init(struct drm_device *dev)
struct intel_fbdev *ifbdev; struct intel_fbdev *ifbdev;
int ret; int ret;
if (WARN_ON(!HAS_DISPLAY(dev_priv))) if (WARN_ON(!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv)))
return -ENODEV; return -ENODEV;
ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
......
...@@ -836,7 +836,7 @@ int intel_gmbus_setup(struct drm_i915_private *dev_priv) ...@@ -836,7 +836,7 @@ int intel_gmbus_setup(struct drm_i915_private *dev_priv)
unsigned int pin; unsigned int pin;
int ret; int ret;
if (!HAS_DISPLAY(dev_priv)) if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
return 0; return 0;
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
......
...@@ -338,7 +338,7 @@ static int i915_driver_modeset_probe(struct drm_device *dev) ...@@ -338,7 +338,7 @@ static int i915_driver_modeset_probe(struct drm_device *dev)
if (i915_inject_probe_failure(dev_priv)) if (i915_inject_probe_failure(dev_priv))
return -ENODEV; return -ENODEV;
if (HAS_DISPLAY(dev_priv)) { if (HAS_DISPLAY(dev_priv) && INTEL_DISPLAY_ENABLED(dev_priv)) {
ret = drm_vblank_init(&dev_priv->drm, ret = drm_vblank_init(&dev_priv->drm,
INTEL_NUM_PIPES(dev_priv)); INTEL_NUM_PIPES(dev_priv));
if (ret) if (ret)
...@@ -389,7 +389,7 @@ static int i915_driver_modeset_probe(struct drm_device *dev) ...@@ -389,7 +389,7 @@ static int i915_driver_modeset_probe(struct drm_device *dev)
intel_overlay_setup(dev_priv); intel_overlay_setup(dev_priv);
if (!HAS_DISPLAY(dev_priv)) if (!HAS_DISPLAY(dev_priv) || !INTEL_DISPLAY_ENABLED(dev_priv))
return 0; return 0;
ret = intel_fbdev_init(dev); ret = intel_fbdev_init(dev);
...@@ -1415,7 +1415,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) ...@@ -1415,7 +1415,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
} else } else
DRM_ERROR("Failed to register driver for userspace access!\n"); DRM_ERROR("Failed to register driver for userspace access!\n");
if (HAS_DISPLAY(dev_priv)) { if (HAS_DISPLAY(dev_priv) && INTEL_DISPLAY_ENABLED(dev_priv)) {
/* Must be done after probing outputs */ /* Must be done after probing outputs */
intel_opregion_register(dev_priv); intel_opregion_register(dev_priv);
acpi_video_register(); acpi_video_register();
...@@ -1438,7 +1438,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) ...@@ -1438,7 +1438,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
* We need to coordinate the hotplugs with the asynchronous fbdev * We need to coordinate the hotplugs with the asynchronous fbdev
* configuration, for which we use the fbdev->async_cookie. * configuration, for which we use the fbdev->async_cookie.
*/ */
if (HAS_DISPLAY(dev_priv)) if (HAS_DISPLAY(dev_priv) && INTEL_DISPLAY_ENABLED(dev_priv))
drm_kms_helper_poll_init(dev); drm_kms_helper_poll_init(dev);
intel_power_domains_enable(dev_priv); intel_power_domains_enable(dev_priv);
......
...@@ -2192,6 +2192,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, ...@@ -2192,6 +2192,9 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
#define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->pipe_mask != 0) #define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->pipe_mask != 0)
/* Only valid when HAS_DISPLAY() is true */
#define INTEL_DISPLAY_ENABLED(dev_priv) (WARN_ON(!HAS_DISPLAY(dev_priv)), !i915_modparams.disable_display)
static inline bool intel_vtd_active(void) static inline bool intel_vtd_active(void)
{ {
#ifdef CONFIG_INTEL_IOMMU #ifdef CONFIG_INTEL_IOMMU
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment