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_hdmi.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_hdmi.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index c635c9e357b9..f289b8642976 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -41,6 +41,7 @@ struct intel_hdmi { | |||
41 | struct intel_encoder base; | 41 | struct intel_encoder base; |
42 | u32 sdvox_reg; | 42 | u32 sdvox_reg; |
43 | int ddc_bus; | 43 | int ddc_bus; |
44 | uint32_t color_range; | ||
44 | bool has_hdmi_sink; | 45 | bool has_hdmi_sink; |
45 | bool has_audio; | 46 | bool has_audio; |
46 | int force_audio; | 47 | int force_audio; |
@@ -124,6 +125,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder, | |||
124 | u32 sdvox; | 125 | u32 sdvox; |
125 | 126 | ||
126 | sdvox = SDVO_ENCODING_HDMI | SDVO_BORDER_ENABLE; | 127 | sdvox = SDVO_ENCODING_HDMI | SDVO_BORDER_ENABLE; |
128 | sdvox |= intel_hdmi->color_range; | ||
127 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 129 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
128 | sdvox |= SDVO_VSYNC_ACTIVE_HIGH; | 130 | sdvox |= SDVO_VSYNC_ACTIVE_HIGH; |
129 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 131 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
@@ -278,6 +280,7 @@ intel_hdmi_set_property(struct drm_connector *connector, | |||
278 | uint64_t val) | 280 | uint64_t val) |
279 | { | 281 | { |
280 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); | 282 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
283 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
281 | int ret; | 284 | int ret; |
282 | 285 | ||
283 | ret = drm_connector_property_set_value(connector, property, val); | 286 | ret = drm_connector_property_set_value(connector, property, val); |
@@ -305,6 +308,14 @@ intel_hdmi_set_property(struct drm_connector *connector, | |||
305 | goto done; | 308 | goto done; |
306 | } | 309 | } |
307 | 310 | ||
311 | if (property == dev_priv->broadcast_rgb_property) { | ||
312 | if (val == !!intel_hdmi->color_range) | ||
313 | return 0; | ||
314 | |||
315 | intel_hdmi->color_range = val ? SDVO_COLOR_RANGE_16_235 : 0; | ||
316 | goto done; | ||
317 | } | ||
318 | |||
308 | return -EINVAL; | 319 | return -EINVAL; |
309 | 320 | ||
310 | done: | 321 | done: |
@@ -363,6 +374,8 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c | |||
363 | intel_hdmi->force_audio_property->values[1] = 1; | 374 | intel_hdmi->force_audio_property->values[1] = 1; |
364 | drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0); | 375 | drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0); |
365 | } | 376 | } |
377 | |||
378 | intel_attach_broadcast_rgb_property(connector); | ||
366 | } | 379 | } |
367 | 380 | ||
368 | void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | 381 | void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) |