diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2017-01-11 16:18:35 +0200 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2019-03-08 08:49:30 +0800 |
commit | 738f34027fed1298d2ccf8aab25c6ac92a19a310 (patch) | |
tree | aed79859e667289c8a32ee7d646241831fcadb28 | |
parent | 6ff461709c7bc09c526203834357b3114d8ea53c (diff) |
UPSTREAM: drm/edid: Introduce drm_default_rgb_quant_range()
Make the code selecting the RGB quantization range a little less magicy
by wrapping it up in a small helper.
v2: s/adjusted_mode/mode in vc4 to make it actually compile
v3: Add a comment proposed by Eric
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170111141835.25369-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit c8127cf08ab9797c3954df463741ac47039d2b55)
Change-Id: I33894c6e3a2033b168f78918e4a8dbf167201632
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 3 | ||||
-rw-r--r-- | include/drm/drm_edid.h | 2 |
4 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 61453724c7d4..520d0ec64add 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4244,6 +4244,25 @@ static void drm_parse_hdmi_forum_vsdb(struct drm_connector *connector, drm_parse_ycbcr420_deep_color_info(connector, hf_vsdb); } +/** + * drm_default_rgb_quant_range - default RGB quantization range + * @mode: display mode + * + * Determine the default RGB quantization range for the mode, + * as specified in CEA-861. + * + * Return: The default RGB quantization range for the mode + */ +enum hdmi_quantization_range +drm_default_rgb_quant_range(const struct drm_display_mode *mode) +{ + /* All CEA modes other than VIC 1 use limited quantization range. */ + return drm_match_cea_mode(mode) > 1 ? + HDMI_QUANTIZATION_RANGE_LIMITED : + HDMI_QUANTIZATION_RANGE_FULL; +} +EXPORT_SYMBOL(drm_default_rgb_quant_range); + static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, const u8 *hdmi) { diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 65f46e198798..f7be47c584a9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1493,7 +1493,9 @@ found: * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry */ pipe_config->limited_color_range = - bpp != 18 && drm_match_cea_mode(adjusted_mode) > 1; + bpp != 18 && + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED; } else { pipe_config->limited_color_range = intel_dp->limited_color_range; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 5b8aeafcbfc4..1f264a72fb9b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1262,7 +1262,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, /* See CEA-861-E - 5.1 Default Encoding Parameters */ pipe_config->limited_color_range = pipe_config->has_hdmi_sink && - drm_match_cea_mode(adjusted_mode) > 1; + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED; } else { pipe_config->limited_color_range = intel_hdmi->limited_color_range; diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 85861b63e77a..6989b1a44f08 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -421,5 +421,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, int (*get_edid_block)(void *data, u8 *buf, unsigned int block, size_t len), void *data); +enum hdmi_quantization_range +drm_default_rgb_quant_range(const struct drm_display_mode *mode); #endif /* __DRM_EDID_H__ */ |