Skip to contentSkip to conversation

drm/edid: Improve RGB limited range handling a bit

PATCH In review [email protected] 6 participants 25 messages Jan 11, 2017 – Jan 26, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover drm/edid: Improve RGB limited range handling a bit

From: Ville Syrjälä <[email protected]>

While reading the HDMI 2.0 spec I noticed some new things related to the RGB quantization range stuff, and after cross checking with CEA-861-F I spotted a some other things as well. So I figured I should pimp up the code a bit.

And since we now have two drivers that deal with this stuff, I decided to move a bunch of the code to the core to avoid duplicating the code and having different bugs/features for each driver. I still left the state computation part in the drivers, but eventually we might want to move that code into some helper as well.

Entire series available here:
git://github.com/vsyrjala/linux.git hdmi_quant_range_helpers

Ville Syrjälä (5):
drm/edid: Have drm_edid.h include hdmi.h
drm/edid: Introduce drm_default_rgb_quant_range() drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range() drm/edid: Set AVI infoframe Q even when QS=0
drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

 drivers/gpu/drm/drm_edid.c        | 64 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 ++-
 drivers/gpu/drm/i915/intel_hdmi.c | 20 ++++++------
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 18 +++++------
 include/drm/drm_edid.h            | 10 ++++--
 5 files changed, 93 insertions(+), 23 deletions(-)
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/5 drm/edid: Have drm_edid.h include hdmi.h

From: Ville Syrjälä <[email protected]>

drm_edid.h depends on hdmi.h on account of enum hdmi_picture_aspect, so let's just include hdmi.h and drop some useless struct declarations.

---
 include/drm/drm_edid.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/drm/drm_edid.h +1 -2
index 38eabf65f19d..838eaf2b42e9 100644
@@ -24,6 +24,7 @@
 #define __DRM_EDID_H__
 
 #include <linux/types.h>
+#include <linux/hdmi.h>
 
 struct drm_device;
 struct i2c_adapter;
@@ -322,8 +323,6 @@ struct cea_sad {
 struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
-struct hdmi_avi_infoframe;
-struct hdmi_vendor_infoframe;
 
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] drm/edid: Have drm_edid.h include hdmi.h

Quoted 6 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

drm_edid.h depends on hdmi.h on account of enum hdmi_picture_aspect, so let's just include hdmi.h and drop some useless struct declarations.

Quoted 25 lines
---
 include/drm/drm_edid.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/drm/drm_edid.h +1 -2
index 38eabf65f19d..838eaf2b42e9 100644
@@ -24,6 +24,7 @@
 #define __DRM_EDID_H__
 
 #include <linux/types.h>
+#include <linux/hdmi.h>
 
 struct drm_device;
 struct i2c_adapter;
@@ -322,8 +323,6 @@ struct cea_sad {
 struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
-struct hdmi_avi_infoframe;
-struct hdmi_vendor_infoframe;
 
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/5 drm/edid: Introduce drm_default_rgb_quant_range()

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +18 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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)
+{
+	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)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..d79466a42690 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(adjusted_mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH v2 2/5 drm/edid: Introduce drm_default_rgb_quant_range()

From: Ville Syrjälä <[email protected]>

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

---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +18 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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)
+{
+	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)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..5d49bf948162 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v2 2/5
#5 lore raw

Re: [PATCH v2 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 31 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

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

---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +7 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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.
+ *

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3787

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+ * Return: The default RGB quantization range for the mode
+ */
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode)
+{
+	return drm_match_cea_mode(mode) > 1 ?
+		HDMI_QUANTIZATION_RANGE_LIMITED :
+		HDMI_QUANTIZATION_RANGE_FULL;
+}
+EXPORT_SYMBOL(drm_default_rgb_quant_range);

Or just bool drm_default_to_limited_range() or similar?

*shrug*

Quoted 61 lines
drivers/gpu/drm/drm_edid.c +1 -0
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..5d49bf948162 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [Intel-gfx] [PATCH v2 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 36 lines · Jani Nikula
Quoted 35 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

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

---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +11 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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)
Quoted 8 lines

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3787

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+{
+	return drm_match_cea_mode(mode) > 1 ?
+		HDMI_QUANTIZATION_RANGE_LIMITED :
+		HDMI_QUANTIZATION_RANGE_FULL;
+}
+EXPORT_SYMBOL(drm_default_rgb_quant_range);

