diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 75955fee6d24..5b32b682bc3e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5636,6 +5636,34 @@ static void intel_connector_check_state(struct intel_connector *connector) | |||
5636 | } | 5636 | } |
5637 | } | 5637 | } |
5638 | 5638 | ||
5639 | int intel_connector_init(struct intel_connector *connector) | ||
5640 | { | ||
5641 | struct drm_connector_state *connector_state; | ||
5642 | |||
5643 | connector_state = kzalloc(sizeof *connector_state, GFP_KERNEL); | ||
5644 | if (!connector_state) | ||
5645 | return -ENOMEM; | ||
5646 | |||
5647 | connector->base.state = connector_state; | ||
5648 | return 0; | ||
5649 | } | ||
5650 | |||
5651 | struct intel_connector *intel_connector_alloc(void) | ||
5652 | { | ||
5653 | struct intel_connector *connector; | ||
5654 | |||
5655 | connector = kzalloc(sizeof *connector, GFP_KERNEL); | ||
5656 | if (!connector) | ||
5657 | return NULL; | ||
5658 | |||
5659 | if (intel_connector_init(connector) < 0) { | ||
5660 | kfree(connector); | ||
5661 | return NULL; | ||
5662 | } | ||
5663 | |||
5664 | return connector; | ||
5665 | } | ||
5666 | |||
5639 | /* Even simpler default implementation, if there's really no special case to | 5667 | /* Even simpler default implementation, if there's really no special case to |
5640 | * consider. */ | 5668 | * consider. */ |
5641 | void intel_connector_dpms(struct drm_connector *connector, int mode) | 5669 | void intel_connector_dpms(struct drm_connector *connector, int mode) |
@@ -13003,7 +13031,6 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
13003 | { | 13031 | { |
13004 | struct drm_i915_private *dev_priv = dev->dev_private; | 13032 | struct drm_i915_private *dev_priv = dev->dev_private; |
13005 | struct intel_encoder *encoder; | 13033 | struct intel_encoder *encoder; |
13006 | struct drm_connector *connector; | ||
13007 | bool dpd_is_edp = false; | 13034 | bool dpd_is_edp = false; |
13008 | 13035 | ||
13009 | intel_lvds_init(dev); | 13036 | intel_lvds_init(dev); |
@@ -13139,39 +13166,6 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
13139 | if (SUPPORTS_TV(dev)) | 13166 | if (SUPPORTS_TV(dev)) |
13140 | intel_tv_init(dev); | 13167 | intel_tv_init(dev); |
13141 | 13168 | ||
13142 | /* | ||
13143 | * FIXME: We don't have full atomic support yet, but we want to be | ||
13144 | * able to enable/test plane updates via the atomic interface in the | ||
13145 | * meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core | ||
13146 | * will take some atomic codepaths to lookup properties during | ||
13147 | * drmModeGetConnector() that unconditionally dereference | ||
13148 | * connector->state. | ||
13149 | * | ||
13150 | * We create a dummy connector state here for each connector to ensure | ||
13151 | * the DRM core doesn't try to dereference a NULL connector->state. | ||
13152 | * The actual connector properties will never be updated or contain | ||
13153 | * useful information, but since we're doing this specifically for | ||
13154 | * testing/debug of the plane operations (and only when a specific | ||
13155 | * kernel module option is given), that shouldn't really matter. | ||
13156 | * | ||
13157 | * We are also relying on these states to convert the legacy mode set | ||
13158 | * to use a drm_atomic_state struct. The states are kept consistent | ||
13159 | * with actual state, so that it is safe to rely on that instead of | ||
13160 | * the staged config. | ||
13161 | * | ||
13162 | * Once atomic support for crtc's + connectors lands, this loop should | ||
13163 | * be removed since we'll be setting up real connector state, which | ||
13164 | * will contain Intel-specific properties. | ||
13165 | */ | ||
13166 | list_for_each_entry(connector, | ||
13167 | &dev->mode_config.connector_list, | ||
13168 | head) { | ||
13169 | if (!WARN_ON(connector->state)) { | ||
13170 | connector->state = kzalloc(sizeof(*connector->state), | ||
13171 | GFP_KERNEL); | ||
13172 | } | ||
13173 | } | ||
13174 | |||
13175 | intel_psr_init(dev); | 13169 | intel_psr_init(dev); |
13176 | 13170 | ||
13177 | for_each_intel_encoder(dev, encoder) { | 13171 | for_each_intel_encoder(dev, encoder) { |