[PATCH 17/20] drm: remove checks for same value in set_prop

Sascha Hauer s.hauer at pengutronix.de
Wed Feb 1 02:38:35 PST 2012


The drivers currently check in set_property whether the property is
unchanged. move this check into the core and do not bother the drivers
with checking for unchanged properties.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/gpu/drm/drm_crtc.c                  |    5 ++++
 drivers/gpu/drm/gma500/cdv_intel_lvds.c     |   10 --------
 drivers/gpu/drm/gma500/psb_intel_lvds.c     |   11 ---------
 drivers/gpu/drm/gma500/psb_intel_sdvo.c     |   12 ----------
 drivers/gpu/drm/i915/intel_dp.c             |    6 -----
 drivers/gpu/drm/i915/intel_tv.c             |   27 ++++------------------
 drivers/gpu/drm/nouveau/nouveau_connector.c |   32 ++++++++++----------------
 drivers/gpu/drm/radeon/radeon_connectors.c  |   24 ++++++-------------
 8 files changed, 30 insertions(+), 97 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b815e69..e03d4b8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2961,6 +2961,11 @@ found:
 		}
 	}
 
+	if (cprop->val == out_resp->value) {
+		ret = 0;
+		goto out;
+	}
+
 	/* Do DPMS ourselves */
 	if (property == connector->dev->mode_config.dpms_property) {
 		if (connector->funcs->dpms)
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 50e744b..7569e8e 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -457,8 +457,6 @@ int cdv_intel_lvds_set_property(struct drm_connector *connector,
 	if (!strcmp(property->name, "scaling mode") && encoder) {
 		struct psb_intel_crtc *crtc =
 					to_psb_intel_crtc(encoder->crtc);
-		uint64_t curValue;
-
 		if (!crtc)
 			return -1;
 
@@ -473,14 +471,6 @@ int cdv_intel_lvds_set_property(struct drm_connector *connector,
 			return -1;
 		}
 
-		if (drm_connector_property_get_value(connector,
-						     property,
-						     &curValue))
-			return -1;
-
-		if (curValue == value)
-			return 0;
-
 		if (drm_connector_property_set_value(connector,
 							property,
 							value))
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index a25e4ca..7c9498ea 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -587,8 +587,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 	if (!strcmp(property->name, "scaling mode")) {
 		struct psb_intel_crtc *crtc =
 					to_psb_intel_crtc(encoder->crtc);
-		uint64_t curval;
-
 		if (!crtc)
 			goto set_prop_error;
 
@@ -603,14 +601,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 			goto set_prop_error;
 		}
 
-		if (drm_connector_property_get_value(connector,
-						     property,
-						     &curval))
-			goto set_prop_error;
-
-		if (curval == value)
-			goto set_prop_done;
-
 		if (drm_connector_property_set_value(connector,
 							property,
 							value))
@@ -647,7 +637,6 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 		hfuncs->dpms(encoder, value);
 	}
 
-set_prop_done:
 	return 0;
 set_prop_error:
 	return -1;
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 63a11dc..b9c6da9 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -1751,10 +1751,6 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
 		if (val >= TV_FORMAT_NUM)
 			return -EINVAL;
 
-		if (psb_intel_sdvo->tv_format_index ==
-		    psb_intel_sdvo_connector->tv_format_supported[val])
-			return 0;
-
 		psb_intel_sdvo->tv_format_index = psb_intel_sdvo_connector->tv_format_supported[val];
 		goto done;
 	} else if (IS_TV_OR_LVDS(psb_intel_sdvo_connector)) {
@@ -1762,8 +1758,6 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
 		if (psb_intel_sdvo_connector->left == property) {
 			drm_connector_property_set_value(connector,
 							 psb_intel_sdvo_connector->right, val);
-			if (psb_intel_sdvo_connector->left_margin == temp_value)
-				return 0;
 
 			psb_intel_sdvo_connector->left_margin = temp_value;
 			psb_intel_sdvo_connector->right_margin = temp_value;
@@ -1774,8 +1768,6 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
 		} else if (psb_intel_sdvo_connector->right == property) {
 			drm_connector_property_set_value(connector,
 							 psb_intel_sdvo_connector->left, val);
-			if (psb_intel_sdvo_connector->right_margin == temp_value)
-				return 0;
 
 			psb_intel_sdvo_connector->left_margin = temp_value;
 			psb_intel_sdvo_connector->right_margin = temp_value;
@@ -1786,8 +1778,6 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
 		} else if (psb_intel_sdvo_connector->top == property) {
 			drm_connector_property_set_value(connector,
 							 psb_intel_sdvo_connector->bottom, val);
-			if (psb_intel_sdvo_connector->top_margin == temp_value)
-				return 0;
 
 			psb_intel_sdvo_connector->top_margin = temp_value;
 			psb_intel_sdvo_connector->bottom_margin = temp_value;
@@ -1798,8 +1788,6 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
 		} else if (psb_intel_sdvo_connector->bottom == property) {
 			drm_connector_property_set_value(connector,
 							 psb_intel_sdvo_connector->top, val);
-			if (psb_intel_sdvo_connector->bottom_margin == temp_value)
-				return 0;
 
 			psb_intel_sdvo_connector->top_margin = temp_value;
 			psb_intel_sdvo_connector->bottom_margin = temp_value;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index db3b461..0024b59 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2223,9 +2223,6 @@ intel_dp_set_property(struct drm_connector *connector,
 		int i = val;
 		bool has_audio;
 
-		if (i == intel_dp->force_audio)
-			return 0;
-
 		intel_dp->force_audio = i;
 
 		if (i == 0)
@@ -2241,9 +2238,6 @@ intel_dp_set_property(struct drm_connector *connector,
 	}
 
 	if (property == dev_priv->broadcast_rgb_property) {
-		if (val == !!intel_dp->color_range)
-			return 0;
-
 		intel_dp->color_range = val ? DP_COLOR_RANGE_16_235 : 0;
 		goto done;
 	}
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 1571be3..6eb11fe 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1380,44 +1380,27 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop
 	struct intel_tv *intel_tv = intel_attached_tv(connector);
 	struct drm_crtc *crtc = intel_tv->base.base.crtc;
 	int ret = 0;
-	bool changed = false;
 
 	ret = drm_connector_property_set_value(connector, property, val);
 	if (ret < 0)
 		goto out;
 
-	if (property == dev->mode_config.tv_left_margin_property &&
-		intel_tv->margin[TV_MARGIN_LEFT] != val) {
+	if (property == dev->mode_config.tv_left_margin_property) {
 		intel_tv->margin[TV_MARGIN_LEFT] = val;
-		changed = true;
-	} else if (property == dev->mode_config.tv_right_margin_property &&
-		intel_tv->margin[TV_MARGIN_RIGHT] != val) {
+	} else if (property == dev->mode_config.tv_right_margin_property) {
 		intel_tv->margin[TV_MARGIN_RIGHT] = val;
-		changed = true;
-	} else if (property == dev->mode_config.tv_top_margin_property &&
-		intel_tv->margin[TV_MARGIN_TOP] != val) {
+	} else if (property == dev->mode_config.tv_top_margin_property) {
 		intel_tv->margin[TV_MARGIN_TOP] = val;
-		changed = true;
-	} else if (property == dev->mode_config.tv_bottom_margin_property &&
-		intel_tv->margin[TV_MARGIN_BOTTOM] != val) {
+	} else if (property == dev->mode_config.tv_bottom_margin_property) {
 		intel_tv->margin[TV_MARGIN_BOTTOM] = val;
-		changed = true;
 	} else if (property == dev->mode_config.tv_mode_property) {
-		if (val >= ARRAY_SIZE(tv_modes)) {
-			ret = -EINVAL;
-			goto out;
-		}
-		if (!strcmp(intel_tv->tv_format, tv_modes[val].name))
-			goto out;
-
 		intel_tv->tv_format = tv_modes[val].name;
-		changed = true;
 	} else {
 		ret = -EINVAL;
 		goto out;
 	}
 
-	if (changed && crtc)
+	if (crtc)
 		drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x,
 				crtc->y, crtc->fb);
 out:
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index f3ce34b..c149943 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -467,39 +467,31 @@ nouveau_connector_set_property(struct drm_connector *connector,
 
 	/* Underscan */
 	if (property == disp->underscan_property) {
-		if (nv_connector->underscan != value) {
-			nv_connector->underscan = value;
-			if (!nv_crtc || !nv_crtc->set_scale)
-				return 0;
+		nv_connector->underscan = value;
+		if (!nv_crtc || !nv_crtc->set_scale)
+			return 0;
 
-			return nv_crtc->set_scale(nv_crtc, true);
-		}
+		return nv_crtc->set_scale(nv_crtc, true);
 
 		return 0;
 	}
 
 	if (property == disp->underscan_hborder_property) {
-		if (nv_connector->underscan_hborder != value) {
-			nv_connector->underscan_hborder = value;
-			if (!nv_crtc || !nv_crtc->set_scale)
-				return 0;
+		nv_connector->underscan_hborder = value;
+		if (!nv_crtc || !nv_crtc->set_scale)
+			return 0;
 
-			return nv_crtc->set_scale(nv_crtc, true);
-		}
+		return nv_crtc->set_scale(nv_crtc, true);
 
 		return 0;
 	}
 
 	if (property == disp->underscan_vborder_property) {
-		if (nv_connector->underscan_vborder != value) {
-			nv_connector->underscan_vborder = value;
-			if (!nv_crtc || !nv_crtc->set_scale)
-				return 0;
-
-			return nv_crtc->set_scale(nv_crtc, true);
-		}
+		nv_connector->underscan_vborder = value;
+		if (!nv_crtc || !nv_crtc->set_scale)
+			return 0;
 
-		return 0;
+		return nv_crtc->set_scale(nv_crtc, true);
 	}
 
 	/* Dithering */
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e7cb3ab..b0d2dcd 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -319,10 +319,8 @@ int radeon_connector_set_property(struct drm_connector *connector, struct drm_pr
 
 		dig = radeon_encoder->enc_priv;
 		new_coherent_mode = val ? true : false;
-		if (dig->coherent_mode != new_coherent_mode) {
-			dig->coherent_mode = new_coherent_mode;
-			radeon_property_change_mode(&radeon_encoder->base);
-		}
+		dig->coherent_mode = new_coherent_mode;
+		radeon_property_change_mode(&radeon_encoder->base);
 	}
 
 	if (property == rdev->mode_info.underscan_property) {
@@ -333,10 +331,8 @@ int radeon_connector_set_property(struct drm_connector *connector, struct drm_pr
 
 		radeon_encoder = to_radeon_encoder(encoder);
 
-		if (radeon_encoder->underscan_type != val) {
-			radeon_encoder->underscan_type = val;
-			radeon_property_change_mode(&radeon_encoder->base);
-		}
+		radeon_encoder->underscan_type = val;
+		radeon_property_change_mode(&radeon_encoder->base);
 	}
 
 	if (property == rdev->mode_info.underscan_hborder_property) {
@@ -347,10 +343,8 @@ int radeon_connector_set_property(struct drm_connector *connector, struct drm_pr
 
 		radeon_encoder = to_radeon_encoder(encoder);
 
-		if (radeon_encoder->underscan_hborder != val) {
-			radeon_encoder->underscan_hborder = val;
-			radeon_property_change_mode(&radeon_encoder->base);
-		}
+		radeon_encoder->underscan_hborder = val;
+		radeon_property_change_mode(&radeon_encoder->base);
 	}
 
 	if (property == rdev->mode_info.underscan_vborder_property) {
@@ -361,10 +355,8 @@ int radeon_connector_set_property(struct drm_connector *connector, struct drm_pr
 
 		radeon_encoder = to_radeon_encoder(encoder);
 
-		if (radeon_encoder->underscan_vborder != val) {
-			radeon_encoder->underscan_vborder = val;
-			radeon_property_change_mode(&radeon_encoder->base);
-		}
+		radeon_encoder->underscan_vborder = val;
+		radeon_property_change_mode(&radeon_encoder->base);
 	}
 
 	if (property == rdev->mode_info.tv_std_property) {
-- 
1.7.8.3



More information about the dri-devel mailing list