Or just bool drm_default_to_limited_range() or similar?

That's what I had initially, but then I thought it might be better to start moving towards something a bit more explicit everwhere. But I stopped short of actually making the drivers store the enum in their state. We might want to do that, I think.

Quoted 71 lines

*shrug*

Quoted 61 lines
drivers/gpu/drm/drm_edid.c +1 -0
+
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
 					   const u8 *hdmi)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..5d49bf948162 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

In reply to [email protected]
Quoted 6 lines · On Wed, Jan 11, 2017 at 02:57:22PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

Needs cc: for driver maintainers, Eric for vc4 here. -Daniel

Quoted 101 lines
---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +18 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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)
+{
+	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)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..d79466a42690 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(adjusted_mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 9 lines · Daniel Vetter
Quoted 6 lines · On Wed, Jan 11, 2017 at 02:57:22PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

Needs cc: for driver maintainers, Eric for vc4 here.

Eric was cc:d. I was just too lazy to add the cc:s to all the commit messages, and so i just used --cc on the whole lot.

Quoted 108 lines

-Daniel

Quoted 101 lines
---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +18 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * 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)
+{
+	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)
 {
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 343e1d9fa761..d4befbbe834a 100644
@@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 		 * 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;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index 0bcfead14571..19bd13f53729 100644
@@ -1330,7 +1330,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;
drivers/gpu/drm/vc4/vc4_hdmi.c +3 -1
index c4cb2e26de32..d79466a42690 100644
@@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
 	csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
 				VC4_HD_CSC_CTL_ORDER);
 
