drm/i915: Extract intel_attach_scaling_mode_property()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 12 Sep 2022 11:18:10 +0000 (14:18 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 26 Sep 2022 14:07:12 +0000 (17:07 +0300)
Consolidate the scaling_mode property setup into a single
place.

The one slight complicateion here is that GMCH platforms can't
do the CENTER mode except on the LVDS port. But we can deal with
that by just checking the connector type.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220912111814.17466-12-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_connector.c
drivers/gpu/drm/i915/display/intel_connector.h
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_lvds.c
drivers/gpu/drm/i915/display/vlv_dsi.c

index ed4d939..59546cb 100644 (file)
@@ -1974,16 +1974,8 @@ static void icl_dsi_add_properties(struct intel_connector *connector)
 {
        const struct drm_display_mode *fixed_mode =
                intel_panel_preferred_fixed_mode(connector);
-       u32 allowed_scalers;
 
-       allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) |
-                          BIT(DRM_MODE_SCALE_FULLSCREEN) |
-                          BIT(DRM_MODE_SCALE_CENTER);
-
-       drm_connector_attach_scaling_mode_property(&connector->base,
-                                                  allowed_scalers);
-
-       connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+       intel_attach_scaling_mode_property(&connector->base);
 
        drm_connector_set_panel_orientation_with_quirk(&connector->base,
                                                       intel_dsi_get_panel_orientation(connector),
index 6d5cbeb..6205ddd 100644 (file)
@@ -293,3 +293,21 @@ intel_attach_dp_colorspace_property(struct drm_connector *connector)
        if (!drm_mode_create_dp_colorspace_property(connector))
                drm_connector_attach_colorspace_property(connector);
 }
+
+void
+intel_attach_scaling_mode_property(struct drm_connector *connector)
+{
+       struct drm_i915_private *i915 = to_i915(connector->dev);
+       u32 scaling_modes;
+
+       scaling_modes = BIT(DRM_MODE_SCALE_ASPECT) |
+               BIT(DRM_MODE_SCALE_FULLSCREEN);
+
+       /* On GMCH platforms borders are only possible on the LVDS port */
+       if (!HAS_GMCH(i915) || connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
+               scaling_modes |= BIT(DRM_MODE_SCALE_CENTER);
+
+       drm_connector_attach_scaling_mode_property(connector, scaling_modes);
+
+       connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+}
index 661a37a..7d7b588 100644 (file)
@@ -32,5 +32,6 @@ void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
 void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 void intel_attach_hdmi_colorspace_property(struct drm_connector *connector);
 void intel_attach_dp_colorspace_property(struct drm_connector *connector);
+void intel_attach_scaling_mode_property(struct drm_connector *connector);
 
 #endif /* __INTEL_CONNECTOR_H__ */
index 2de7773..0d195f8 100644 (file)
@@ -5183,16 +5183,8 @@ intel_edp_add_properties(struct intel_dp *intel_dp)
        struct drm_i915_private *i915 = to_i915(connector->base.dev);
        const struct drm_display_mode *fixed_mode =
                intel_panel_preferred_fixed_mode(connector);
-       u32 allowed_scalers;
 
-       allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) |
-               BIT(DRM_MODE_SCALE_FULLSCREEN);
-       if (!HAS_GMCH(i915))
-               allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
-
-       drm_connector_attach_scaling_mode_property(&connector->base, allowed_scalers);
-
-       connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+       intel_attach_scaling_mode_property(&connector->base);
 
        if (!fixed_mode)
                return;
index 7cadb54..951170a 100644 (file)
@@ -816,15 +816,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 
 static void intel_lvds_add_properties(struct drm_connector *connector)
 {
-       u32 allowed_scalers;
-
-       allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) |
-               BIT(DRM_MODE_SCALE_FULLSCREEN) |
-               BIT(DRM_MODE_SCALE_CENTER);
-
-       drm_connector_attach_scaling_mode_property(connector, allowed_scalers);
-
-       connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+       intel_attach_scaling_mode_property(connector);
 }
 
 /**
index b3f5ca2..421ad02 100644 (file)
@@ -1659,19 +1659,10 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 
 static void vlv_dsi_add_properties(struct intel_connector *connector)
 {
-       struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
        const struct drm_display_mode *fixed_mode =
                intel_panel_preferred_fixed_mode(connector);
-       u32 allowed_scalers;
 
-       allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | BIT(DRM_MODE_SCALE_FULLSCREEN);
-       if (!HAS_GMCH(dev_priv))
-               allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
-
-       drm_connector_attach_scaling_mode_property(&connector->base,
-                                                  allowed_scalers);
-
-       connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
+       intel_attach_scaling_mode_property(&connector->base);
 
        drm_connector_set_panel_orientation_with_quirk(&connector->base,
                                                       intel_dsi_get_panel_orientation(connector),