Commit 6ac2f04b authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Extract intel_attach_scaling_mode_property()

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220912111814.17466-12-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent ab6214f3
...@@ -1974,16 +1974,8 @@ static void icl_dsi_add_properties(struct intel_connector *connector) ...@@ -1974,16 +1974,8 @@ static void icl_dsi_add_properties(struct intel_connector *connector)
{ {
const struct drm_display_mode *fixed_mode = const struct drm_display_mode *fixed_mode =
intel_panel_preferred_fixed_mode(connector); intel_panel_preferred_fixed_mode(connector);
u32 allowed_scalers;
allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | intel_attach_scaling_mode_property(&connector->base);
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;
drm_connector_set_panel_orientation_with_quirk(&connector->base, drm_connector_set_panel_orientation_with_quirk(&connector->base,
intel_dsi_get_panel_orientation(connector), intel_dsi_get_panel_orientation(connector),
......
...@@ -293,3 +293,21 @@ intel_attach_dp_colorspace_property(struct drm_connector *connector) ...@@ -293,3 +293,21 @@ intel_attach_dp_colorspace_property(struct drm_connector *connector)
if (!drm_mode_create_dp_colorspace_property(connector)) if (!drm_mode_create_dp_colorspace_property(connector))
drm_connector_attach_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;
}
...@@ -32,5 +32,6 @@ void intel_attach_broadcast_rgb_property(struct drm_connector *connector); ...@@ -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_aspect_ratio_property(struct drm_connector *connector);
void intel_attach_hdmi_colorspace_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_dp_colorspace_property(struct drm_connector *connector);
void intel_attach_scaling_mode_property(struct drm_connector *connector);
#endif /* __INTEL_CONNECTOR_H__ */ #endif /* __INTEL_CONNECTOR_H__ */
...@@ -5183,16 +5183,8 @@ intel_edp_add_properties(struct intel_dp *intel_dp) ...@@ -5183,16 +5183,8 @@ intel_edp_add_properties(struct intel_dp *intel_dp)
struct drm_i915_private *i915 = to_i915(connector->base.dev); struct drm_i915_private *i915 = to_i915(connector->base.dev);
const struct drm_display_mode *fixed_mode = const struct drm_display_mode *fixed_mode =
intel_panel_preferred_fixed_mode(connector); intel_panel_preferred_fixed_mode(connector);
u32 allowed_scalers;
allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | intel_attach_scaling_mode_property(&connector->base);
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;
if (!fixed_mode) if (!fixed_mode)
return; return;
......
...@@ -816,15 +816,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder) ...@@ -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) static void intel_lvds_add_properties(struct drm_connector *connector)
{ {
u32 allowed_scalers; intel_attach_scaling_mode_property(connector);
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;
} }
/** /**
......
...@@ -1659,19 +1659,10 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = { ...@@ -1659,19 +1659,10 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
static void vlv_dsi_add_properties(struct intel_connector *connector) 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 = const struct drm_display_mode *fixed_mode =
intel_panel_preferred_fixed_mode(connector); intel_panel_preferred_fixed_mode(connector);
u32 allowed_scalers;
allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | BIT(DRM_MODE_SCALE_FULLSCREEN); intel_attach_scaling_mode_property(&connector->base);
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;
drm_connector_set_panel_orientation_with_quirk(&connector->base, drm_connector_set_panel_orientation_with_quirk(&connector->base,
intel_dsi_get_panel_orientation(connector), intel_dsi_get_panel_orientation(connector),
......
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