-	if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) {
+	if (vc4_encoder->hdmi_monitor &&
+	    drm_default_rgb_quant_range(adjusted_mode) ==
+	    HDMI_QUANTIZATION_RANGE_LIMITED) {
 		/* CEA VICs other than #1 requre limited range RGB
 		 * output unless overridden by an AVI infoframe.
 		 * Apply a colorspace conversion to squash 0-255 down
include/drm/drm_edid.h +2 -0
index 838eaf2b42e9..25cdf5f7a0d8 100644
@@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 bool drm_detect_hdmi_monitor(struct edid *edid);
 bool drm_detect_monitor_audio(struct edid *edid);
 bool drm_rgb_quant_range_selectable(struct edid *edid);
+enum hdmi_quantization_range
+drm_default_rgb_quant_range(const struct drm_display_mode *mode);
 int drm_add_modes_noedid(struct drm_connector *connector,
 			 int hdisplay, int vdisplay);
 void drm_set_preferred_mode(struct drm_connector *connector,
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 7 lines · Ville Syrjälä
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · On Wed, Jan 11, 2017 at 02:57:22PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Needs cc: for driver maintainers, Eric for vc4 here.

Eric was cc:d. I was just too lazy to add the cc:s to all the commit messages, and so i just used --cc on the whole lot.

Hm, he's not on the cc: list over here (on the mails, not in the patch body).
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Ville Syrjälä
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · On Wed, Jan 11, 2017 at 02:57:22PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Needs cc: for driver maintainers, Eric for vc4 here.

Eric was cc:d. I was just too lazy to add the cc:s to all the commit messages, and so i just used --cc on the whole lot.

Hm, he's not on the cc: list over here (on the mails, not in the patch body).

That could be because he has "Avoid duplicate copies of messages?" enabled in his mailman subscription options.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

In reply to [email protected]
Quoted 4 lines · [email protected] writes:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

This series seems good. I won't have the ability to test it on vc4 within a reasonable time frame, so you can add an Acked-by from me if you'd like. Just one comment that you can take or leave:

Quoted 22 lines
---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +5 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * drm_default_rgb_quant_range - default RGB quantization range
+ * @mode: display mode
+ *
+ * Determine the default RGB quantization range for the mode,

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3785

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+ * 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)
+{
+	return drm_match_cea_mode(mode) > 1 ?
+		HDMI_QUANTIZATION_RANGE_LIMITED :
+		HDMI_QUANTIZATION_RANGE_FULL;

It might be nice to add a comment here like

/* All CEA modes other than VIC 1 use limited quantization range. */

When I first had to put this logic in vc4, I was surprised by it and figured that it was an off-by-one bug in code that was trying to say "if it's any CEA mode then it should be limited range"

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3787

Quoted 2 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+EXPORT_SYMBOL(drm_default_rgb_quant_range);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

Re: [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 46 lines · Eric Anholt
Quoted 4 lines · [email protected] writes:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

This series seems good. I won't have the ability to test it on vc4 within a reasonable time frame, so you can add an Acked-by from me if you'd like. Just one comment that you can take or leave:

Quoted 22 lines
---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +5 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * drm_default_rgb_quant_range - default RGB quantization range
+ * @mode: display mode
+ *
+ * Determine the default RGB quantization range for the mode,

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3785

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+ * 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)
+{
+	return drm_match_cea_mode(mode) > 1 ?
+		HDMI_QUANTIZATION_RANGE_LIMITED :
+		HDMI_QUANTIZATION_RANGE_FULL;

It might be nice to add a comment here like

Quoted 5 lines

/* All CEA modes other than VIC 1 use limited quantization range. */

When I first had to put this logic in vc4, I was surprised by it and figured that it was an off-by-one bug in code that was trying to say "if it's any CEA mode then it should be limited range"

Seems like a good idea. I could even try to dig up a specific spec quote perhaps? And if I can't find anything succinct in the spec we can always go with your proposal.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+EXPORT_SYMBOL(drm_default_rgb_quant_range);
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [Intel-gfx] [PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Quoted 49 lines · Ville Syrjälä
Quoted 48 lines · Eric Anholt
Quoted 4 lines · [email protected] writes:

From: Ville Syrjälä <[email protected]>

Make the code selecting the RGB quantization range a little less magicy by wrapping it up in a small helper.

This series seems good. I won't have the ability to test it on vc4 within a reasonable time frame, so you can add an Acked-by from me if you'd like. Just one comment that you can take or leave:

Quoted 22 lines
---
 drivers/gpu/drm/drm_edid.c        | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 +++-
 drivers/gpu/drm/i915/intel_hdmi.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c    |  4 +++-
 include/drm/drm_edid.h            |  2 ++
 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +5 -0
index 4ff04aa84dd0..304c583b8000 100644
@@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
 }
 EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
 
+/**
+ * drm_default_rgb_quant_range - default RGB quantization range
+ * @mode: display mode
+ *
+ * Determine the default RGB quantization range for the mode,

drivers/gpu/drm/drm_edid.c bool drm_rgb_quant_range_selectable(struct edid *edid) · line 3785

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+ * 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)
+{
+	return drm_match_cea_mode(mode) > 1 ?
+		HDMI_QUANTIZATION_RANGE_LIMITED :
+		HDMI_QUANTIZATION_RANGE_FULL;

It might be nice to add a comment here like

/* All CEA modes other than VIC 1 use limited quantization range. */

Quoted 7 lines
Quoted 3 lines

When I first had to put this logic in vc4, I was surprised by it and figured that it was an off-by-one bug in code that was trying to say "if it's any CEA mode then it should be limited range"

Seems like a good idea. I could even try to dig up a specific spec quote perhaps? And if I can't find anything succinct in the spec we can always go with your proposal.

Meh. Didn't manage to dig up anything really nice from the spec, so I'll just go with your idea.

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/drm_edid.c +2 -0
+}
+EXPORT_SYMBOL(drm_default_rgb_quant_range);
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH 3/5 drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range()

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Pull the logic to populate the quantization range information in the AVI infoframe into a small helper. We'll be adding a bit more logic to it, and having it in a central place seems like a good idea since it's based on the CEA-861 spec.

---
 drivers/gpu/drm/drm_edid.c        | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++--------
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 14 +++++---------
 include/drm/drm_edid.h            |  4 ++++
 4 files changed, 40 insertions(+), 17 deletions(-)
drivers/gpu/drm/drm_edid.c +26 -0
index 304c583b8000..548c20250b95 100644
@@ -4291,6 +4291,32 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 }
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
 
+/**
+ * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
+ *                                        quantization range information
+ * @frame: HDMI AVI infoframe
+ * @rgb_quant_range: RGB quantization range (Q)
+ * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
+ */
+void
+drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   enum hdmi_quantization_range rgb_quant_range,
+				   bool rgb_quant_range_selectable)
+{
+	/*
+	 * CEA-861:
+	 * "A Source shall not send a non-zero Q value that does not correspond
+	 *  to the default RGB Quantization Range for the transmitted Picture
+	 *  unless the Sink indicates support for the Q bit in a Video
+	 *  Capabilities Data Block."
+	 */
+	if (rgb_quant_range_selectable)
+		frame->quantization_range = rgb_quant_range;
+	else
+		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
+
 static enum hdmi_3d_structure
 s3d_structure_from_display_mode(const struct drm_display_mode *mode)
 {
drivers/gpu/drm/i915/intel_hdmi.c +5 -8
index 19bd13f53729..351f837b09a0 100644
@@ -465,14 +465,11 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 		return;
 	}
 
-	if (intel_hdmi->rgb_quant_range_selectable) {
-		if (crtc_state->limited_color_range)
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_LIMITED;
-		else
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_FULL;
-	}
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+					   crtc_state->limited_color_range ?
+					   HDMI_QUANTIZATION_RANGE_LIMITED :
+					   HDMI_QUANTIZATION_RANGE_FULL,
+					   intel_hdmi->rgb_quant_range_selectable);
 
 	intel_write_infoframe(encoder, crtc_state, &frame);
 }
