diff options
author | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2009-03-23 07:40:57 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-04-01 18:21:59 -0400 |
commit | ebcc8f2eade76946dbb5d5c545b91f8157051aa8 (patch) | |
tree | 9570ae19eb99ed2245ff7f5b69fca2ae125da435 /drivers/gpu/drm/i915 | |
parent | 580982d399071474c349538b7f5780bc79b54e7f (diff) |
drm/i915: only set TV mode when any property changed
If there's no real property change, don't need to set TV mode again.
Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
[anholt: checkpatch.pl fix]
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | 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 ceca9471a75a..5d9ca779ce25 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 | |||
1571 | struct intel_output *intel_output = to_intel_output(connector); | 1571 | struct intel_output *intel_output = to_intel_output(connector); |
1572 | struct intel_tv_priv *tv_priv = intel_output->dev_priv; | 1572 | struct intel_tv_priv *tv_priv = intel_output->dev_priv; |
1573 | int ret = 0; | 1573 | int ret = 0; |
1574 | bool changed = false; | ||
1574 | 1575 | ||
1575 | ret = drm_connector_property_set_value(connector, property, val); | 1576 | ret = drm_connector_property_set_value(connector, property, val); |
1576 | if (ret < 0) | 1577 | if (ret < 0) |
1577 | goto out; | 1578 | goto out; |
1578 | 1579 | ||
1579 | if (property == dev->mode_config.tv_left_margin_property) | 1580 | if (property == dev->mode_config.tv_left_margin_property && |
1581 | tv_priv->margin[TV_MARGIN_LEFT] != val) { | ||
1580 | tv_priv->margin[TV_MARGIN_LEFT] = val; | 1582 | tv_priv->margin[TV_MARGIN_LEFT] = val; |
1581 | else if (property == dev->mode_config.tv_right_margin_property) | 1583 | changed = true; |
1584 | } else if (property == dev->mode_config.tv_right_margin_property && | ||
1585 | tv_priv->margin[TV_MARGIN_RIGHT] != val) { | ||
1582 | tv_priv->margin[TV_MARGIN_RIGHT] = val; | 1586 | tv_priv->margin[TV_MARGIN_RIGHT] = val; |
1583 | else if (property == dev->mode_config.tv_top_margin_property) | 1587 | changed = true; |
1588 | } else if (property == dev->mode_config.tv_top_margin_property && | ||
1589 | tv_priv->margin[TV_MARGIN_TOP] != val) { | ||
1584 | tv_priv->margin[TV_MARGIN_TOP] = val; | 1590 | tv_priv->margin[TV_MARGIN_TOP] = val; |
1585 | else if (property == dev->mode_config.tv_bottom_margin_property) | 1591 | changed = true; |
1592 | } else if (property == dev->mode_config.tv_bottom_margin_property && | ||
1593 | tv_priv->margin[TV_MARGIN_BOTTOM] != val) { | ||
1586 | tv_priv->margin[TV_MARGIN_BOTTOM] = val; | 1594 | tv_priv->margin[TV_MARGIN_BOTTOM] = val; |
1587 | else if (property == dev->mode_config.tv_mode_property) { | 1595 | changed = true; |
1596 | } else if (property == dev->mode_config.tv_mode_property) { | ||
1588 | if (val >= NUM_TV_MODES) { | 1597 | if (val >= NUM_TV_MODES) { |
1589 | ret = -EINVAL; | 1598 | ret = -EINVAL; |
1590 | goto out; | 1599 | goto out; |
1591 | } | 1600 | } |
1601 | if (!strcmp(tv_priv->tv_format, tv_modes[val].name)) | ||
1602 | goto out; | ||
1603 | |||
1592 | tv_priv->tv_format = tv_modes[val].name; | 1604 | tv_priv->tv_format = tv_modes[val].name; |
1593 | intel_tv_mode_set(&intel_output->enc, NULL, NULL); | 1605 | changed = true; |
1594 | } else { | 1606 | } else { |
1595 | ret = -EINVAL; | 1607 | ret = -EINVAL; |
1596 | goto out; | 1608 | goto out; |
1597 | } | 1609 | } |
1598 | 1610 | ||
1599 | intel_tv_mode_set(&intel_output->enc, NULL, NULL); | 1611 | if (changed) |
1612 | intel_tv_mode_set(&intel_output->enc, NULL, NULL); | ||
1600 | out: | 1613 | out: |
1601 | return ret; | 1614 | return ret; |
1602 | } | 1615 | } |