If there's no real property change, don't need to set TV mode again.
(Fixed one checkpatch warning.)

Signed-off-by: Zhenyu Wang <zhenyu.z.w...@intel.com>
---
 drivers/gpu/drm/i915/intel_tv.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index ceca947..5d9ca77 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1571,32 +1571,45 @@ intel_tv_set_property(struct drm_connector *connector, 
struct drm_property *prop
        struct intel_output *intel_output = to_intel_output(connector);
        struct intel_tv_priv *tv_priv = intel_output->dev_priv;
        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)
+       if (property == dev->mode_config.tv_left_margin_property &&
+               tv_priv->margin[TV_MARGIN_LEFT] != val) {
                tv_priv->margin[TV_MARGIN_LEFT] = val;
-       else if (property == dev->mode_config.tv_right_margin_property)
+               changed = true;
+       } else if (property == dev->mode_config.tv_right_margin_property &&
+               tv_priv->margin[TV_MARGIN_RIGHT] != val) {
                tv_priv->margin[TV_MARGIN_RIGHT] = val;
-       else if (property == dev->mode_config.tv_top_margin_property)
+               changed = true;
+       } else if (property == dev->mode_config.tv_top_margin_property &&
+               tv_priv->margin[TV_MARGIN_TOP] != val) {
                tv_priv->margin[TV_MARGIN_TOP] = val;
-       else if (property == dev->mode_config.tv_bottom_margin_property)
+               changed = true;
+       } else if (property == dev->mode_config.tv_bottom_margin_property &&
+               tv_priv->margin[TV_MARGIN_BOTTOM] != val) {
                tv_priv->margin[TV_MARGIN_BOTTOM] = val;
-       else if (property == dev->mode_config.tv_mode_property) {
+               changed = true;
+       } else if (property == dev->mode_config.tv_mode_property) {
                if (val >= NUM_TV_MODES) {
                        ret = -EINVAL;
                        goto out;
                }
+               if (!strcmp(tv_priv->tv_format, tv_modes[val].name))
+                       goto out;
+
                tv_priv->tv_format = tv_modes[val].name;
-               intel_tv_mode_set(&intel_output->enc, NULL, NULL);
+               changed = true;
        } else {
                ret = -EINVAL;
                goto out;
        }
 
-       intel_tv_mode_set(&intel_output->enc, NULL, NULL);
+       if (changed)
+               intel_tv_mode_set(&intel_output->enc, NULL, NULL);
 out:
        return ret;
 }
-- 
1.5.6.5


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to