drivers/gpu/drm/vc4/vc4_hdmi.c +5 -9
index d79466a42690..a588156b5410 100644
@@ -356,15 +356,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 		return;
 	}
 
-	if (vc4_encoder->rgb_range_selectable) {
-		if (vc4_encoder->limited_rgb_range) {
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_LIMITED;
-		} else {
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_FULL;
-		}
-	}
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+					   vc4_encoder->limited_rgb_range ?
+					   HDMI_QUANTIZATION_RANGE_LIMITED :
+					   HDMI_QUANTIZATION_RANGE_FULL,
+					   vc4_encoder->rgb_range_selectable);
 
 	vc4_hdmi_write_infoframe(encoder, &frame);
 }
include/drm/drm_edid.h +4 -0
index 25cdf5f7a0d8..cfad4d89589f 100644
@@ -345,6 +345,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
+void
+drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   enum hdmi_quantization_range rgb_quant_range,
+				   bool rgb_quant_range_selectable);
 
 /**
  * drm_eld_mnl - Get ELD monitor name length in bytes.
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 3/5
#15 lore raw

Re: [PATCH 3/5] drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range()

Quoted 20 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Pull the logic to populate the quantization range information in the AVI infoframe into a small helper. We'll be adding a bit more logic to it, and having it in a central place seems like a good idea since it's based on the CEA-861 spec.

---
 drivers/gpu/drm/drm_edid.c        | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++--------
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 14 +++++---------
 include/drm/drm_edid.h            |  4 ++++
 4 files changed, 40 insertions(+), 17 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -0
index 304c583b8000..548c20250b95 100644

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 4296

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +3 -0
@@ -4291,6 +4291,32 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 }
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
 
+/**
+ * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
+ *                                        quantization range information

I'm a fan of having a verb in the function name for functions that do stuff. Would be nice to have "set" in there somewhere, although the name is growing a bit unwieldy. (Btw, same for drm_default_rgb_quant_range() in the previous patch, "get" would be nice.)

Up to you.

Quoted 90 lines
drivers/gpu/drm/drm_edid.c +23 -0
+ * @frame: HDMI AVI infoframe
+ * @rgb_quant_range: RGB quantization range (Q)
+ * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
+ */
+void
+drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   enum hdmi_quantization_range rgb_quant_range,
+				   bool rgb_quant_range_selectable)
+{
+	/*
+	 * CEA-861:
+	 * "A Source shall not send a non-zero Q value that does not correspond
+	 *  to the default RGB Quantization Range for the transmitted Picture
+	 *  unless the Sink indicates support for the Q bit in a Video
+	 *  Capabilities Data Block."
+	 */
+	if (rgb_quant_range_selectable)
+		frame->quantization_range = rgb_quant_range;
+	else
+		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
+
 static enum hdmi_3d_structure
 s3d_structure_from_display_mode(const struct drm_display_mode *mode)
 {
drivers/gpu/drm/i915/intel_hdmi.c +5 -8
index 19bd13f53729..351f837b09a0 100644
@@ -465,14 +465,11 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 		return;
 	}
 
-	if (intel_hdmi->rgb_quant_range_selectable) {
-		if (crtc_state->limited_color_range)
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_LIMITED;
-		else
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_FULL;
-	}
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+					   crtc_state->limited_color_range ?
+					   HDMI_QUANTIZATION_RANGE_LIMITED :
+					   HDMI_QUANTIZATION_RANGE_FULL,
+					   intel_hdmi->rgb_quant_range_selectable);
 
 	intel_write_infoframe(encoder, crtc_state, &frame);
 }
