dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 01/11] drm/atomic: Handle aspect ratio and scaling mode in core, v3.
       [not found] <1493121335-18603-1-git-send-email-maarten.lankhorst@linux.intel.com>
@ 2017-04-25 11:55 ` Maarten Lankhorst
  2017-04-25 11:55 ` [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties Maarten Lankhorst
  1 sibling, 0 replies; 4+ messages in thread
From: Maarten Lankhorst @ 2017-04-25 11:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel

This is required to for i915 to convert connector properties to atomic.

Changes since v1:
- Add docbook info. (danvet)
- Change picture_aspect_ratio to enum hdmi_picture_aspect.
Changes since v2:
- For i915 put the properties in connector_state, to prevent
  regressions where the property doesn't match the real state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Acked-by: Dave Airlie <airlied@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1492074937-4774-1-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #v2
[mlankhorst: Change ASPECT_* to ASPECT_\*, based on danvet's suggestion]
---
 drivers/gpu/drm/drm_atomic.c       |  8 ++++++++
 drivers/gpu/drm/i915/intel_dp.c    |  2 ++
 drivers/gpu/drm/i915/intel_dsi.c   |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c  |  1 +
 drivers/gpu/drm/i915/intel_lvds.c  |  2 ++
 drivers/gpu/drm/i915/intel_modes.c |  4 +++-
 drivers/gpu/drm/i915/intel_sdvo.c  |  1 +
 include/drm/drm_connector.h        | 16 ++++++++++++++++
 8 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 30229ab719c0..25ea6f797a54 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1123,6 +1123,10 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
 		 */
 		if (state->link_status != DRM_LINK_STATUS_GOOD)
 			state->link_status = val;
+	} else if (property == config->aspect_ratio_property) {
+		state->picture_aspect_ratio = val;
+	} else if (property == config->scaling_mode_property) {
+		state->scaling_mode = val;
 	} else if (connector->funcs->atomic_set_property) {
 		return connector->funcs->atomic_set_property(connector,
 				state, property, val);
@@ -1199,6 +1203,10 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->tv.hue;
 	} else if (property == config->link_status_property) {
 		*val = state->link_status;
+	} else if (property == config->aspect_ratio_property) {
+		*val = state->picture_aspect_ratio;
+	} else if (property == config->scaling_mode_property) {
+		*val = state->scaling_mode;
 	} else if (connector->funcs->atomic_get_property) {
 		return connector->funcs->atomic_get_property(connector,
 				state, property, val);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 08834f74d396..6686ac98c4ee 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4902,6 +4902,7 @@ intel_dp_set_property(struct drm_connector *connector,
 			return 0;
 		}
 		intel_connector->panel.fitting_mode = val;
+		connector->state->scaling_mode = val;
 
 		goto done;
 	}
@@ -5192,6 +5193,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 			connector->dev->mode_config.scaling_mode_property,
 			DRM_MODE_SCALE_ASPECT);
 		intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT;
+		connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 3ffe8b1f1d48..35adbcc2e3f3 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1616,6 +1616,7 @@ static int intel_dsi_set_property(struct drm_connector *connector,
 			return 0;
 
 		intel_connector->panel.fitting_mode = val;
+		connector->state->scaling_mode = val;
 	}
 
 	crtc = connector->state->crtc;
@@ -1682,6 +1683,7 @@ static void intel_dsi_add_properties(struct intel_connector *connector)
 					   dev->mode_config.scaling_mode_property,
 					   DRM_MODE_SCALE_ASPECT);
 		connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT;
+		connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 6efc3cb8c471..2b1e806319b9 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1662,6 +1662,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+		connector->state->picture_aspect_ratio = val;
 		goto done;
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 8b942ef2b3ec..5d9c1de0702b 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -618,6 +618,7 @@ static int intel_lvds_set_property(struct drm_connector *connector,
 			return 0;
 		}
 		intel_connector->panel.fitting_mode = value;
+		connector->state->scaling_mode = value;
 
 		crtc = intel_attached_encoder(connector)->base.crtc;
 		if (crtc && crtc->state->enable) {
@@ -1087,6 +1088,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	drm_object_attach_property(&connector->base,
 				      dev->mode_config.scaling_mode_property,
 				      DRM_MODE_SCALE_ASPECT);
+	connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 	intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT;
 
 	intel_lvds_pps_get_hw_state(dev_priv, &lvds_encoder->init_pps);
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 951e834dd274..f7f62eaf2140 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -132,5 +132,7 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
 	if (!drm_mode_create_aspect_ratio_property(connector->dev))
 		drm_object_attach_property(&connector->base,
 			connector->dev->mode_config.aspect_ratio_property,
-			DRM_MODE_PICTURE_ASPECT_NONE);
+			0);
+
+	connector->state->picture_aspect_ratio = DRM_MODE_PICTURE_ASPECT_NONE;
 }
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 816a6f5a3fd9..411d68341820 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2080,6 +2080,7 @@ intel_sdvo_set_property(struct drm_connector *connector,
 		default:
 			return -EINVAL;
 		}
