aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b506e3622b08..cd25bd08bf53 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4830,19 +4830,32 @@ void drm_set_preferred_mode(struct drm_connector *connector,
4830} 4830}
4831EXPORT_SYMBOL(drm_set_preferred_mode); 4831EXPORT_SYMBOL(drm_set_preferred_mode);
4832 4832
4833static bool is_hdmi2_sink(struct drm_connector *connector)
4834{
4835 /*
4836 * FIXME: sil-sii8620 doesn't have a connector around when
4837 * we need one, so we have to be prepared for a NULL connector.
4838 */
4839 if (!connector)
4840 return true;
4841
4842 return connector->display_info.hdmi.scdc.supported ||
4843 connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB420;
4844}
4845
4833/** 4846/**
4834 * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with 4847 * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
4835 * data from a DRM display mode 4848 * data from a DRM display mode
4836 * @frame: HDMI AVI infoframe 4849 * @frame: HDMI AVI infoframe
4850 * @connector: the connector
4837 * @mode: DRM display mode 4851 * @mode: DRM display mode
4838 * @is_hdmi2_sink: Sink is HDMI 2.0 compliant
4839 * 4852 *
4840 * Return: 0 on success or a negative error code on failure. 4853 * Return: 0 on success or a negative error code on failure.
4841 */ 4854 */
4842int 4855int
4843drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 4856drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
4844 const struct drm_display_mode *mode, 4857 struct drm_connector *connector,
4845 bool is_hdmi2_sink) 4858 const struct drm_display_mode *mode)
4846{ 4859{
4847 enum hdmi_picture_aspect picture_aspect; 4860 enum hdmi_picture_aspect picture_aspect;
4848 int err; 4861 int err;
@@ -4864,7 +4877,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
4864 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we 4877 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
4865 * have to make sure we dont break HDMI 1.4 sinks. 4878 * have to make sure we dont break HDMI 1.4 sinks.
4866 */ 4879 */
4867 if (!is_hdmi2_sink && frame->video_code > 64) 4880 if (!is_hdmi2_sink(connector) && frame->video_code > 64)
4868 frame->video_code = 0; 4881 frame->video_code = 0;
4869 4882
4870 /* 4883 /*
@@ -4923,21 +4936,17 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
4923 * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe 4936 * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
4924 * quantization range information 4937 * quantization range information
4925 * @frame: HDMI AVI infoframe 4938 * @frame: HDMI AVI infoframe
4939 * @connector: the connector
4926 * @mode: DRM display mode 4940 * @mode: DRM display mode
4927 * @rgb_quant_range: RGB quantization range (Q) 4941 * @rgb_quant_range: RGB quantization range (Q)
4928 * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS) 4942 * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
4929 * @is_hdmi2_sink: HDMI 2.0 sink, which has different default recommendations
4930 *
4931 * Note that @is_hdmi2_sink can be derived by looking at the
4932 * &drm_scdc.supported flag stored in &drm_hdmi_info.scdc,
4933 * &drm_display_info.hdmi, which can be found in &drm_connector.display_info.
4934 */ 4943 */
4935void 4944void
4936drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, 4945drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
4946 struct drm_connector *connector,
4937 const struct drm_display_mode *mode, 4947 const struct drm_display_mode *mode,
4938 enum hdmi_quantization_range rgb_quant_range, 4948 enum hdmi_quantization_range rgb_quant_range,
4939 bool rgb_quant_range_selectable, 4949 bool rgb_quant_range_selectable)
4940 bool is_hdmi2_sink)
4941{ 4950{
4942 /* 4951 /*
4943 * CEA-861: 4952 * CEA-861:
@@ -4968,7 +4977,7 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
4968 * we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based 4977 * we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based
4969 * on on CEA-861-F. 4978 * on on CEA-861-F.
4970 */ 4979 */
4971 if (!is_hdmi2_sink || 4980 if (!is_hdmi2_sink(connector) ||
4972 rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED) 4981 rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
4973 frame->ycc_quantization_range = 4982 frame->ycc_quantization_range =
4974 HDMI_YCC_QUANTIZATION_RANGE_LIMITED; 4983 HDMI_YCC_QUANTIZATION_RANGE_LIMITED;