drivers/gpu/drm/vc4/vc4_hdmi.c +5 -9
index d79466a42690..a588156b5410 100644
@@ -356,15 +356,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 		return;
 	}
 
-	if (vc4_encoder->rgb_range_selectable) {
-		if (vc4_encoder->limited_rgb_range) {
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_LIMITED;
-		} else {
-			frame.avi.quantization_range =
-				HDMI_QUANTIZATION_RANGE_FULL;
-		}
-	}
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+					   vc4_encoder->limited_rgb_range ?
+					   HDMI_QUANTIZATION_RANGE_LIMITED :
+					   HDMI_QUANTIZATION_RANGE_FULL,
+					   vc4_encoder->rgb_range_selectable);
 
 	vc4_hdmi_write_infoframe(encoder, &frame);
 }
include/drm/drm_edid.h +4 -0
index 25cdf5f7a0d8..cfad4d89589f 100644
@@ -345,6 +345,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
+void
+drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   enum hdmi_quantization_range rgb_quant_range,
+				   bool rgb_quant_range_selectable);
 
 /**
  * drm_eld_mnl - Get ELD monitor name length in bytes.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 4/5 drm/edid: Set AVI infoframe Q even when QS=0

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

HDMI 2.0 recommends that we set the Q bits in the AVI infoframe even when the sink does not support quantization range selection (QS=0). According to CEA-861 we can do that as long as the Q we send matches the default quantization range for the mode.

Previosuly I think I had misread the spec as saying that you can't send a non-zero Q at all when QS=0. But that's not what the spec actually says.

---
 drivers/gpu/drm/drm_edid.c        | 8 +++++++-
 drivers/gpu/drm/i915/intel_hdmi.c | 6 ++++--
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 2 +-
 include/drm/drm_edid.h            | 1 +
 4 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +7 -1
index 548c20250b95..caa2435bac31 100644
@@ -4295,11 +4295,13 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
  * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
  *                                        quantization range information
  * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
  * @rgb_quant_range: RGB quantization range (Q)
  * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
  */
 void
 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   const struct drm_display_mode *mode,
 				   enum hdmi_quantization_range rgb_quant_range,
 				   bool rgb_quant_range_selectable)
 {
@@ -4309,8 +4311,12 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 	 *  to the default RGB Quantization Range for the transmitted Picture
 	 *  unless the Sink indicates support for the Q bit in a Video
 	 *  Capabilities Data Block."
+	 *
+	 * HDMI 2.0 recommends sending non-zero Q when it does match the
+	 * default RGB quantization range for the mode, even when QS=0.
 	 */
-	if (rgb_quant_range_selectable)
+	if (rgb_quant_range_selectable ||
+	    rgb_quant_range == drm_default_rgb_quant_range(mode))
 		frame->quantization_range = rgb_quant_range;
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
drivers/gpu/drm/i915/intel_hdmi.c +4 -2
index 351f837b09a0..af16b0fa6b69 100644
@@ -455,17 +455,19 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 					 const struct intel_crtc_state *crtc_state)
 {
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->base.adjusted_mode;
 	union hdmi_infoframe frame;
 	int ret;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       &crtc_state->base.adjusted_mode);