+		connector->state->picture_aspect_ratio = val;
 		goto done;
 	}
 
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 4eeda120e46d..934143720e5a 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -25,6 +25,7 @@
 
 #include <linux/list.h>
 #include <linux/ctype.h>
+#include <linux/hdmi.h>
 #include <drm/drm_mode_object.h>
 
 #include <uapi/drm/drm_mode.h>
@@ -326,6 +327,21 @@ struct drm_connector_state {
 	struct drm_atomic_state *state;
 
 	struct drm_tv_connector_state tv;
+
+	/**
+	 * @picture_aspect_ratio: Connector property to control the
+	 * HDMI infoframe aspect ratio setting.
+	 *
+	 * The DRM_MODE_PICTURE_ASPECT_\* values much match the
+	 * values for &enum hdmi_picture_aspect
+	 */
+	enum hdmi_picture_aspect picture_aspect_ratio;
+
+	/**
+	 * @scaling_mode: Connector property to control the
+	 * upscaling, mostly used for built-in panels.
+	 */
+	unsigned int scaling_mode;
 };
 
 /**
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties
       [not found] <1493121335-18603-1-git-send-email-maarten.lankhorst@linux.intel.com>
  2017-04-25 11:55 ` [PATCH v5 01/11] drm/atomic: Handle aspect ratio and scaling mode in core, v3 Maarten Lankhorst
@ 2017-04-25 11:55 ` Maarten Lankhorst
  2017-04-25 15:14   ` Sean Paul
  2017-04-25 16:03   ` Ville Syrjälä
  1 sibling, 2 replies; 4+ messages in thread
From: Maarten Lankhorst @ 2017-04-25 11:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel

Some connectors may not allow all scaling mode properties, this function will allow
creating the scaling mode property with only the supported subset.

This will make it possible to convert i915 connectors to atomic.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_atomic.c    |  3 ++-
 drivers/gpu/drm/drm_connector.c | 45 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  5 +++++
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 25ea6f797a54..21db00d9a933 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1125,7 +1125,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
 			state->link_status = val;
 	} else if (property == config->aspect_ratio_property) {
 		state->picture_aspect_ratio = val;
-	} else if (property == config->scaling_mode_property) {
+	} else if (property == config->scaling_mode_property ||
+		   property == connector->scaling_mode_property) {
 		state->scaling_mode = val;
 	} else if (connector->funcs->atomic_set_property) {
 		return connector->funcs->atomic_set_property(connector,
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 9f847615ac74..49baa21b4ce7 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -954,6 +954,7 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
 				drm_scaling_mode_enum_list,
 				    ARRAY_SIZE(drm_scaling_mode_enum_list));
 
+
 	dev->mode_config.scaling_mode_property = scaling_mode;
 
 	return 0;
@@ -961,6 +962,50 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
 EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
 
 /**
+ * drm_mode_connector_attach_custom_scaling_mode_property - TODO
+ */
+int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
+							   u32 scaling_mode_mask,
+							   u32 default_scaler)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_property *scaling_mode_property;
+	int i;
+
+	if (!scaling_mode_mask)
+		scaling_mode_mask = ~0U;
+
+	scaling_mode_mask &= (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
+
+	scaling_mode_property =
+		drm_property_create(dev, 0, "scaling mode",
+				    hweight32(scaling_mode_mask));
+
+	for (i = 0; i < ARRAY_SIZE(drm_scaling_mode_enum_list); i++)
+		if (BIT(i) & scaling_mode_mask) {
+			int ret;
+
+			ret = drm_property_add_enum(scaling_mode_property, i,
+						    drm_scaling_mode_enum_list[i].type,
+						    drm_scaling_mode_enum_list[i].name);
+
+			if (ret) {
+				drm_property_destroy(dev, scaling_mode_property);
+
+				return ret;
+			}
+		}
+
+	drm_object_attach_property(&connector->base,
+				   scaling_mode_property, default_scaler);
+
+	connector->scaling_mode_property = scaling_mode_property;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_connector_attach_custom_scaling_mode_property);
+
+/**
  * drm_mode_create_aspect_ratio_property - create aspect ratio property
  * @dev: DRM device
  *
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 934143720e5a..f55ae02135c2 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -770,6 +770,8 @@ struct drm_connector {
 	struct drm_property_blob *edid_blob_ptr;
 	struct drm_object_properties properties;
 
+	struct drm_property *scaling_mode_property;
+
 	/**
 	 * @path_blob_ptr:
 	 *
@@ -969,6 +971,9 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 				  unsigned int num_modes,
 				  const char * const modes[]);
 int drm_mode_create_scaling_mode_property(struct drm_device *dev);
+int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
+							   u32 scaling_mode_mask,
+							   u32 default_value);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties
  2017-04-25 11:55 ` [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties Maarten Lankhorst
@ 2017-04-25 15:14   ` Sean Paul
  2017-04-25 16:03   ` Ville Syrjälä
  1 sibling, 0 replies; 4+ messages in thread
From: Sean Paul @ 2017-04-25 15:14 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, dri-devel

On Tue, Apr 25, 2017 at 01:55:26PM +0200, Maarten Lankhorst wrote:
> Some connectors may not allow all scaling mode properties, this function will allow
> creating the scaling mode property with only the supported subset.
> 
> This will make it possible to convert i915 connectors to atomic.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/drm_atomic.c    |  3 ++-
>  drivers/gpu/drm/drm_connector.c | 45 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_connector.h     |  5 +++++
>  3 files changed, 52 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 25ea6f797a54..21db00d9a933 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1125,7 +1125,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
>  			state->link_status = val;
>  	} else if (property == config->aspect_ratio_property) {
>  		state->picture_aspect_ratio = val;
> -	} else if (property == config->scaling_mode_property) {
> +	} else if (property == config->scaling_mode_property ||
> +		   property == connector->scaling_mode_property) {

Since scaling_mode_property isn't part of the atomic ABI before this series,
have you considered just supporting scaling mode property on connectors for
atomic? Then you wouldn't need to check both, and you wouldn't have the issue of
stomping properties if they're both set in a commit.

>  		state->scaling_mode = val;
>  	} else if (connector->funcs->atomic_set_property) {
>  		return connector->funcs->atomic_set_property(connector,
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 9f847615ac74..49baa21b4ce7 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -954,6 +954,7 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
>  				drm_scaling_mode_enum_list,
>  				    ARRAY_SIZE(drm_scaling_mode_enum_list));
>  
> +

nit: kruft.

>  	dev->mode_config.scaling_mode_property = scaling_mode;
>  
>  	return 0;
> @@ -961,6 +962,50 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
>  EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
>  
>  /**
> + * drm_mode_connector_attach_custom_scaling_mode_property - TODO

It would be nice to fill in this TODO

> + */
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> +							   u32 scaling_mode_mask,
> +							   u32 default_scaler)
> +{
> +	struct drm_device *dev = connector->dev;
> +	struct drm_property *scaling_mode_property;
> +	int i;
> +
> +	if (!scaling_mode_mask)
> +		scaling_mode_mask = ~0U;

It's hard to interpret this code without the docs above, but it seems like we're
just covering the case where the caller interprets a mask of 0 as "don't care".
I'd rather not try to be smart about interpreting invalid input, instead, I'd
prefer just to return -EINVAL if scaling_mode_mask is 0 after the next line.

> +
> +	scaling_mode_mask &= (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;

scaling_mode_mask &= BIT(ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;

> +
> +	scaling_mode_property =
> +		drm_property_create(dev, 0, "scaling mode",
> +				    hweight32(scaling_mode_mask));
> +
> +	for (i = 0; i < ARRAY_SIZE(drm_scaling_mode_enum_list); i++)
> +		if (BIT(i) & scaling_mode_mask) {

nit: You can save a level of indentation if you do:

if (!(BIT(i) & scaling_mode_mask))
        continue;

> +			int ret;
> +
> +			ret = drm_property_add_enum(scaling_mode_property, i,
> +						    drm_scaling_mode_enum_list[i].type,
> +						    drm_scaling_mode_enum_list[i].name);
> +
> +			if (ret) {
> +				drm_property_destroy(dev, scaling_mode_property);
> +

nit: extra line

> +				return ret;
> +			}
> +		}
> +
> +	drm_object_attach_property(&connector->base,
> +				   scaling_mode_property, default_scaler);
> +
> +	connector->scaling_mode_property = scaling_mode_property;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_connector_attach_custom_scaling_mode_property);
> +
> +/**
>   * drm_mode_create_aspect_ratio_property - create aspect ratio property
>   * @dev: DRM device
>   *
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 934143720e5a..f55ae02135c2 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -770,6 +770,8 @@ struct drm_connector {
>  	struct drm_property_blob *edid_blob_ptr;
>  	struct drm_object_properties properties;
>  
> +	struct drm_property *scaling_mode_property;
> +

Document please

>  	/**
>  	 * @path_blob_ptr:
>  	 *
> @@ -969,6 +971,9 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
>  				  unsigned int num_modes,
>  				  const char * const modes[]);
>  int drm_mode_create_scaling_mode_property(struct drm_device *dev);
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> +							   u32 scaling_mode_mask,
> +							   u32 default_value);
>  int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
>  int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties
  2017-04-25 11:55 ` [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties Maarten Lankhorst
  2017-04-25 15:14   ` Sean Paul
@ 2017-04-25 16:03   ` Ville Syrjälä
  1 sibling, 0 replies; 4+ messages in thread
From: Ville Syrjälä @ 2017-04-25 16:03 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx, dri-devel

On Tue, Apr 25, 2017 at 01:55:26PM +0200, Maarten Lankhorst wrote:
> Some connectors may not allow all scaling mode properties, this function will allow
> creating the scaling mode property with only the supported subset.
> 
> This will make it possible to convert i915 connectors to atomic.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/drm_atomic.c    |  3 ++-
>  drivers/gpu/drm/drm_connector.c | 45 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_connector.h     |  5 +++++
>  3 files changed, 52 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 25ea6f797a54..21db00d9a933 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1125,7 +1125,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
>  			state->link_status = val;
>  	} else if (property == config->aspect_ratio_property) {
>  		state->picture_aspect_ratio = val;
> -	} else if (property == config->scaling_mode_property) {
> +	} else if (property == config->scaling_mode_property ||

I would suggest ripping out the global property entirely, like I did for
the plane rotation property.

> +		   property == connector->scaling_mode_property) {
>  		state->scaling_mode = val;
>  	} else if (connector->funcs->atomic_set_property) {
>  		return connector->funcs->atomic_set_property(connector,
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 9f847615ac74..49baa21b4ce7 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -954,6 +954,7 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
>  				drm_scaling_mode_enum_list,
>  				    ARRAY_SIZE(drm_scaling_mode_enum_list));
>  
> +
>  	dev->mode_config.scaling_mode_property = scaling_mode;
>  
>  	return 0;
> @@ -961,6 +962,50 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
>  EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);
>  
>  /**
> + * drm_mode_connector_attach_custom_scaling_mode_property - TODO
> + */
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> +							   u32 scaling_mode_mask,
> +							   u32 default_scaler)
> +{
> +	struct drm_device *dev = connector->dev;
> +	struct drm_property *scaling_mode_property;
> +	int i;
> +
> +	if (!scaling_mode_mask)
> +		scaling_mode_mask = ~0U;
> +
> +	scaling_mode_mask &= (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
> +
> +	scaling_mode_property =
> +		drm_property_create(dev, 0, "scaling mode",
> +				    hweight32(scaling_mode_mask));
> +
> +	for (i = 0; i < ARRAY_SIZE(drm_scaling_mode_enum_list); i++)
> +		if (BIT(i) & scaling_mode_mask) {
> +			int ret;
> +
> +			ret = drm_property_add_enum(scaling_mode_property, i,
> +						    drm_scaling_mode_enum_list[i].type,
> +						    drm_scaling_mode_enum_list[i].name);
> +
> +			if (ret) {
> +				drm_property_destroy(dev, scaling_mode_property);
> +
> +				return ret;
> +			}
> +		}
> +
> +	drm_object_attach_property(&connector->base,
> +				   scaling_mode_property, default_scaler);
> +
> +	connector->scaling_mode_property = scaling_mode_property;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_connector_attach_custom_scaling_mode_property);
> +
> +/**
>   * drm_mode_create_aspect_ratio_property - create aspect ratio property
>   * @dev: DRM device
>   *
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 934143720e5a..f55ae02135c2 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -770,6 +770,8 @@ struct drm_connector {
>  	struct drm_property_blob *edid_blob_ptr;
>  	struct drm_object_properties properties;
>  
> +	struct drm_property *scaling_mode_property;
> +
>  	/**
>  	 * @path_blob_ptr:
>  	 *
> @@ -969,6 +971,9 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
>  				  unsigned int num_modes,
>  				  const char * const modes[]);
>  int drm_mode_create_scaling_mode_property(struct drm_device *dev);
> +int drm_mode_connector_attach_custom_scaling_mode_property(struct drm_connector *connector,
> +							   u32 scaling_mode_mask,
> +							   u32 default_value);
>  int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
>  int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-25 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1493121335-18603-1-git-send-email-maarten.lankhorst@linux.intel.com>
2017-04-25 11:55 ` [PATCH v5 01/11] drm/atomic: Handle aspect ratio and scaling mode in core, v3 Maarten Lankhorst
2017-04-25 11:55 ` [PATCH v5 02/11] drm/core: Allow attaching custom scaling mode properties Maarten Lankhorst
2017-04-25 15:14   ` Sean Paul
2017-04-25 16:03   ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox