diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-21 17:23:52 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-22 10:56:56 -0500 |
commit | e953fd7bb32f55309a96abd5ceba9cf68d221434 (patch) | |
tree | 67110619366878f6412405ab63b7525f1c627544 /drivers/gpu/drm/i915/intel_sdvo.c | |
parent | ce453d81cb0397aa7d5148984f51907e14072d74 (diff) |
drm/i915: Add support for limited color range of broadcast outputs
In order to prevent "crushed blacks" on TVs, the range of the RGB output
may be limited to 16-235. This used to be available through Xorg under
the "Broadcast RGB" option, so reintroduce support for KMS.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34543
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 19c817a2df0c..9698e91f6a37 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -93,6 +93,12 @@ struct intel_sdvo { | |||
93 | uint16_t attached_output; | 93 | uint16_t attached_output; |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * This is used to select the color range of RBG outputs in HDMI mode. | ||
97 | * It is only valid when using TMDS encoding and 8 bit per color mode. | ||
98 | */ | ||
99 | uint32_t color_range; | ||
100 | |||
101 | /** | ||
96 | * This is set if we're going to treat the device as TV-out. | 102 | * This is set if we're going to treat the device as TV-out. |
97 | * | 103 | * |
98 | * While we have these nice friendly flags for output types that ought | 104 | * While we have these nice friendly flags for output types that ought |
@@ -1056,6 +1062,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1056 | /* Set the SDVO control regs. */ | 1062 | /* Set the SDVO control regs. */ |
1057 | if (INTEL_INFO(dev)->gen >= 4) { | 1063 | if (INTEL_INFO(dev)->gen >= 4) { |
1058 | sdvox = 0; | 1064 | sdvox = 0; |
1065 | if (intel_sdvo->is_hdmi) | ||
1066 | sdvox |= intel_sdvo->color_range; | ||
1059 | if (INTEL_INFO(dev)->gen < 5) | 1067 | if (INTEL_INFO(dev)->gen < 5) |
1060 | sdvox |= SDVO_BORDER_ENABLE; | 1068 | sdvox |= SDVO_BORDER_ENABLE; |
1061 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 1069 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
@@ -1695,6 +1703,7 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1695 | { | 1703 | { |
1696 | struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector); | 1704 | struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector); |
1697 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); | 1705 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); |
1706 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
1698 | uint16_t temp_value; | 1707 | uint16_t temp_value; |
1699 | uint8_t cmd; | 1708 | uint8_t cmd; |
1700 | int ret; | 1709 | int ret; |
@@ -1724,6 +1733,14 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1724 | goto done; | 1733 | goto done; |
1725 | } | 1734 | } |
1726 | 1735 | ||
1736 | if (property == dev_priv->broadcast_rgb_property) { | ||
1737 | if (val == !!intel_sdvo->color_range) | ||
1738 | return 0; | ||
1739 | |||
1740 | intel_sdvo->color_range = val ? SDVO_COLOR_RANGE_16_235 : 0; | ||
1741 | goto done; | ||
1742 | } | ||
1743 | |||
1727 | #define CHECK_PROPERTY(name, NAME) \ | 1744 | #define CHECK_PROPERTY(name, NAME) \ |
1728 | if (intel_sdvo_connector->name == property) { \ | 1745 | if (intel_sdvo_connector->name == property) { \ |
1729 | if (intel_sdvo_connector->cur_##name == temp_value) return 0; \ | 1746 | if (intel_sdvo_connector->cur_##name == temp_value) return 0; \ |
@@ -2028,6 +2045,9 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector) | |||
2028 | drm_connector_attach_property(&connector->base.base, | 2045 | drm_connector_attach_property(&connector->base.base, |
2029 | connector->force_audio_property, 0); | 2046 | connector->force_audio_property, 0); |
2030 | } | 2047 | } |
2048 | |||
2049 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) | ||
2050 | intel_attach_broadcast_rgb_property(&connector->base.base); | ||
2031 | } | 2051 | } |
2032 | 2052 | ||
2033 | static bool | 2053 | static bool |