+						       adjusted_mode);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
 	}
 
-	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
 					   crtc_state->limited_color_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
 					   HDMI_QUANTIZATION_RANGE_FULL,
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
index a588156b5410..f38fdbac2878 100644
@@ -356,7 +356,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 		return;
 	}
 
-	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi, mode,
 					   vc4_encoder->limited_rgb_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
 					   HDMI_QUANTIZATION_RANGE_FULL,
include/drm/drm_edid.h +1 -0
index cfad4d89589f..43fb0ac5eb9c 100644
@@ -347,6 +347,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
 void
 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   const struct drm_display_mode *mode,
 				   enum hdmi_quantization_range rgb_quant_range,
 				   bool rgb_quant_range_selectable);
 
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 4/5
#17 lore raw

Re: [PATCH 4/5] drm/edid: Set AVI infoframe Q even when QS=0

Quoted 8 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

HDMI 2.0 recommends that we set the Q bits in the AVI infoframe even when the sink does not support quantization range selection (QS=0). According to CEA-861 we can do that as long as the Q we send matches the default quantization range for the mode.

Previosuly I think I had misread the spec as saying that you can't

^^^^^^^^^^

Quoted 2 lines

send a non-zero Q at all when QS=0. But that's not what the spec actually says.

Agreed.

Quoted 91 lines
---
 drivers/gpu/drm/drm_edid.c        | 8 +++++++-
 drivers/gpu/drm/i915/intel_hdmi.c | 6 ++++--
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 2 +-
 include/drm/drm_edid.h            | 1 +
 4 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +7 -1
index 548c20250b95..caa2435bac31 100644
@@ -4295,11 +4295,13 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
  * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
  *                                        quantization range information
  * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
  * @rgb_quant_range: RGB quantization range (Q)
  * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
  */
 void
 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   const struct drm_display_mode *mode,
 				   enum hdmi_quantization_range rgb_quant_range,
 				   bool rgb_quant_range_selectable)
 {
@@ -4309,8 +4311,12 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 	 *  to the default RGB Quantization Range for the transmitted Picture
 	 *  unless the Sink indicates support for the Q bit in a Video
 	 *  Capabilities Data Block."
+	 *
+	 * HDMI 2.0 recommends sending non-zero Q when it does match the
+	 * default RGB quantization range for the mode, even when QS=0.
 	 */
-	if (rgb_quant_range_selectable)
+	if (rgb_quant_range_selectable ||
+	    rgb_quant_range == drm_default_rgb_quant_range(mode))
 		frame->quantization_range = rgb_quant_range;
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
drivers/gpu/drm/i915/intel_hdmi.c +4 -2
index 351f837b09a0..af16b0fa6b69 100644
@@ -455,17 +455,19 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 					 const struct intel_crtc_state *crtc_state)
 {
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->base.adjusted_mode;
 	union hdmi_infoframe frame;
 	int ret;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       &crtc_state->base.adjusted_mode);
+						       adjusted_mode);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
 	}
 
-	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
 					   crtc_state->limited_color_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
 					   HDMI_QUANTIZATION_RANGE_FULL,
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
index a588156b5410..f38fdbac2878 100644
@@ -356,7 +356,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 		return;
 	}
 
-	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
+	drm_hdmi_avi_infoframe_quant_range(&frame.avi, mode,
 					   vc4_encoder->limited_rgb_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
 					   HDMI_QUANTIZATION_RANGE_FULL,
include/drm/drm_edid.h +1 -0
index cfad4d89589f..43fb0ac5eb9c 100644
@@ -347,6 +347,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
 void
 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+				   const struct drm_display_mode *mode,
 				   enum hdmi_quantization_range rgb_quant_range,
 				   bool rgb_quant_range_selectable);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

PATCH 5/5 drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

