Commit 8b45330a authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Use per-connector scaling mode property

None of the intel connectors can use all types of scaling modes,
so only try the ones that are possible. This is another preparation
for connectors towards conversion to atomic.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170501133804.8116-5-maarten.lankhorst@linux.intel.com
[mlankhorst: Use renamed drm_connector_attach_scaling_mode_property function]
parent eead06df
...@@ -4888,18 +4888,7 @@ intel_dp_set_property(struct drm_connector *connector, ...@@ -4888,18 +4888,7 @@ intel_dp_set_property(struct drm_connector *connector,
goto done; goto done;
} }
if (is_edp(intel_dp) && if (property == connector->scaling_mode_property) {
property == connector->dev->mode_config.scaling_mode_property) {
if (val == DRM_MODE_SCALE_NONE) {
DRM_DEBUG_KMS("no scaling not supported\n");
return -EINVAL;
}
if (HAS_GMCH_DISPLAY(dev_priv) &&
val == DRM_MODE_SCALE_CENTER) {
DRM_DEBUG_KMS("centering not supported\n");
return -EINVAL;
}
if (connector->state->scaling_mode == val) { if (connector->state->scaling_mode == val) {
/* the eDP scaling property is not changed */ /* the eDP scaling property is not changed */
return 0; return 0;
...@@ -5182,17 +5171,23 @@ bool intel_dp_is_edp(struct drm_i915_private *dev_priv, enum port port) ...@@ -5182,17 +5171,23 @@ bool intel_dp_is_edp(struct drm_i915_private *dev_priv, enum port port)
static void static void
intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->dev);
intel_attach_force_audio_property(connector); intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector); intel_attach_broadcast_rgb_property(connector);
intel_dp->color_range_auto = true; intel_dp->color_range_auto = true;
if (is_edp(intel_dp)) { if (is_edp(intel_dp)) {
drm_mode_create_scaling_mode_property(connector->dev); u32 allowed_scalers;
drm_object_attach_property(
&connector->base, allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | BIT(DRM_MODE_SCALE_FULLSCREEN);
connector->dev->mode_config.scaling_mode_property, if (!HAS_GMCH_DISPLAY(dev_priv))
DRM_MODE_SCALE_ASPECT); allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
drm_connector_attach_scaling_mode_property(connector, allowed_scalers);
connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT; connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
} }
} }
......
...@@ -1591,7 +1591,6 @@ static int intel_dsi_set_property(struct drm_connector *connector, ...@@ -1591,7 +1591,6 @@ static int intel_dsi_set_property(struct drm_connector *connector,
struct drm_property *property, struct drm_property *property,
uint64_t val) uint64_t val)
{ {
struct drm_device *dev = connector->dev;
struct drm_crtc *crtc; struct drm_crtc *crtc;
int ret; int ret;
...@@ -1599,17 +1598,7 @@ static int intel_dsi_set_property(struct drm_connector *connector, ...@@ -1599,17 +1598,7 @@ static int intel_dsi_set_property(struct drm_connector *connector,
if (ret) if (ret)
return ret; return ret;
if (property == dev->mode_config.scaling_mode_property) { if (property == connector->scaling_mode_property) {
if (val == DRM_MODE_SCALE_NONE) {
DRM_DEBUG_KMS("no scaling not supported\n");
return -EINVAL;
}
if (HAS_GMCH_DISPLAY(to_i915(dev)) &&
val == DRM_MODE_SCALE_CENTER) {
DRM_DEBUG_KMS("centering not supported\n");
return -EINVAL;
}
if (connector->state->scaling_mode == val) if (connector->state->scaling_mode == val)
return 0; return 0;
...@@ -1672,13 +1661,18 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = { ...@@ -1672,13 +1661,18 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
static void intel_dsi_add_properties(struct intel_connector *connector) static void intel_dsi_add_properties(struct intel_connector *connector)
{ {
struct drm_device *dev = connector->base.dev; struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
if (connector->panel.fixed_mode) { if (connector->panel.fixed_mode) {
drm_mode_create_scaling_mode_property(dev); u32 allowed_scalers;
drm_object_attach_property(&connector->base.base,
dev->mode_config.scaling_mode_property, allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT) | BIT(DRM_MODE_SCALE_FULLSCREEN);
DRM_MODE_SCALE_ASPECT); if (!HAS_GMCH_DISPLAY(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; connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
} }
} }
......
...@@ -602,16 +602,10 @@ static int intel_lvds_set_property(struct drm_connector *connector, ...@@ -602,16 +602,10 @@ static int intel_lvds_set_property(struct drm_connector *connector,
struct drm_property *property, struct drm_property *property,
uint64_t value) uint64_t value)
{ {
struct drm_device *dev = connector->dev;
if (property == dev->mode_config.scaling_mode_property) { if (property == connector->scaling_mode_property) {
struct drm_crtc *crtc; struct drm_crtc *crtc;
if (value == DRM_MODE_SCALE_NONE) {
DRM_DEBUG_KMS("no scaling not supported\n");
return -EINVAL;
}
if (connector->state->scaling_mode == value) { if (connector->state->scaling_mode == value) {
/* the LVDS scaling property is not changed */ /* the LVDS scaling property is not changed */
return 0; return 0;
...@@ -987,6 +981,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) ...@@ -987,6 +981,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
u32 lvds; u32 lvds;
int pipe; int pipe;
u8 pin; u8 pin;
u32 allowed_scalers;
if (!intel_lvds_supported(dev_priv)) if (!intel_lvds_supported(dev_priv))
return; return;
...@@ -1082,10 +1077,10 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) ...@@ -1082,10 +1077,10 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
lvds_encoder->reg = lvds_reg; lvds_encoder->reg = lvds_reg;
/* create the scaling mode property */ /* create the scaling mode property */
drm_mode_create_scaling_mode_property(dev); allowed_scalers = BIT(DRM_MODE_SCALE_ASPECT);
drm_object_attach_property(&connector->base, allowed_scalers |= BIT(DRM_MODE_SCALE_FULLSCREEN);
dev->mode_config.scaling_mode_property, allowed_scalers |= BIT(DRM_MODE_SCALE_CENTER);
DRM_MODE_SCALE_ASPECT); drm_connector_attach_scaling_mode_property(connector, allowed_scalers);
connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT; connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
intel_lvds_pps_get_hw_state(dev_priv, &lvds_encoder->init_pps); intel_lvds_pps_get_hw_state(dev_priv, &lvds_encoder->init_pps);
......
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