CEA-861-F tells us:
"When transmitting any RGB colorimetry, the Source should set the
YQ-field to match the RGB Quantization Range being transmitted (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB, set YQ=1) and the Sink shall ignore the YQ-field."

So let's go ahead and do that. Perhaps there are sinks that don't ignore the YQ as they should for RGB?

I wasn't able to find similar text in CEA-861-E, so it would seem to be a fairly "recent" addition.

---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index caa2435bac31..6ba9a1a6eae4 100644
@@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 		frame->quantization_range = rgb_quant_range;
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+
+	/*
+	 * CEA-861-F:
+	 * "When transmitting any RGB colorimetry, the Source should set the
+	 *  YQ-field to match the RGB Quantization Range being transmitted
+	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
+	 *  set YQ=1) and the Sink shall ignore the YQ-field."
+	 */
+	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
+	else
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_FULL;
 }
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
 
Signature · 6 lines
2.10.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#19 lore raw

Re: [PATCH 5/5] drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

Quoted 25 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

CEA-861-F tells us:
"When transmitting any RGB colorimetry, the Source should set the
YQ-field to match the RGB Quantization Range being transmitted (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB, set YQ=1) and the Sink shall ignore the YQ-field."

So let's go ahead and do that. Perhaps there are sinks that don't ignore the YQ as they should for RGB?

I wasn't able to find similar text in CEA-861-E, so it would seem to be a fairly "recent" addition.

---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index caa2435bac31..6ba9a1a6eae4 100644
@@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 		frame->quantization_range = rgb_quant_range;

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4330

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+
+	/*
+	 * CEA-861-F:
+	 * "When transmitting any RGB colorimetry, the Source should set the
+	 *  YQ-field to match the RGB Quantization Range being transmitted
+	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
+	 *  set YQ=1) and the Sink shall ignore the YQ-field."
+	 */

*rolls eyes* but that's what the spec says.

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4336

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
+	else
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_FULL;

Shouldn't this take into account QS=0 and rgb_quant_range != default?

BR,
Jani.

Quoted 2 lines
drivers/gpu/drm/drm_edid.c +0 -0
 }
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH 5/5] drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

Quoted 39 lines · Jani Nikula
Quoted 25 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

CEA-861-F tells us:
"When transmitting any RGB colorimetry, the Source should set the
YQ-field to match the RGB Quantization Range being transmitted (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB, set YQ=1) and the Sink shall ignore the YQ-field."

So let's go ahead and do that. Perhaps there are sinks that don't ignore the YQ as they should for RGB?

I wasn't able to find similar text in CEA-861-E, so it would seem to be a fairly "recent" addition.

---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index caa2435bac31..6ba9a1a6eae4 100644
@@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 		frame->quantization_range = rgb_quant_range;

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4330

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+
+	/*
+	 * CEA-861-F:
+	 * "When transmitting any RGB colorimetry, the Source should set the
+	 *  YQ-field to match the RGB Quantization Range being transmitted
+	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
+	 *  set YQ=1) and the Sink shall ignore the YQ-field."
+	 */

*rolls eyes* but that's what the spec says.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4336

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
+	else
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_FULL;

Shouldn't this take into account QS=0 and rgb_quant_range != default?

There is no YQ setting similar to the default Q=0. YQ=0 means "limited", YQ=1 means "full", others values are reserved. So we can't really not specify the YCC quantization range. So I can't really see any better option than telling the truth.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by
#21 lore raw

Re: [PATCH 5/5] drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

Quoted 49 lines · Ville Syrjälä
Quoted 39 lines · Jani Nikula
Quoted 25 lines · On Wed, 11 Jan 2017, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

CEA-861-F tells us:
"When transmitting any RGB colorimetry, the Source should set the
YQ-field to match the RGB Quantization Range being transmitted (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB, set YQ=1) and the Sink shall ignore the YQ-field."

So let's go ahead and do that. Perhaps there are sinks that don't ignore the YQ as they should for RGB?

I wasn't able to find similar text in CEA-861-E, so it would seem to be a fairly "recent" addition.

---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index caa2435bac31..6ba9a1a6eae4 100644
@@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 		frame->quantization_range = rgb_quant_range;

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4330

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+
+	/*
+	 * CEA-861-F:
+	 * "When transmitting any RGB colorimetry, the Source should set the
+	 *  YQ-field to match the RGB Quantization Range being transmitted
+	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
+	 *  set YQ=1) and the Sink shall ignore the YQ-field."
+	 */

*rolls eyes* but that's what the spec says.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, · line 4336

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
+	else
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_FULL;

Shouldn't this take into account QS=0 and rgb_quant_range != default?

Quoted 4 lines

There is no YQ setting similar to the default Q=0. YQ=0 means "limited", YQ=1 means "full", others values are reserved. So we can't really not specify the YCC quantization range. So I can't really see any better option than telling the truth.

Hmm, I was confused about the caller choosing the range based on the mode already.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

✓ Fi.CI.BAT: success for drm/edid: Improve RGB limited range handling a bit

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: drm/edid: Improve RGB limited range handling a bit
URL : https://patchwork.freedesktop.org/series/17825/
State : success

== Summary ==

Series 17825v1 drm/edid: Improve RGB limited range handling a bit
https://patchwork.freedesktop.org/api/1.0/series/17825/revisions/1/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-a:
                incomplete -> SKIP       (fi-bsw-n3050)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                incomplete -> PASS       (fi-byt-n2820)
fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:82   pass:69   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:83   pass:71   dwarn:0   dfail:0   fail:0   skip:11 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

f0350ffa1b2bc16dc49fdc2fce10776d604a1c5f drm-tip: 2017y-01m-11d-12h-34m-12s UTC integration manifest af78a86 drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F
6e2f2ab drm/edid: Set AVI infoframe Q even when QS=0
ac00d36 drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range()
d7e4b07 drm/edid: Introduce drm_default_rgb_quant_range()
142daf0 drm/edid: Have drm_edid.h include hdmi.h

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3479/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

✓ Fi.CI.BAT: success for drm/edid: Improve RGB limited range handling a bit (rev2)

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: drm/edid: Improve RGB limited range handling a bit (rev2)
URL : https://patchwork.freedesktop.org/series/17825/
State : success

== Summary ==

Series 17825v2 drm/edid: Improve RGB limited range handling a bit
https://patchwork.freedesktop.org/api/1.0/series/17825/revisions/2/mbox/

fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:82   pass:69   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

b69fc4c941bef6d10750ce3f07daedfffc7017d1 drm-tip: 2017y-01m-11d-17h-30m-02s UTC integration manifest 20e8661 drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F
3d4bb98 drm/edid: Set AVI infoframe Q even when QS=0
0784091 drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range()
36b475a drm/edid: Introduce drm_default_rgb_quant_range()
e46f7c5 drm/edid: Have drm_edid.h include hdmi.h

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3484/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw
In reply to [email protected]
Quoted 16 lines · On Wed, Jan 11, 2017 at 02:57:20PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

While reading the HDMI 2.0 spec I noticed some new things related to the RGB quantization range stuff, and after cross checking with CEA-861-F I spotted a some other things as well. So I figured I should pimp up the code a bit.

And since we now have two drivers that deal with this stuff, I decided to move a bunch of the code to the core to avoid duplicating the code and having different bugs/features for each driver. I still left the state computation part in the drivers, but eventually we might want to move that code into some helper as well.

Entire series available here:
git://github.com/vsyrjala/linux.git hdmi_quant_range_helpers

Quoted 6 lines

Ville Syrjälä (5):
drm/edid: Have drm_edid.h include hdmi.h
drm/edid: Introduce drm_default_rgb_quant_range() drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range() drm/edid: Set AVI infoframe Q even when QS=0
drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

Series pushed to drm-misc-next. Thanks for the reviews/acks.

Quoted 10 lines
 drivers/gpu/drm/drm_edid.c        | 64 +++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  4 ++-
 drivers/gpu/drm/i915/intel_hdmi.c | 20 ++++++------
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 18 +++++------
 include/drm/drm_edid.h            | 10 ++++--
 5 files changed, 93 insertions(+), 23 deletions(-)
Signature · 1 line
2.10.2
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx