Skip to contentSkip to conversation

HDMI YCBCR output handling in DRM layer

PATCH Superseded Shashank Sharma 7 participants 34 messages Apr 7, 2017 – May 10, 2017

Subsystems (16)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover HDMI YCBCR output handling in DRM layer

This patch series adds DRM layer support for YCBCR HDMI output handling. The target HDMI YCBCR outputs are:
- YCBCR444
- YCBCR422
- YCBCR420

As YCBCR420 output is added in HDMI 2.0, this patch series also contain few patches to handle new EDID extention blocks, added for YCBCR420 modes (CEA-861-F)

First two patches, complete the CEA modedb in drm driver, by adding new 4k modes. Current CEA modedb contains 64 modes only (VIC1-64), whereas YCBCR420 output can support 4k modes, from VIC range 93-107. First patch makes sure that it doesn't break existing HDMI 1.4 monitors, adding new VICs.

Next 3 patches, parse and accomodate YCBCR420 suppor information from the sink, and stores into display info strucure. This contains parsing YCBCR420 supported modes, and deep color information.

Next 2 patch create a property (hdmi_output) using which, as userspace can set its preferred HDMI output from RGB, YCBCR444/422/420 etc. Default value of the property is set to RGB(0) so that it doesnt affect existing implementations. Other patch takes care of setting AVI IF colorspace as per the selected output.

Last 3 patches contain implementation of YCBCR output in I915 HDMI subsystem.

Jose Abreu (1):
drm: parse ycbcr 420 vdb block

Shashank Sharma (10):
drm: Add HDMI 2.0 VIC support for AVI info-frames drm/edid: Complete CEA modedb(VIC 1-107)
drm: parse ycbcr420 vcb block
drm: parse ycbcr 420 deep color information
drm: create hdmi output property
drm: set output colorspace in AVI infoframe drm/i915: handle ycbcr outputs
drm/i915: handle csc for ycbcr HDMI output drm/i915: prepare ycbcr420 modeset drm/i915: set colorspace for ycbcr outputs

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c    |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c    |   2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c     |   2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c |   3 +-
 drivers/gpu/drm/bridge/sii902x.c          |   2 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |   2 +-
 drivers/gpu/drm/drm_atomic.c              |   2 +
 drivers/gpu/drm/drm_atomic_helper.c       |   4 +
 drivers/gpu/drm/drm_connector.c           |  31 +++
 drivers/gpu/drm/drm_edid.c                | 416 +++++++++++++++++++++++++++++-
 drivers/gpu/drm/drm_modes.c               |  10 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c      |   2 +-
 drivers/gpu/drm/i2c/tda998x_drv.c         |   2 +-
 drivers/gpu/drm/i915/i915_reg.h           |   3 +
 drivers/gpu/drm/i915/intel_atomic.c       |   6 +
 drivers/gpu/drm/i915/intel_color.c        |  49 +++-
 drivers/gpu/drm/i915/intel_display.c      |  67 +++++
 drivers/gpu/drm/i915/intel_drv.h          |  13 +-
 drivers/gpu/drm/i915/intel_hdmi.c         | 185 ++++++++++++-
 drivers/gpu/drm/i915/intel_panel.c        |   3 +-
 drivers/gpu/drm/i915/intel_sdvo.c         |   3 +-
 drivers/gpu/drm/mediatek/mtk_hdmi.c       |   2 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c    |   3 +-
 drivers/gpu/drm/radeon/radeon_audio.c     |   2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c      |   2 +-
 drivers/gpu/drm/sti/sti_hdmi.c            |   2 +-
 drivers/gpu/drm/tegra/hdmi.c              |   2 +-
 drivers/gpu/drm/tegra/sor.c               |   2 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c            |   2 +-
 drivers/gpu/drm/zte/zx_hdmi.c             |   2 +-
 include/drm/drm_connector.h               |  17 ++
 include/drm/drm_edid.h                    |  13 +-
 include/drm/drm_mode_config.h             |   5 +
 include/uapi/drm/drm_mode.h               |   6 +
 34 files changed, 836 insertions(+), 33 deletions(-)
Signature · 6 lines
2.7.4

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

PATCH 1/11 drm: Add HDMI 2.0 VIC support for AVI info-frames

HDMI 1.4b support the CEA video modes as per range of CEA-861-D (VIC 1-64). For any other mode, the VIC filed in AVI infoframes should be 0. HDMI 2.0 sinks, support video modes range as per CEA-861-F spec, which is extended to (VIC 1-107).

This patch adds a bool input variable, which indicates if the connected sink is a HDMI 2.0 sink or not. This will make sure that we don't pass a HDMI 2.0 VIC to a HDMI 1.4 sink.

This patch touches all drm drivers, who are callers of this function drm_hdmi_avi_infoframe_from_display_mode but to make sure there is no change in current behavior, is_hdmi2 is kept as false.

In case of I915 driver, this patch checks the connector->display_info to check if the connected display is HDMI 2.0.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Daniel Vetter <[email protected]>

PS: This patch touches a few lines in few files, which were already above 80 char, so checkpatch gives 80 char warning again.
- gpu/drm/omapdrm/omap_encoder.c
- gpu/drm/i915/intel_sdvo.c

---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c     |  2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c |  3 ++-
 drivers/gpu/drm/bridge/sii902x.c          |  2 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |  2 +-
 drivers/gpu/drm/drm_edid.c                | 12 +++++++++++-
 drivers/gpu/drm/exynos/exynos_hdmi.c      |  2 +-
 drivers/gpu/drm/i2c/tda998x_drv.c         |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c         |  5 ++++-
 drivers/gpu/drm/i915/intel_sdvo.c         |  3 ++-
 drivers/gpu/drm/mediatek/mtk_hdmi.c       |  2 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c    |  3 ++-
 drivers/gpu/drm/radeon/radeon_audio.c     |  2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c      |  2 +-
 drivers/gpu/drm/sti/sti_hdmi.c            |  2 +-
 drivers/gpu/drm/tegra/hdmi.c              |  2 +-
 drivers/gpu/drm/tegra/sor.c               |  2 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c            |  2 +-
 drivers/gpu/drm/zte/zx_hdmi.c             |  2 +-
 include/drm/drm_edid.h                    |  3 ++-
 21 files changed, 38 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +1 -1
index daf003d..5dc3e95 100644
@@ -1877,7 +1877,7 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v10_0_audio_write_sad_regs(encoder);
 	dce_v10_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +1 -1
index 3a72967..b70f077 100644
@@ -1861,7 +1861,7 @@ static void dce_v11_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v11_0_audio_write_sad_regs(encoder);
 	dce_v11_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -1
index 6943f26..bcf9c75 100644
@@ -1760,7 +1760,7 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v8_0_audio_write_sad_regs(encoder);
 	dce_v8_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/bridge/analogix-anx78xx.c +2 -1
index a2a8236..f9b77b8 100644
@@ -1097,7 +1097,8 @@ static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
 
 	mutex_lock(&anx78xx->lock);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode,
+						       false);
 	if (err) {
 		DRM_ERROR("Failed to setup AVI infoframe: %d\n", err);
 		goto unlock;
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 9126d03..dcf15d7 100644
@@ -269,7 +269,7 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
 	if (ret)
 		return;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj, false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
index 3bc856c..54ada40 100644
@@ -1286,7 +1286,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
 	u8 val;
 
 	/* Initialise info frame from DRM mode */
-	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 
 	if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
 		frame.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/drm_edid.c +11 -1
index fad3d44..f982a42 100644
@@ -4326,12 +4326,14 @@ EXPORT_SYMBOL(drm_set_preferred_mode);
  *                                              data from a DRM display mode
  * @frame: HDMI AVI infoframe
  * @mode: DRM display mode
+ * @is_hdmi2: Sink is HDMI 2.0 compliant
  *
  * Return: 0 on success or a negative error code on failure.
  */
 int
 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode)
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2)
 {
 	int err;
 
@@ -4347,6 +4349,14 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 
 	frame->video_code = drm_match_cea_mode(mode);
 
+	/*
+	 * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
+	 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
+	 * have to make sure we dont break HDMI 1.4 sinks.
+	 */
+	if (!is_hdmi2 && frame->video_code > 64)
+		frame->video_code = 0;
+
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
 
 	/*
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
index 5243840..5cb44d4 100644
@@ -781,7 +781,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata)
 	}
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
-			&hdata->current_mode);
+			&hdata->current_mode, false);
 	if (!ret)
 		ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf));
 	if (ret > 0) {
drivers/gpu/drm/i2c/tda998x_drv.c +1 -1
index 86f47e1..d1e7ac5 100644
@@ -712,7 +712,7 @@ tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
 {
 	union hdmi_infoframe frame;
 
-	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
 
 	tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, &frame);
drivers/gpu/drm/i915/intel_hdmi.c +4 -1
index 6efc3cb..76d9e0d 100644
@@ -459,11 +459,14 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	bool is_hdmi2 = connector->display_info.hdmi.scdc.supported;
 	union hdmi_infoframe frame;
 	int ret;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       adjusted_mode);
+						       adjusted_mode,
+						       is_hdmi2);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/i915/intel_sdvo.c +2 -1
index 816a6f5..694f626 100644
@@ -1011,7 +1011,8 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
 	ssize_t len;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       &pipe_config->base.adjusted_mode);
+						       &pipe_config->base.adjusted_mode,
+						       false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return false;
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
index 41a1c03..a1770dc 100644
@@ -975,7 +975,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 	u8 buffer[17];
 	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(hdmi->dev,
 			"Failed to get AVI infoframe from mode: %zd\n", err);
drivers/gpu/drm/omapdrm/omap_encoder.c +2 -1
index 86c977b..624f5b5 100644
@@ -85,7 +85,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	if (hdmi_mode && dssdev->driver->set_hdmi_infoframe) {
 		struct hdmi_avi_infoframe avi;
 
-		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode);
+		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode,
+							     false);
 		if (r == 0)
 			dssdev->driver->set_hdmi_infoframe(dssdev, &avi);
 	}
drivers/gpu/drm/radeon/radeon_audio.c +1 -1
index aaacac1..770e31f 100644
@@ -516,7 +516,7 @@ static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
 	if (!connector)
 		return -EINVAL;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %d\n", err);
 		return err;
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
index 7d9b75e..7149968 100644
@@ -294,7 +294,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi,
 	union hdmi_infoframe frame;
 	int rc;
 
-	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 
 	if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
 		frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
index ce2dcba..2128b8c 100644
@@ -434,7 +434,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
 
 	DRM_DEBUG_DRIVER("\n");
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode, false);
 	if (ret < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %d\n", ret);
 		return ret;
drivers/gpu/drm/tegra/hdmi.c +1 -1
index cda0491..718d8db 100644
@@ -734,7 +734,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
 	u8 buffer[17];
 	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(hdmi->dev, "failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/tegra/sor.c +1 -1
index a8f5289..fb2709c 100644
@@ -1904,7 +1904,7 @@ tegra_sor_hdmi_setup_avi_infoframe(struct tegra_sor *sor,
 	value &= ~INFOFRAME_CTRL_ENABLE;
 	tegra_sor_writel(sor, value, SOR_HDMI_AVI_INFOFRAME_CTRL);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(sor->dev, "failed to setup AVI infoframe: %d\n", err);
 		return err;
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
index e9cbe26..5d81301 100644
@@ -394,7 +394,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 	union hdmi_infoframe frame;
 	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/zte/zx_hdmi.c +1 -1
index 0df7366..7e834e3 100644
@@ -124,7 +124,7 @@ static int zx_hdmi_config_video_avi(struct zx_hdmi *hdmi,
 	union hdmi_infoframe frame;
 	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	if (ret) {
 		DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n",
 			      ret);
include/drm/drm_edid.h +2 -1
index 7b9f48b..c07eb81 100644
@@ -343,7 +343,8 @@ drm_load_edid_firmware(struct drm_connector *connector)
 
 int
 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode);
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2);
 int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/11
#2 lore raw

Re: [PATCH 01/11] drm: Add HDMI 2.0 VIC support for AVI info-frames

Quoted 22 lines · Shashank Sharma

HDMI 1.4b support the CEA video modes as per range of CEA-861-D (VIC 1-64). For any other mode, the VIC filed in AVI infoframes should be 0. HDMI 2.0 sinks, support video modes range as per CEA-861-F spec, which is extended to (VIC 1-107).

This patch adds a bool input variable, which indicates if the connected sink is a HDMI 2.0 sink or not. This will make sure that we don't pass a HDMI 2.0 VIC to a HDMI 1.4 sink.

This patch touches all drm drivers, who are callers of this function drm_hdmi_avi_infoframe_from_display_mode but to make sure there is no change in current behavior, is_hdmi2 is kept as false.

In case of I915 driver, this patch checks the connector->display_info to check if the connected display is HDMI 2.0.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 6 lines

PS: This patch touches a few lines in few files, which were already above 80 char, so checkpatch gives 80 char warning again.
- gpu/drm/omapdrm/omap_encoder.c
- gpu/drm/i915/intel_sdvo.c

Finally I have chances to look at the specs and I am not sure if this solution fully reflects the specs and is scalable. According to specs VIC set to 0 in AVIF means "Video Format not documented in CTA-861", ie it is described by vendor specific data block and vendor specific infoframe, maybe something else(???). I suppose ideally during EDID read there should be recorded info for every mode if it was defined by vendor extension, or not. This info could be later used by drivers to configure AVIF and VSIF accordingly.

Anyway as a short-term initial solution it could work. So:

--
Regards
Andrzej

Quoted 321 lines
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c     |  2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c |  3 ++-
 drivers/gpu/drm/bridge/sii902x.c          |  2 +-
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |  2 +-
 drivers/gpu/drm/drm_edid.c                | 12 +++++++++++-
 drivers/gpu/drm/exynos/exynos_hdmi.c      |  2 +-
 drivers/gpu/drm/i2c/tda998x_drv.c         |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c         |  5 ++++-
 drivers/gpu/drm/i915/intel_sdvo.c         |  3 ++-
 drivers/gpu/drm/mediatek/mtk_hdmi.c       |  2 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c    |  3 ++-
 drivers/gpu/drm/radeon/radeon_audio.c     |  2 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c      |  2 +-
 drivers/gpu/drm/sti/sti_hdmi.c            |  2 +-
 drivers/gpu/drm/tegra/hdmi.c              |  2 +-
 drivers/gpu/drm/tegra/sor.c               |  2 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c            |  2 +-
 drivers/gpu/drm/zte/zx_hdmi.c             |  2 +-
 include/drm/drm_edid.h                    |  3 ++-
 21 files changed, 38 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +1 -1
index daf003d..5dc3e95 100644
@@ -1877,7 +1877,7 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v10_0_audio_write_sad_regs(encoder);
 	dce_v10_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +1 -1
index 3a72967..b70f077 100644
@@ -1861,7 +1861,7 @@ static void dce_v11_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v11_0_audio_write_sad_regs(encoder);
 	dce_v11_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -1
index 6943f26..bcf9c75 100644
@@ -1760,7 +1760,7 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
 	dce_v8_0_audio_write_sad_regs(encoder);
 	dce_v8_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/bridge/analogix-anx78xx.c +2 -1
index a2a8236..f9b77b8 100644
@@ -1097,7 +1097,8 @@ static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
 
 	mutex_lock(&anx78xx->lock);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode,
+						       false);
 	if (err) {
 		DRM_ERROR("Failed to setup AVI infoframe: %d\n", err);
 		goto unlock;
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 9126d03..dcf15d7 100644
@@ -269,7 +269,7 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
 	if (ret)
 		return;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj, false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
index 3bc856c..54ada40 100644
@@ -1286,7 +1286,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
 	u8 val;
 
 	/* Initialise info frame from DRM mode */
-	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 
 	if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
 		frame.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/drm_edid.c +11 -1
index fad3d44..f982a42 100644
@@ -4326,12 +4326,14 @@ EXPORT_SYMBOL(drm_set_preferred_mode);
  *                                              data from a DRM display mode
  * @frame: HDMI AVI infoframe
  * @mode: DRM display mode
+ * @is_hdmi2: Sink is HDMI 2.0 compliant
  *
  * Return: 0 on success or a negative error code on failure.
  */
 int
 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode)
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2)
 {
 	int err;
 
@@ -4347,6 +4349,14 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 
 	frame->video_code = drm_match_cea_mode(mode);
 
+	/*
+	 * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
+	 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
+	 * have to make sure we dont break HDMI 1.4 sinks.
+	 */
+	if (!is_hdmi2 && frame->video_code > 64)
+		frame->video_code = 0;
+
 	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
 
 	/*
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
index 5243840..5cb44d4 100644
@@ -781,7 +781,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata)
 	}
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
-			&hdata->current_mode);
+			&hdata->current_mode, false);
 	if (!ret)
 		ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf));
 	if (ret > 0) {
drivers/gpu/drm/i2c/tda998x_drv.c +1 -1
index 86f47e1..d1e7ac5 100644
@@ -712,7 +712,7 @@ tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
 {
 	union hdmi_infoframe frame;
 
-	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
 
 	tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, &frame);
drivers/gpu/drm/i915/intel_hdmi.c +4 -1
index 6efc3cb..76d9e0d 100644
@@ -459,11 +459,14 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->base.adjusted_mode;
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	bool is_hdmi2 = connector->display_info.hdmi.scdc.supported;
 	union hdmi_infoframe frame;
 	int ret;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       adjusted_mode);
+						       adjusted_mode,
+						       is_hdmi2);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/i915/intel_sdvo.c +2 -1
index 816a6f5..694f626 100644
@@ -1011,7 +1011,8 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
 	ssize_t len;
 
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       &pipe_config->base.adjusted_mode);
+						       &pipe_config->base.adjusted_mode,
+						       false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return false;
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
index 41a1c03..a1770dc 100644
@@ -975,7 +975,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 	u8 buffer[17];
 	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(hdmi->dev,
 			"Failed to get AVI infoframe from mode: %zd\n", err);
drivers/gpu/drm/omapdrm/omap_encoder.c +2 -1
index 86c977b..624f5b5 100644
@@ -85,7 +85,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	if (hdmi_mode && dssdev->driver->set_hdmi_infoframe) {
 		struct hdmi_avi_infoframe avi;
 
-		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode);
+		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode,
+							     false);
 		if (r == 0)
 			dssdev->driver->set_hdmi_infoframe(dssdev, &avi);
 	}
drivers/gpu/drm/radeon/radeon_audio.c +1 -1
index aaacac1..770e31f 100644
@@ -516,7 +516,7 @@ static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
 	if (!connector)
 		return -EINVAL;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %d\n", err);
 		return err;
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
index 7d9b75e..7149968 100644
@@ -294,7 +294,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi,
 	union hdmi_infoframe frame;
 	int rc;
 
-	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 
 	if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
 		frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
index ce2dcba..2128b8c 100644
@@ -434,7 +434,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
 
 	DRM_DEBUG_DRIVER("\n");
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode, false);
 	if (ret < 0) {
 		DRM_ERROR("failed to setup AVI infoframe: %d\n", ret);
 		return ret;
drivers/gpu/drm/tegra/hdmi.c +1 -1
index cda0491..718d8db 100644
@@ -734,7 +734,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
 	u8 buffer[17];
 	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(hdmi->dev, "failed to setup AVI infoframe: %zd\n", err);
 		return;
drivers/gpu/drm/tegra/sor.c +1 -1
index a8f5289..fb2709c 100644
@@ -1904,7 +1904,7 @@ tegra_sor_hdmi_setup_avi_infoframe(struct tegra_sor *sor,
 	value &= ~INFOFRAME_CTRL_ENABLE;
 	tegra_sor_writel(sor, value, SOR_HDMI_AVI_INFOFRAME_CTRL);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 	if (err < 0) {
 		dev_err(sor->dev, "failed to setup AVI infoframe: %d\n", err);
 		return err;
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
index e9cbe26..5d81301 100644
@@ -394,7 +394,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 	union hdmi_infoframe frame;
 	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	if (ret < 0) {
 		DRM_ERROR("couldn't fill AVI infoframe\n");
 		return;
drivers/gpu/drm/zte/zx_hdmi.c +1 -1
index 0df7366..7e834e3 100644
@@ -124,7 +124,7 @@ static int zx_hdmi_config_video_avi(struct zx_hdmi *hdmi,
 	union hdmi_infoframe frame;
 	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 	if (ret) {
 		DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n",
 			      ret);
include/drm/drm_edid.h +0 -0
index 7b9f48b..c07eb81 100644

include/drm/drm_edid.h drm_load_edid_firmware(struct drm_connector *connector) · line 350

Quoted 9 lines
include/drm/drm_edid.h +2 -1
@@ -343,7 +343,8 @@ drm_load_edid_firmware(struct drm_connector *connector)
 
 int
 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode);
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2);
 int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);

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

#3 lore raw

Re: [PATCH 01/11] drm: Add HDMI 2.0 VIC support for AVI info-frames

Regards

Shashank

Quoted 28 lines · Andrzej Hajda
Quoted 27 lines · Shashank Sharma

HDMI 1.4b support the CEA video modes as per range of CEA-861-D (VIC 1-64). For any other mode, the VIC filed in AVI infoframes should be 0. HDMI 2.0 sinks, support video modes range as per CEA-861-F spec, which is extended to (VIC 1-107).

This patch adds a bool input variable, which indicates if the connected sink is a HDMI 2.0 sink or not. This will make sure that we don't pass a HDMI 2.0 VIC to a HDMI 1.4 sink.

This patch touches all drm drivers, who are callers of this function drm_hdmi_avi_infoframe_from_display_mode but to make sure there is no change in current behavior, is_hdmi2 is kept as false.

In case of I915 driver, this patch checks the connector->display_info to check if the connected display is HDMI 2.0.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Daniel Vetter <[email protected]>

PS: This patch touches a few lines in few files, which were already above 80 char, so checkpatch gives 80 char warning again.
- gpu/drm/omapdrm/omap_encoder.c
- gpu/drm/i915/intel_sdvo.c

Quoted 6 lines
Quoted 1 line

Finally I have chances to look at the specs and I am not sure if this solution fully reflects the specs and is scalable. According to specs VIC set to 0 in AVIF means "Video Format not documented in CTA-861", ie it is described by vendor specific data block and vendor specific infoframe, maybe something else(???).

It says "Video Format not documented in CEA-861 (means this version)"

Quoted 4 lines

I suppose ideally during EDID read
there should be recorded info for every mode if it was defined by vendor extension, or not. This info could be later used by drivers to configure AVIF and VSIF accordingly.

I don't think this has to do anything with it, we are simply checking if the monitor is HDMI 2.0 capable, coz if it is, it would be complaint to CEA-861-F and it would understand the VIC>64. If not && VIC>64, we will send VIC as 0, coz this VIC is defined in CEA-861-F spec. So I don't see the confusion.

You are welcome to suggest, how can we make it more scalable, or improve on it. We can always send revised patch set :-)

- Shashank

Quoted 331 lines

Anyway as a short-term initial solution it could work. So:

--
Regards
Andrzej

Quoted 322 lines
---
  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c    |  2 +-
  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c    |  2 +-
  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c     |  2 +-
  drivers/gpu/drm/bridge/analogix-anx78xx.c |  3 ++-
  drivers/gpu/drm/bridge/sii902x.c          |  2 +-
  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c |  2 +-
  drivers/gpu/drm/drm_edid.c                | 12 +++++++++++-
  drivers/gpu/drm/exynos/exynos_hdmi.c      |  2 +-
  drivers/gpu/drm/i2c/tda998x_drv.c         |  2 +-
  drivers/gpu/drm/i915/intel_hdmi.c         |  5 ++++-
  drivers/gpu/drm/i915/intel_sdvo.c         |  3 ++-
  drivers/gpu/drm/mediatek/mtk_hdmi.c       |  2 +-
  drivers/gpu/drm/omapdrm/omap_encoder.c    |  3 ++-
  drivers/gpu/drm/radeon/radeon_audio.c     |  2 +-
  drivers/gpu/drm/rockchip/inno_hdmi.c      |  2 +-
  drivers/gpu/drm/sti/sti_hdmi.c            |  2 +-
  drivers/gpu/drm/tegra/hdmi.c              |  2 +-
  drivers/gpu/drm/tegra/sor.c               |  2 +-
  drivers/gpu/drm/vc4/vc4_hdmi.c            |  2 +-
  drivers/gpu/drm/zte/zx_hdmi.c             |  2 +-
  include/drm/drm_edid.h                    |  3 ++-
  21 files changed, 38 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +1 -1
index daf003d..5dc3e95 100644
@@ -1877,7 +1877,7 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
  	dce_v10_0_audio_write_sad_regs(encoder);
  	dce_v10_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
  		return;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +1 -1
index 3a72967..b70f077 100644
@@ -1861,7 +1861,7 @@ static void dce_v11_0_afmt_setmode(struct drm_encoder *encoder,
  	dce_v11_0_audio_write_sad_regs(encoder);
  	dce_v11_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
  		return;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -1
index 6943f26..bcf9c75 100644
@@ -1760,7 +1760,7 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
  	dce_v8_0_audio_write_sad_regs(encoder);
  	dce_v8_0_audio_write_latency_fields(encoder, mode);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		DRM_ERROR("failed to setup AVI infoframe: %zd\n", err);
  		return;
drivers/gpu/drm/bridge/analogix-anx78xx.c +2 -1
index a2a8236..f9b77b8 100644
@@ -1097,7 +1097,8 @@ static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
 
  	mutex_lock(&anx78xx->lock);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, adjusted_mode,
+						       false);
  	if (err) {
  		DRM_ERROR("Failed to setup AVI infoframe: %d\n", err);
  		goto unlock;
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 9126d03..dcf15d7 100644
@@ -269,7 +269,7 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
  	if (ret)
  		return;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, adj, false);
  	if (ret < 0) {
  		DRM_ERROR("couldn't fill AVI infoframe\n");
  		return;
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
index 3bc856c..54ada40 100644
@@ -1286,7 +1286,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
  	u8 val;
 
  	/* Initialise info frame from DRM mode */
-	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
 
  	if (hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format))
  		frame.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/drm_edid.c +11 -1
index fad3d44..f982a42 100644
@@ -4326,12 +4326,14 @@ EXPORT_SYMBOL(drm_set_preferred_mode);
   *                                              data from a DRM display mode
   * @frame: HDMI AVI infoframe
   * @mode: DRM display mode
+ * @is_hdmi2: Sink is HDMI 2.0 compliant
   *
   * Return: 0 on success or a negative error code on failure.
   */
  int
  drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode)
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2)
  {
  	int err;
 
@@ -4347,6 +4349,14 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 
  	frame->video_code = drm_match_cea_mode(mode);
 
+	/*
+	 * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
+	 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
+	 * have to make sure we dont break HDMI 1.4 sinks.
+	 */
+	if (!is_hdmi2 && frame->video_code > 64)
+		frame->video_code = 0;
+
  	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
 
  	/*
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
index 5243840..5cb44d4 100644
@@ -781,7 +781,7 @@ static void hdmi_reg_infoframes(struct hdmi_context *hdata)
  	}
 
  	ret = drm_hdmi_avi_infoframe_from_display_mode(&frm.avi,
-			&hdata->current_mode);
+			&hdata->current_mode, false);
  	if (!ret)
  		ret = hdmi_avi_infoframe_pack(&frm.avi, buf, sizeof(buf));
  	if (ret > 0) {
drivers/gpu/drm/i2c/tda998x_drv.c +1 -1
index 86f47e1..d1e7ac5 100644
@@ -712,7 +712,7 @@ tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
  {
  	union hdmi_infoframe frame;
 
-	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
  	frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
 
  	tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, &frame);
drivers/gpu/drm/i915/intel_hdmi.c +4 -1
index 6efc3cb..76d9e0d 100644
@@ -459,11 +459,14 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
  	const struct drm_display_mode *adjusted_mode =
  		&crtc_state->base.adjusted_mode;
+	struct drm_connector *connector = &intel_hdmi->attached_connector->base;
+	bool is_hdmi2 = connector->display_info.hdmi.scdc.supported;
  	union hdmi_infoframe frame;
  	int ret;
 
  	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       adjusted_mode);
+						       adjusted_mode,
+						       is_hdmi2);
  	if (ret < 0) {
  		DRM_ERROR("couldn't fill AVI infoframe\n");
  		return;
drivers/gpu/drm/i915/intel_sdvo.c +2 -1
index 816a6f5..694f626 100644
@@ -1011,7 +1011,8 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
  	ssize_t len;
 
  	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
-						       &pipe_config->base.adjusted_mode);
+						       &pipe_config->base.adjusted_mode,
+						       false);
  	if (ret < 0) {
  		DRM_ERROR("couldn't fill AVI infoframe\n");
  		return false;
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
index 41a1c03..a1770dc 100644
@@ -975,7 +975,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
  	u8 buffer[17];
  	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		dev_err(hdmi->dev,
  			"Failed to get AVI infoframe from mode: %zd\n", err);
drivers/gpu/drm/omapdrm/omap_encoder.c +2 -1
index 86c977b..624f5b5 100644
@@ -85,7 +85,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
  	if (hdmi_mode && dssdev->driver->set_hdmi_infoframe) {
  		struct hdmi_avi_infoframe avi;
 
-		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode);
+		r = drm_hdmi_avi_infoframe_from_display_mode(&avi, adjusted_mode,
+							     false);
  		if (r == 0)
  			dssdev->driver->set_hdmi_infoframe(dssdev, &avi);
  	}
drivers/gpu/drm/radeon/radeon_audio.c +1 -1
index aaacac1..770e31f 100644
@@ -516,7 +516,7 @@ static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
  	if (!connector)
  		return -EINVAL;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		DRM_ERROR("failed to setup AVI infoframe: %d\n", err);
  		return err;
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
index 7d9b75e..7149968 100644
@@ -294,7 +294,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi,
  	union hdmi_infoframe frame;
  	int rc;
 
-	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
 
  	if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
  		frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
index ce2dcba..2128b8c 100644
@@ -434,7 +434,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
 
  	DRM_DEBUG_DRIVER("\n");
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe, mode, false);
  	if (ret < 0) {
  		DRM_ERROR("failed to setup AVI infoframe: %d\n", ret);
  		return ret;
drivers/gpu/drm/tegra/hdmi.c +1 -1
index cda0491..718d8db 100644
@@ -734,7 +734,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
  	u8 buffer[17];
  	ssize_t err;
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		dev_err(hdmi->dev, "failed to setup AVI infoframe: %zd\n", err);
  		return;
drivers/gpu/drm/tegra/sor.c +1 -1
index a8f5289..fb2709c 100644
@@ -1904,7 +1904,7 @@ tegra_sor_hdmi_setup_avi_infoframe(struct tegra_sor *sor,
  	value &= ~INFOFRAME_CTRL_ENABLE;
  	tegra_sor_writel(sor, value, SOR_HDMI_AVI_INFOFRAME_CTRL);
 
-	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
+	err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
  	if (err < 0) {
  		dev_err(sor->dev, "failed to setup AVI infoframe: %d\n", err);
  		return err;
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
index e9cbe26..5d81301 100644
@@ -394,7 +394,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
  	union hdmi_infoframe frame;
  	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
  	if (ret < 0) {
  		DRM_ERROR("couldn't fill AVI infoframe\n");
  		return;
drivers/gpu/drm/zte/zx_hdmi.c +1 -1
index 0df7366..7e834e3 100644
@@ -124,7 +124,7 @@ static int zx_hdmi_config_video_avi(struct zx_hdmi *hdmi,
  	union hdmi_infoframe frame;
  	int ret;
 
-	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode);
+	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
  	if (ret) {
  		DRM_DEV_ERROR(hdmi->dev, "failed to get avi infoframe: %d\n",
  			      ret);
include/drm/drm_edid.h +0 -0
index 7b9f48b..c07eb81 100644
@@ -343,7 +343,8 @@ drm_load_edid_firmware(struct drm_connector *connector)
 
Quoted 9 lines

include/drm/drm_edid.h drm_load_edid_firmware(struct drm_connector *connector) · line 350

Quoted 8 lines
include/drm/drm_edid.h +2 -1
  int
  drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-					 const struct drm_display_mode *mode);
+					 const struct drm_display_mode *mode,
+					 bool is_hdmi2);
  int
  drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
  					    const struct drm_display_mode *mode);

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

#4 lore raw

PATCH 2/11 drm/edid: Complete CEA modedb(VIC 1-107)

In reply to Shashank Sharma

CEA-861-F specs defines new video modes to be used with HDMI 2.0 EDIDs. The VIC range has been extended from 1-64 to 1-107.

Our existing CEA modedb contains only 64 modes (VIC=1 to VIC=64). Now to be able to parse new CEA modes using the existing methods, we have to complete the modedb (VIC=65 onwards).

This patch adds:
- Timings for existing CEA video modes (from VIC=65 till VIC=92)
- Newly added 4k modes (from VIC=93 to VIC=107).

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>

V2: Addressed review comments from Jose:
- fix the timings for VIC 83, 90 and 91
- fix formatting for VIC 93-107

V3: Rebase on drm-tip, added R-B from Jose, Alex.
V4: Addressed review comments from Andrzej not to modify the
VIC filed for HDMI 1.4b sinks (by adding another patch).

---
 drivers/gpu/drm/drm_edid.c | 215 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 215 insertions(+)
drivers/gpu/drm/drm_edid.c +215 -0
index f982a42..8d98687 100644
@@ -1001,6 +1001,221 @@ static const struct drm_display_mode edid_cea_modes[] = {
 		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
 		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
 	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+	/* 65 - 1280x720@24Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 59400, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 66 - 1280x720@25Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3700,
+		   3740, 3960, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 67 - 1280x720@30Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 68 - 1280x720@50Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 69 - 1280x720@60Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 70 - 1280x720@100Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 71 - 1280x720@120Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 72 - 1920x1080@24Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2558,
+		   2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 73 - 1920x1080@25Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 74 - 1920x1080@30Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 75 - 1920x1080@50Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 76 - 1920x1080@60Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 77 - 1920x1080@100Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 78 - 1920x1080@120Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 79 - 1680x720@24Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 3040,
+		3080, 3300, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 80 - 1680x720@25Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2908,
+		2948, 3168, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 81 - 1680x720@30Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2380,
+		2420, 2640, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 82 - 1680x720@50Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 82500, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 83 - 1680x720@60Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 99000, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 84 - 1680x720@100Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 165000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 85 - 1680x720@120Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 198000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 86 - 2560x1080@24Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 99000, 2560, 3558,
+		3602, 3750, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 87 - 2560x1080@25Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 90000, 2560, 3008,
+		3052, 3200, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 88 - 2560x1080@30Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 118800, 2560, 3328,
+		3372, 3520, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 89 - 2560x1080@50Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 185625, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 90 - 2560x1080@60Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 198000, 2560, 2808,
+		2852, 3000, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 91 - 2560x1080@100Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 371250, 2560, 2778,
+		2822, 2970, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 92 - 2560x1080@120Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 495000, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 93 - 3840x2160p@24Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9,},
+	/* 94 - 3840x2160p@25Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 95 - 3840x2160p@30Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 96 - 3840x2160p@50Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 97 - 3840x2160p@60Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 98 - 4096x2160p@24Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 99 - 4096x2160p@25Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 100 - 4096x2160p@30Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 101 - 4096x2160p@50Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 102 - 4096x2160p@60Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 103 - 3840x2160p@24Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 104 - 3840x2160p@25Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 105 - 3840x2160p@30Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 106 - 3840x2160p@50Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 107 - 3840x2160p@60Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
 };
 
 /*
Signature · 6 lines
2.7.4

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

Re: [PATCH 02/11] drm/edid: Complete CEA modedb(VIC 1-107)

Quoted 11 lines · Shashank Sharma

CEA-861-F specs defines new video modes to be used with HDMI 2.0 EDIDs. The VIC range has been extended from 1-64 to 1-107.

Our existing CEA modedb contains only 64 modes (VIC=1 to VIC=64). Now to be able to parse new CEA modes using the existing methods, we have to complete the modedb (VIC=65 onwards).

This patch adds:
- Timings for existing CEA video modes (from VIC=65 till VIC=92)
- Newly added 4k modes (from VIC=93 to VIC=107).

I'm pretty sure I've mentioned before that we need to deal with the native bit differently for these new modes. That is, the native bit is only present for VICs <=64. For these new VICs there is no native bit, and if we pretend that there is we would misinterpret any VIC >192.

Quoted 249 lines
Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>

V2: Addressed review comments from Jose:
- fix the timings for VIC 83, 90 and 91
- fix formatting for VIC 93-107

V3: Rebase on drm-tip, added R-B from Jose, Alex.
V4: Addressed review comments from Andrzej not to modify the
VIC filed for HDMI 1.4b sinks (by adding another patch).

---
 drivers/gpu/drm/drm_edid.c | 215 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 215 insertions(+)
drivers/gpu/drm/drm_edid.c +215 -0
index f982a42..8d98687 100644
@@ -1001,6 +1001,221 @@ static const struct drm_display_mode edid_cea_modes[] = {
 		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
 		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
 	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+	/* 65 - 1280x720@24Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 59400, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 66 - 1280x720@25Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3700,
+		   3740, 3960, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 67 - 1280x720@30Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 68 - 1280x720@50Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 69 - 1280x720@60Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 70 - 1280x720@100Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 71 - 1280x720@120Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 72 - 1920x1080@24Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2558,
+		   2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 73 - 1920x1080@25Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 74 - 1920x1080@30Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 75 - 1920x1080@50Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 76 - 1920x1080@60Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 77 - 1920x1080@100Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 78 - 1920x1080@120Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 79 - 1680x720@24Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 3040,
+		3080, 3300, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 80 - 1680x720@25Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2908,
+		2948, 3168, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 81 - 1680x720@30Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2380,
+		2420, 2640, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 82 - 1680x720@50Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 82500, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 83 - 1680x720@60Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 99000, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 84 - 1680x720@100Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 165000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 85 - 1680x720@120Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 198000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 86 - 2560x1080@24Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 99000, 2560, 3558,
+		3602, 3750, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 87 - 2560x1080@25Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 90000, 2560, 3008,
+		3052, 3200, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 88 - 2560x1080@30Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 118800, 2560, 3328,
+		3372, 3520, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 89 - 2560x1080@50Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 185625, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 90 - 2560x1080@60Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 198000, 2560, 2808,
+		2852, 3000, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 91 - 2560x1080@100Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 371250, 2560, 2778,
+		2822, 2970, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 92 - 2560x1080@120Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 495000, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 93 - 3840x2160p@24Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9,},
+	/* 94 - 3840x2160p@25Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 95 - 3840x2160p@30Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 96 - 3840x2160p@50Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 97 - 3840x2160p@60Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 98 - 4096x2160p@24Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 99 - 4096x2160p@25Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 100 - 4096x2160p@30Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 101 - 4096x2160p@50Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 102 - 4096x2160p@60Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 103 - 3840x2160p@24Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 104 - 3840x2160p@25Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 105 - 3840x2160p@30Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 106 - 3840x2160p@50Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 107 - 3840x2160p@60Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
 };
 
 /*
Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 02/11] drm/edid: Complete CEA modedb(VIC 1-107)

Regards

Shashank

Quoted 9 lines · Ville Syrjälä
Quoted 8 lines · Shashank Sharma

CEA-861-F specs defines new video modes to be used with HDMI 2.0 EDIDs. The VIC range has been extended from 1-64 to 1-107.

Our existing CEA modedb contains only 64 modes (VIC=1 to VIC=64). Now to be able to parse new CEA modes using the existing methods, we have to complete the modedb (VIC=65 onwards).

Quoted 8 lines
Quoted 3 lines

This patch adds:
- Timings for existing CEA video modes (from VIC=65 till VIC=92)
- Newly added 4k modes (from VIC=93 to VIC=107).

I'm pretty sure I've mentioned before that we need to deal with the native bit differently for these new modes. That is, the native bit is only present for VICs <=64. For these new VICs there is no native bit, and if we pretend that there is we would misinterpret any VIC >192.

Yes, I remember the discussion, just forgot it while coding :-). I will add code to restrict native bit decoding at VIC=64

- Shashank

Quoted 245 lines
Quoted 245 lines
Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc Alex Deucher <[email protected]>

V2: Addressed review comments from Jose:
- fix the timings for VIC 83, 90 and 91
- fix formatting for VIC 93-107

V3: Rebase on drm-tip, added R-B from Jose, Alex.
V4: Addressed review comments from Andrzej not to modify the
VIC filed for HDMI 1.4b sinks (by adding another patch).

---
  drivers/gpu/drm/drm_edid.c | 215 +++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 215 insertions(+)
drivers/gpu/drm/drm_edid.c +215 -0
index f982a42..8d98687 100644
@@ -1001,6 +1001,221 @@ static const struct drm_display_mode edid_cea_modes[] = {
  		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
  		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
  	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+	/* 65 - 1280x720@24Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 59400, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 66 - 1280x720@25Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3700,
+		   3740, 3960, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 67 - 1280x720@30Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3040,
+		   3080, 3300, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 68 - 1280x720@50Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 69 - 1280x720@60Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 70 - 1280x720@100Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1720,
+		   1760, 1980, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 71 - 1280x720@120Hz */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 72 - 1920x1080@24Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2558,
+		   2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 73 - 1920x1080@25Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 74 - 1920x1080@30Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 75 - 1920x1080@50Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 76 - 1920x1080@60Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 77 - 1920x1080@100Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2448,
+		   2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 78 - 1920x1080@120Hz */
+	{ DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2008,
+		   2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	 .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 79 - 1680x720@24Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 3040,
+		3080, 3300, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 80 - 1680x720@25Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2908,
+		2948, 3168, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 81 - 1680x720@30Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 59400, 1680, 2380,
+		2420, 2640, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 82 - 1680x720@50Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 82500, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 83 - 1680x720@60Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 99000, 1680, 1940,
+		1980, 2200, 0, 720, 725, 730, 750, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 84 - 1680x720@100Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 165000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 85 - 1680x720@120Hz */
+	{ DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER, 198000, 1680, 1740,
+		1780, 2000, 0, 720, 725, 730, 825, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 86 - 2560x1080@24Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 99000, 2560, 3558,
+		3602, 3750, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 87 - 2560x1080@25Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 90000, 2560, 3008,
+		3052, 3200, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 88 - 2560x1080@30Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 118800, 2560, 3328,
+		3372, 3520, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 89 - 2560x1080@50Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 185625, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1125, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 90 - 2560x1080@60Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 198000, 2560, 2808,
+		2852, 3000, 0, 1080, 1084, 1089, 1100, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 91 - 2560x1080@100Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 371250, 2560, 2778,
+		2822, 2970, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 92 - 2560x1080@120Hz */
+	{ DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER, 495000, 2560, 3108,
+		3152, 3300, 0, 1080, 1084, 1089, 1250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, },
+	/* 93 - 3840x2160p@24Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9,},
+	/* 94 - 3840x2160p@25Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 95 - 3840x2160p@30Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 96 - 3840x2160p@50Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 97 - 3840x2160p@60Hz 16:9 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9},
+	/* 98 - 4096x2160p@24Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 99 - 4096x2160p@25Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 100 - 4096x2160p@30Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 101 - 4096x2160p@50Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 5064,
+		5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 102 - 4096x2160p@60Hz 256:135 */
+	{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 4184,
+		4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135},
+	/* 103 - 3840x2160p@24Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 5116,
+		5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 104 - 3840x2160p@25Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 105 - 3840x2160p@30Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 106 - 3840x2160p@50Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4896,
+		4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
+	/* 107 - 3840x2160p@60Hz 64:27 */
+	{ DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016,
+		4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
+		DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27},
  };
 
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_edid.c +0 -0
  /*
Signature · 1 line
2.7.4

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

#7 lore raw

PATCH 3/11 drm: parse ycbcr 420 vdb block

In reply to Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
 drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_modes.c | 10 +++++++--
 include/drm/drm_connector.h |  1 +
 include/uapi/drm/drm_mode.h |  6 +++++
 4 files changed, 67 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +52 -2
index 8d98687..64d8e2e 100644
@@ -2777,6 +2777,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 #define VENDOR_BLOCK    0x03
 #define SPEAKER_BLOCK	0x04
 #define VIDEO_CAPABILITY_BLOCK	0x07
+#define VIDEO_DATA_BLOCK_420	0x0E
 #define EDID_BASIC_AUDIO	(1 << 6)
 #define EDID_CEA_YCRCB444	(1 << 5)
 #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3278,6 +3279,32 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
 	return modes;
 }
 
+/* Modes which can be supported in ycbcr 420 format only */
+static int do_420_vdb_modes(struct drm_connector *connector, const u8 *svds,
+		u8 svds_len)
+{
+	int modes = 0, i;
+	struct drm_device *dev = connector->dev;
+	struct drm_display_mode *newmode;
+	struct drm_display_info *info = &connector->display_info;
+
+	for (i = 0; i < svds_len; i++) {
+		u8 vic = svds[i] & 0x7f;
+
+		newmode = drm_mode_duplicate(dev, &edid_cea_modes[vic]);
+		if (!newmode)
+			break;
+
+		newmode->flags |= DRM_MODE_FLAG_420_ONLY;
+		drm_mode_probed_add(connector, newmode);
+		modes++;
+	}
+
+	if (modes > 0)
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB420;
+	return modes;
+}
+
 /*
  * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block
  * @connector: connector corresponding to the HDMI sink
@@ -3434,6 +3461,12 @@ cea_db_tag(const u8 *db)
 }
 
 static int
+cea_db_extended_tag(const u8 *db)
+{
+	return db[1];
+}
+
+static int
 cea_revision(const u8 *cea)
 {
 	return cea[1];
@@ -3482,6 +3515,17 @@ static bool cea_db_is_hdmi_forum_vsdb(const u8 *db)
 	return oui == HDMI_FORUM_IEEE_OUI;
 }
 
+static bool cea_db_is_hdmi_vdb420(const u8 *db)
+{
+	if (cea_db_tag(db) != VIDEO_CAPABILITY_BLOCK)
+		return false;
+
+	if (cea_db_extended_tag(db) != VIDEO_DATA_BLOCK_420)
+		return false;
+
+	return true;
+}
+
 #define for_each_cea_db(cea, i, start, end) \
 	for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
 
@@ -3507,10 +3551,16 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
 				video = db + 1;
 				video_len = dbl;
 				modes += do_cea_modes(connector, video, dbl);
-			}
-			else if (cea_db_is_hdmi_vsdb(db)) {
+			} else if (cea_db_is_hdmi_vsdb(db)) {
 				hdmi = db;
 				hdmi_len = dbl;
+			} else if (cea_db_is_hdmi_vdb420(db)) {
+				const u8 *vdb420 = &db[2];
+				u8 vdb420_len = dbl - 1;
+
+				/* Add 4:2:0(only) modes present in EDID */
+				modes += do_420_vdb_modes(connector, vdb420,
+							  vdb420_len);
 			}
 		}
 	}
drivers/gpu/drm/drm_modes.c +8 -2
index f2493b9..10432f3 100644
@@ -987,6 +987,10 @@ bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct
 	    (mode2->flags & DRM_MODE_FLAG_3D_MASK))
 		return false;
 
+	if ((mode1->flags & DRM_MODE_FLAG_420_MASK) !=
+	    (mode2->flags & DRM_MODE_FLAG_420_MASK))
+		return false;
+
 	return drm_mode_equal_no_clocks_no_stereo(mode1, mode2);
 }
 EXPORT_SYMBOL(drm_mode_equal_no_clocks);
@@ -1005,6 +1009,9 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks);
 bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
 					const struct drm_display_mode *mode2)
 {
+	unsigned int flags_mask =
+		~(DRM_MODE_FLAG_3D_MASK | DRM_MODE_FLAG_420_MASK);
+
 	if (mode1->hdisplay == mode2->hdisplay &&
 	    mode1->hsync_start == mode2->hsync_start &&
 	    mode1->hsync_end == mode2->hsync_end &&
@@ -1015,8 +1022,7 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
 	    mode1->vsync_end == mode2->vsync_end &&
 	    mode1->vtotal == mode2->vtotal &&
 	    mode1->vscan == mode2->vscan &&
-	    (mode1->flags & ~DRM_MODE_FLAG_3D_MASK) ==
-	     (mode2->flags & ~DRM_MODE_FLAG_3D_MASK))
+	    (mode1->flags & flags_mask) == (mode2->flags & flags_mask))
 		return true;
 
 	return false;
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
 #define DRM_COLOR_FORMAT_RGB444		(1<<0)
 #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
 #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
 	/**
 	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +6 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
 #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)
 
 /* Picture aspect ratio options */
 #define DRM_MODE_PICTURE_ASPECT_NONE		0
Signature · 6 lines
2.7.4

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

Re: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
 drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/drm_modes.c | 10 +++++++--
 include/drm/drm_connector.h |  1 +
 include/uapi/drm/drm_mode.h |  6 +++++
 4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 17 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
 #define DRM_COLOR_FORMAT_RGB444		(1<<0)
 #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
 #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
 	/**
 	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +0 -0
index 8c67fc0..1e74d8e 100644

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 9 lines
include/uapi/drm/drm_mode.h +6 -0
@@ -84,6 +84,12 @@ extern "C" {
 #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap. But I think we agreed that new user space visible mode flags aren't needed, and instad we can keep it all internal?

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

Re: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Regards

Shashank

Quoted 53 lines · Ville Syrjälä
Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
  drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/drm_modes.c | 10 +++++++--
  include/drm/drm_connector.h |  1 +
  include/uapi/drm/drm_mode.h |  6 +++++
  4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 23 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
  #define DRM_COLOR_FORMAT_RGB444		(1<<0)
  #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
  #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
  	/**
  	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +3 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
  #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
  #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
  #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap.
But I think we agreed that new user
space visible mode flags aren't needed, and instad we can keep it all internal?

Yep you are right, we had decided to keep it internal, and this whole patch series is implemented in such a way only, to control everything through the HDMI output property itself. But may be I slightly misunderstood that we shouldn't add the flags bits all together, and I added this flag to differentiate between YCBCR420 and notmal modes. Can you please suggest me on:
- how to differentiate a YCBCR420 mode with normal mode ? I still need to add a flag, but not expose it into uapi layer.

- Shashank

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

#10 lore raw

Re: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Quoted 67 lines · Shashank

Regards

Shashank

Quoted 53 lines · Ville Syrjälä
Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
  drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/drm_modes.c | 10 +++++++--
  include/drm/drm_connector.h |  1 +
  include/uapi/drm/drm_mode.h |  6 +++++
  4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 23 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
  #define DRM_COLOR_FORMAT_RGB444		(1<<0)
  #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
  #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
  	/**
  	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +3 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
  #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
  #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
  #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap.
But I think we agreed that new user
space visible mode flags aren't needed, and instad we can keep it all internal?

Quoted 9 lines

Yep you are right, we had decided to keep it internal, and this whole patch series is implemented in such a way only, to control everything through the HDMI output property itself.
But may be I slightly misunderstood that we shouldn't add the flags bits all together, and I added this flag to differentiate between YCBCR420 and notmal modes.
Can you please suggest me on:
- how to differentiate a YCBCR420 mode with normal mode ? I still need to add a flag, but not expose it into uapi layer.

I guess we can just tack on a few new bools to the end of drm_display_mode. And then when we get the mode passed in by the user we'll have to check whether that mode matches any CEA mode and then look up the correct YCbCr 4:2:0 mode for it.

Hmm. Actually, that probably means that it isn't sufficient to actually store this information on the modes we have on the connector's mode list, because that list has been filtered and so may not actually have all the modes that were declared in the EDID. So I'm thinking we should perhaps make the bitmap parsed from the Y402CMDB index the full CEA mode list. That we can just lookup the matching VIC for the user provided mode and check whether the bit for that VIC indicates 4:2:0 support. And maybe we can handle Y420VDB in exactly the same way (ie. just a second bitmap). That would have the additional nice feature that the maximum length of those bitmaps is well defined (at most 256 VICs).

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

Re: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Regards

Shashank

Quoted 77 lines · Ville Syrjälä
Quoted 67 lines · Shashank

Regards

Shashank

Quoted 53 lines · Ville Syrjälä
Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
   drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
   drivers/gpu/drm/drm_modes.c | 10 +++++++--
   include/drm/drm_connector.h |  1 +
   include/uapi/drm/drm_mode.h |  6 +++++
   4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 23 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
   #define DRM_COLOR_FORMAT_RGB444		(1<<0)
   #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
   #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
   	/**
   	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +3 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
   #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
   #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
   #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap.
But I think we agreed that new user
space visible mode flags aren't needed, and instad we can keep it all internal?

Quoted 9 lines

Yep you are right, we had decided to keep it internal, and this whole patch series is implemented in such a way only, to control everything through the HDMI output property itself.
But may be I slightly misunderstood that we shouldn't add the flags bits all together, and I added this flag to differentiate between YCBCR420 and notmal modes.
Can you please suggest me on:
- how to differentiate a YCBCR420 mode with normal mode ? I still need to add a flag, but not expose it into uapi layer.

Quoted 4 lines

I guess we can just tack on a few new bools to the end of drm_display_mode. And then when we get the mode passed in by the user we'll have to check whether that mode matches any CEA mode and then look up the correct YCbCr 4:2:0 mode for it.

seems good to me, I can add a is_ycbcr420 flag, and we need not to bother about converting it to drm_mode_modeinfo as we are keeping it internal.

Quoted 5 lines

Hmm. Actually, that probably means that it isn't sufficient to actually store this information on the modes we have on the connector's mode list, because that list has been filtered and so may not actually have all the modes that were declared in the EDID.

I dint get this point, Why do you think its not sufficient ? Do we need to care about the modes which are getting rejected from the driver ? I guess they cant be applied anyways. Do you think we will miss some of the YCBCR modes due to mode filtering ?

Quoted 9 lines

So I'm thinking we
should perhaps make the bitmap parsed from the Y402CMDB index the full CEA mode list. That we can just lookup the matching VIC for the user provided mode and check whether the bit for that VIC indicates 4:2:0 support. And maybe we can handle Y420VDB in exactly the same way (ie. just a second bitmap). That would have the additional nice feature that the maximum length of those bitmaps is well defined (at most 256 VICs).

We can do this, but do we really need 2 bitmaps ? A YCBCR420 support is same whether its coming from VCB or VDB, we just need a ORing of these supports. Even in the current implementation, I have been using only the YCBCR420_MASK to identify support.

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

#12 lore raw

Re: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Quoted 91 lines · Shashank

Regards

Shashank

Quoted 77 lines · Ville Syrjälä
Quoted 67 lines · Shashank

Regards

Shashank

Quoted 53 lines · Ville Syrjälä
Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
   drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
   drivers/gpu/drm/drm_modes.c | 10 +++++++--
   include/drm/drm_connector.h |  1 +
   include/uapi/drm/drm_mode.h |  6 +++++
   4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 23 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
   #define DRM_COLOR_FORMAT_RGB444		(1<<0)
   #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
   #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
   	/**
   	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +3 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
   #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
   #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
   #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap.
But I think we agreed that new user
space visible mode flags aren't needed, and instad we can keep it all internal?

Quoted 9 lines

Yep you are right, we had decided to keep it internal, and this whole patch series is implemented in such a way only, to control everything through the HDMI output property itself.
But may be I slightly misunderstood that we shouldn't add the flags bits all together, and I added this flag to differentiate between YCBCR420 and notmal modes.
Can you please suggest me on:
- how to differentiate a YCBCR420 mode with normal mode ? I still need to add a flag, but not expose it into uapi layer.

Quoted 4 lines

I guess we can just tack on a few new bools to the end of drm_display_mode. And then when we get the mode passed in by the user we'll have to check whether that mode matches any CEA mode and then look up the correct YCbCr 4:2:0 mode for it.

seems good to me, I can add a is_ycbcr420 flag, and we need not to bother about converting it to drm_mode_modeinfo as we are keeping it internal.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

Hmm. Actually, that probably means that it isn't sufficient to actually store this information on the modes we have on the connector's mode list, because that list has been filtered and so may not actually have all the modes that were declared in the EDID.

I dint get this point, Why do you think its not sufficient ? Do we need to care about the modes which are getting rejected from the driver ?

Yes, that was my worry. In general I don't think connector->modes should ever be used for mode validation or state computation. Eg. if fbdev handled the previus hotplug connector->modes will have been filtered based on the size of the fb_helper framebuffer, and then a new master might just blindly come in and blindly set a new mode without doing a full connector probe.

Quoted 11 lines

I guess they cant be applied anyways. Do you think we will miss some of the YCBCR modes due to mode filtering ?

Quoted 9 lines

So I'm thinking we
should perhaps make the bitmap parsed from the Y402CMDB index the full CEA mode list. That we can just lookup the matching VIC for the user provided mode and check whether the bit for that VIC indicates 4:2:0 support. And maybe we can handle Y420VDB in exactly the same way (ie. just a second bitmap). That would have the additional nice feature that the maximum length of those bitmaps is well defined (at most 256 VICs).

Quoted 3 lines

We can do this, but do we really need 2 bitmaps ? A YCBCR420 support is same whether its coming from VCB or VDB, we just need a ORing of these supports.

We'll need to know if the mode is one of the "4:2:0 only" modes so that we'll automagically pick 4:2:0 whenever the user asks for this mode. And we'll need to know whether the mode is one of the "4:2:0 too" modes when the user asks for 4:2:0 for explicitly. The latter case of course needs a new property for that purpose.

Quoted 4 lines

Even in the current implementation, I have been using only the YCBCR420_MASK to identify support.

- Shashank

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: [PATCH 03/11] drm: parse ycbcr 420 vdb block

Regards

Shashank

Quoted 95 lines · Ville Syrjälä
Quoted 94 lines · Shashank

Regards

Shashank

Quoted 77 lines · Ville Syrjälä
Quoted 67 lines · Shashank

Regards

Shashank

Quoted 53 lines · Ville Syrjälä
Quoted 28 lines · Shashank Sharma

From: Jose Abreu <[email protected]>

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

These new blocks are:
- ycbcr420 video data (vdb) block: video modes which can be supported only in ycbcr420 output mode.
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vdb in the DRM layer.

This patch is a modified version of Jose's RFC patch:
https://patchwork.kernel.org/patch/9492327/
so the authorship is maintained.

---
    drivers/gpu/drm/drm_edid.c  | 54 +++++++++++++++++++++++++++++++++++++++++++--
    drivers/gpu/drm/drm_modes.c | 10 +++++++--
    include/drm/drm_connector.h |  1 +
    include/uapi/drm/drm_mode.h |  6 +++++
    4 files changed, 67 insertions(+), 4 deletions(-)

<snip>

Quoted 23 lines
include/drm/drm_connector.h +1 -0
index 4eeda12..cef76b2 100644
@@ -199,6 +199,7 @@ struct drm_display_info {
    #define DRM_COLOR_FORMAT_RGB444		(1<<0)
    #define DRM_COLOR_FORMAT_YCRCB444	(1<<1)
    #define DRM_COLOR_FORMAT_YCRCB422	(1<<2)
+#define DRM_COLOR_FORMAT_YCRCB420	(1<<2)
 
    	/**
    	 * @color_formats: HDMI Color formats, selects between RGB and YCrCb
include/uapi/drm/drm_mode.h +3 -0
index 8c67fc0..1e74d8e 100644
@@ -84,6 +84,12 @@ extern "C" {
    #define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH	(6<<14)
    #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
    #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
+/*
+ * HDMI 2.0
+ */
Quoted 8 lines

include/uapi/drm/drm_mode.h extern "C" { · line 92

Quoted 3 lines
include/uapi/drm/drm_mode.h +3 -0
+#define DRM_MODE_FLAG_420_MASK			(0x03<<23)
+#define  DRM_MODE_FLAG_420			(1<<23)
+#define  DRM_MODE_FLAG_420_ONLY			(1<<24)

Adding those would again break the uabi. We can't add new mode flags without some kind of client cap.
But I think we agreed that new user
space visible mode flags aren't needed, and instad we can keep it all internal?

Quoted 9 lines

Yep you are right, we had decided to keep it internal, and this whole patch series is implemented in such a way only, to control everything through the HDMI output property itself.
But may be I slightly misunderstood that we shouldn't add the flags bits all together, and I added this flag to differentiate between YCBCR420 and notmal modes.
Can you please suggest me on:
- how to differentiate a YCBCR420 mode with normal mode ? I still need to add a flag, but not expose it into uapi layer.

Quoted 4 lines

I guess we can just tack on a few new bools to the end of drm_display_mode. And then when we get the mode passed in by the user we'll have to check whether that mode matches any CEA mode and then look up the correct YCbCr 4:2:0 mode for it.

seems good to me, I can add a is_ycbcr420 flag, and we need not to bother about converting it to drm_mode_modeinfo as we are keeping it internal.

Quoted 4 lines

Hmm. Actually, that probably means that it isn't sufficient to actually store this information on the modes we have on the connector's mode list, because that list has been filtered and so may not actually have all the modes that were declared in the EDID.

Quoted 8 lines
Quoted 2 lines

I dint get this point, Why do you think its not sufficient ? Do we need to care about the modes which are getting rejected from the driver ?

Yes, that was my worry. In general I don't think connector->modes should ever be used for mode validation or state computation. Eg. if fbdev handled the previus hotplug connector->modes will have been filtered based on the size of the fb_helper framebuffer, and then a new master might just blindly come in and blindly set a new mode without doing a full connector probe.

Its very valid point when it comes to resolution, but do you think fbdev will reject based on the flags (YCBCR420_only/also) . I mean if I add YCBCR420 info as bools (like in your previous suggestion), would that alter fbdev selection ? Nevertheless, a YCBCR420 bitmap seems to be a good idea already, just as soon as we can map it clearly with the hdmi_output property.

Quoted 11 lines
Quoted 11 lines

I guess they cant be applied anyways. Do you think we will miss some of the YCBCR modes due to mode filtering ?

Quoted 9 lines

So I'm thinking we
should perhaps make the bitmap parsed from the Y402CMDB index the full CEA mode list. That we can just lookup the matching VIC for the user provided mode and check whether the bit for that VIC indicates 4:2:0 support. And maybe we can handle Y420VDB in exactly the same way (ie. just a second bitmap). That would have the additional nice feature that the maximum length of those bitmaps is well defined (at most 256 VICs).

Quoted 8 lines
Quoted 3 lines

We can do this, but do we really need 2 bitmaps ? A YCBCR420 support is same whether its coming from VCB or VDB, we just need a ORing of these supports.

We'll need to know if the mode is one of the "4:2:0 only" modes so that we'll automagically pick 4:2:0 whenever the user asks for this mode. And we'll need to know whether the mode is one of the "4:2:0 too" modes when the user asks for 4:2:0 for explicitly. The latter case of course needs a new property for that purpose.

The current design is as per out last discussion, where the hdmi_output property decides what would be the possible output. So if userspace sets hdmi_output to YCBCR420, and sends modeset, we will just check if we can support this mode in YCBCR420 in intel_hdmi_compute_ycbcr_config, and decide to accept or reject the modeset. IF you can please have a look at the 8th patch in I915 layer (https://patchwork.freedesktop.org/patch/149107/ ) it would be easier for us to discus if my approach needs any more changes there too.

As of now (only in current design) one property is serving the purpose, probably I need to fine tune this also.
- Shashank

Quoted 4 lines
Quoted 4 lines

Even in the current implementation, I have been using only the YCBCR420_MASK to identify support.

- Shashank

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

#14 lore raw

PATCH 4/11 drm: parse ycbcr420 vcb block

In reply to Shashank Sharma

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

One of these new blocks is: ycbcr420 vcb
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vcb in the DRM layer. This block contains a bitmap about which mode, from among the list of normal svd videomodes, can support ycbcr420 output too.

So if bit 0 from first vcb byte is set, means first video mode in the svd list, can be supported in ycbcr420 output too. Bit 2 means second video mode from svd list, and so on.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/drm_edid.c  | 80 +++++++++++++++++++++++++++++++++++++++++++--
 include/drm/drm_connector.h |  1 +
 2 files changed, 79 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +78 -2
index 64d8e2e..d01b7df 100644
@@ -2778,6 +2778,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 #define SPEAKER_BLOCK	0x04
 #define VIDEO_CAPABILITY_BLOCK	0x07
 #define VIDEO_DATA_BLOCK_420	0x0E
+#define VIDEO_CAP_BLOCK_420	0x0F
 #define EDID_BASIC_AUDIO	(1 << 6)
 #define EDID_CEA_YCRCB444	(1 << 5)
 #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3143,11 +3144,21 @@ static int
 do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len)
 {
 	int i, modes = 0;
+	u64 hdmi_420_cap_map = connector->display_info.hdmi.ycbcr420_vcb_map;
 
 	for (i = 0; i < len; i++) {
 		struct drm_display_mode *mode;
 		mode = drm_display_mode_from_vic_index(connector, db, len, i);
 		if (mode) {
+			/*
+			 * ycbcr420 capability block contains a bitmap which
+			 * gives the index of such CEA modes in VDB, which can
+			 * support ycbcr420 sampling output also.
+			 * For example, if the bit 0 in bitmap is set,
+			 * first mode in VDB can support ycbcr420 output too.
+			 */
+			if (hdmi_420_cap_map & (1 << i))
+				mode->flags |= DRM_MODE_FLAG_420;
 			drm_mode_probed_add(connector, mode);
 			modes++;
 		}
@@ -3526,9 +3537,64 @@ static bool cea_db_is_hdmi_vdb420(const u8 *db)
 	return true;
 }
 
+static bool cea_db_is_hdmi_vcb420(const u8 *db)
+{
+	if (cea_db_tag(db) != VIDEO_CAPABILITY_BLOCK)
+		return false;
+
+	if (cea_db_extended_tag(db) != VIDEO_CAP_BLOCK_420)
+		return false;
+
+	return true;
+}
+
 #define for_each_cea_db(cea, i, start, end) \
 	for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
 
+static void drm_parse_vcb_420_bitmap(struct drm_connector *connector,
+				     const u8 *db)
+{
+	struct drm_display_info *info = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &info->hdmi;
+	u8 map_len = cea_db_payload_len(db) - 1;
+	u8 count;
+	u64 map = 0;
+
+	if (!db)
+		return;
+
+	if (map_len == 0) {
+		/* All CEA modes support ycbcr420 sampling also.*/
+		hdmi->ycbcr420_vcb_map = U64_MAX;
+		return;
+	}
+
+	/*
+	 * This map indicates which of the existing CEA block modes
+	 * from VDB can support YCBCR420 output too. So if bit=0 is
+	 * set, first mode from VDB can support YCBCR420 output too.
+	 * We will parse and keep this map, before parsing VDB itself
+	 * to avoid going through the same block again and again.
+	 *
+	 * Spec is not clear about max possible size of this block.
+	 * Clamping max bitmap block size at 8 bytes. Every byte can
+	 * address 8 CEA modes, in this way this map can address
+	 * 8*8 = first 64 SVDs.
+	 */
+	if (map_len > 8)
+		map_len = 8;
+
+	for (count = 0; count < map_len; count++)
+		map = (db[2 + count] << 8 * count) | map;
+
+	if (map) {
+		DRM_DEBUG_KMS("Sink supports ycbcr 420\n");
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB420;
+	}
+
+	hdmi->ycbcr420_vcb_map = map;
+}
+
 static int
 add_cea_modes(struct drm_connector *connector, struct edid *edid)
 {
@@ -3561,6 +3627,8 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
 				/* Add 4:2:0(only) modes present in EDID */
 				modes += do_420_vdb_modes(connector, vdb420,
 							  vdb420_len);
+			} else if (cea_db_is_hdmi_vcb420(db)) {
+				drm_parse_vcb_420_bitmap(connector, db);
 			}
 		}
 	}
@@ -4241,6 +4309,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			drm_parse_hdmi_vsdb_video(connector, db);
 		if (cea_db_is_hdmi_forum_vsdb(db))
 			drm_parse_hdmi_forum_vsdb(connector, db);
+		if (cea_db_is_hdmi_vcb420(db))
+			drm_parse_vcb_420_bitmap(connector, db);
 	}
 }
 
@@ -4492,6 +4562,14 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	num_modes += add_cvt_modes(connector, edid);
 	num_modes += add_standard_modes(connector, edid);
 	num_modes += add_established_modes(connector, edid);
+
+	/*
+	 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
+	 * To avoid multiple parsing of same block, lets get the sink info
+	 * before parsing CEA modes.
+	 */
+	drm_add_display_info(connector, edid);
+
 	num_modes += add_cea_modes(connector, edid);
 	num_modes += add_alternate_cea_modes(connector, edid);
 	num_modes += add_displayid_detailed_modes(connector, edid);
@@ -4501,8 +4579,6 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
 		edid_fixup_preferred(connector, quirks);
 
-	drm_add_display_info(connector, edid);
-
 	if (quirks & EDID_QUIRK_FORCE_6BPC)
 		connector->display_info.bpc = 6;
 
include/drm/drm_connector.h +1 -0
index cef76b2..dbfa6a1 100644
@@ -136,6 +136,7 @@ struct drm_scdc {
 struct drm_hdmi_info {
 	/** @scdc: sink's scdc support and capabilities */
 	struct drm_scdc scdc;
+	u64 ycbcr420_vcb_map;
 };
 
 /**
Signature · 6 lines
2.7.4

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

Re: [PATCH 04/11] drm: parse ycbcr420 vcb block

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651 reproduce: make htmldocs

Hi Shashank,

[auto build test WARNING on next-20170407]
[cannot apply to drm/drm-next drm-intel/for-linux-next tegra/for-next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found include/linux/init.h:1: warning: no structured comments found
kernel/sched/core.c:2088: warning: No description found for parameter 'rf' kernel/sched/core.c:2088: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found
include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/iio/iio.h:597: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:970: warning: No description found for parameter 'dma_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'set_busid' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_handler' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_preinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_postinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_uninstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'major' include/drm/drm_drv.h:524: warning: No description found for parameter 'minor' include/drm/drm_drv.h:524: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:524: warning: No description found for parameter 'name' include/drm/drm_drv.h:524: warning: No description found for parameter 'desc' include/drm/drm_drv.h:524: warning: No description found for parameter 'date' include/drm/drm_drv.h:524: warning: No description found for parameter 'driver_features' include/drm/drm_drv.h:524: warning: No description found for parameter 'ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'num_ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'fops'

>> include/drm/drm_connector.h:141: warning: No description found for parameter 'ycbcr420_vcb_map'

include/drm/drm_color_mgmt.h:1: warning: no structured comments found drivers/gpu/drm/drm_plane_helper.c:403: warning: No description found for parameter 'ctx' drivers/gpu/drm/drm_plane_helper.c:404: warning: No description found for parameter 'ctx' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'link_rate' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'link_rate' Documentation/core-api/assoc_array.rst:13: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/doc-guide/sphinx.rst:126: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7701: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation.
kernel/time/timer.c:1202: ERROR: Unexpected indentation.
kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:122: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:125: ERROR: Unexpected indentation.
include/linux/wait.h:127: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:990: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:322: WARNING: Inline literal start-string without end-string. include/linux/iio/iio.h:219: ERROR: Unexpected indentation.
include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:638: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:645: ERROR: Unknown target name: "iio_val". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1898: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:370: ERROR: Unexpected indentation.
drivers/usb/core/message.c:478: ERROR: Unexpected indentation.
drivers/usb/core/message.c:479: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_type". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_dir". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_recip". Documentation/driver-api/usb.rst:689: ERROR: Unknown target name: "usbdevfs_urb_type". drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation. drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent. drivers/gpu/drm/drm_ioctl.c:690: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb".
sound/soc/soc-core.c:2665: ERROR: Unknown target name: "snd_soc_daifmt".
sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn". Documentation/usb/typec.rst:116: ERROR: Error in "kernel-doc" directive:
invalid option block.

vim +/ycbcr420_vcb_map +141 include/drm/drm_connector.h

62c58af32 Shashank Sharma 2017-03-13  125  	 */
62c58af32 Shashank Sharma 2017-03-13  126  	struct drm_scrambling scrambling;
afa1c7636 Shashank Sharma 2017-03-13  127  };
afa1c7636 Shashank Sharma 2017-03-13  128  
62c58af32 Shashank Sharma 2017-03-13  129  
afa1c7636 Shashank Sharma 2017-03-13  130  /**
afa1c7636 Shashank Sharma 2017-03-13  131   * struct drm_hdmi_info - runtime information about the connected HDMI sink
afa1c7636 Shashank Sharma 2017-03-13  132   *
afa1c7636 Shashank Sharma 2017-03-13  133   * Describes if a given display supports advanced HDMI 2.0 features.
afa1c7636 Shashank Sharma 2017-03-13  134   * This information is available in CEA-861-F extension blocks (like HF-VSDB).
afa1c7636 Shashank Sharma 2017-03-13  135   */
afa1c7636 Shashank Sharma 2017-03-13  136  struct drm_hdmi_info {
86cc921cb Shashank Sharma 2017-03-28  137  	/** @scdc: sink's scdc support and capabilities */
afa1c7636 Shashank Sharma 2017-03-13  138  	struct drm_scdc scdc;
862bf9f3d Shashank Sharma 2017-04-07  139  	u64 ycbcr420_vcb_map;
522171951 Daniel Vetter   2016-08-12  140  };
522171951 Daniel Vetter   2016-08-12 @141  
b3c6c8bfe Daniel Vetter   2016-08-12  142  /**
40ee6fbef Manasi Navare   2016-12-16  143   * enum drm_link_status - connector's link_status property value
40ee6fbef Manasi Navare   2016-12-16  144   *
40ee6fbef Manasi Navare   2016-12-16  145   * This enum is used as the connector's link status property value.
40ee6fbef Manasi Navare   2016-12-16  146   * It is set to the values defined in uapi.
41232c1b7 Manasi Navare   2017-03-01  147   *
41232c1b7 Manasi Navare   2017-03-01  148   * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
41232c1b7 Manasi Navare   2017-03-01  149   *                        link training

:::::: The code at line 141 was first introduced by commit
:::::: 522171951761153172c75b94ae1f4bc9ab631745 drm: Extract drm_connector.[hc]

:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#16 lore raw

Re: [PATCH 04/11] drm: parse ycbcr420 vcb block

In reply to Shashank Sharma

Hi Shashank,

Quoted 4 lines · Shashank Sharma
drivers/gpu/drm/drm_edid.c +1 -0
+       u64 hdmi_420_cap_map = connector->display_info.hdmi.ycbcr420_vcb_map;
 
        for (i = 0; i < len; i++) {
                struct drm_display_mode *mode;

drivers/gpu/drm/drm_edid.c static int · line 3160

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
                mode = drm_display_mode_from_vic_index(connector, db, len, i);
                if (mode) {
+                       /*
+                        * ycbcr420 capability block contains a bitmap which
+                        * gives the index of such CEA modes in VDB, which can
+                        * support ycbcr420 sampling output also.
+                        * For example, if the bit 0 in bitmap is set,
+                        * first mode in VDB can support ycbcr420 output too.
+                        */
+                       if (hdmi_420_cap_map & (1 << i))

Since map is u64 you really want to use something like (1ull << i) here. Otherwise you'll get a 32 bit value, regardless of i.

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3589

Quoted 3 lines
drivers/gpu/drm/drm_edid.c +3 -0
+       for (count = 0; count < map_len; count++)
+               map = (db[2 + count] << 8 * count) | map;
+

The above issue is applicable here as well. With a small nitpick the whole thing will read

map |= (u64)db[2 + count] << (8 * count);

include/drm/drm_connector.h struct drm_scdc { · line 139

Quoted 7 lines
include/drm/drm_connector.h +1 -0
@@ -136,6 +136,7 @@ struct drm_scdc {
 struct drm_hdmi_info {
        /** @scdc: sink's scdc support and capabilities */
        struct drm_scdc scdc;
+       u64 ycbcr420_vcb_map;

As pointed by the kbuild robot - you really want to document the field.

Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

Re: [PATCH 04/11] drm: parse ycbcr420 vcb block

Regards

Shashank

Quoted 18 lines · Emil Velikov

Hi Shashank,

Quoted 4 lines · Shashank Sharma
drivers/gpu/drm/drm_edid.c +1 -0
+       u64 hdmi_420_cap_map = connector->display_info.hdmi.ycbcr420_vcb_map;
 
         for (i = 0; i < len; i++) {
                 struct drm_display_mode *mode;

drivers/gpu/drm/drm_edid.c static int · line 3160

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
                 mode = drm_display_mode_from_vic_index(connector, db, len, i);
                 if (mode) {
+                       /*
+                        * ycbcr420 capability block contains a bitmap which
+                        * gives the index of such CEA modes in VDB, which can
+                        * support ycbcr420 sampling output also.
+                        * For example, if the bit 0 in bitmap is set,
+                        * first mode in VDB can support ycbcr420 output too.
+                        */
+                       if (hdmi_420_cap_map & (1 << i))
Quoted 2 lines

Since map is u64 you really want to use something like (1ull << i) here. Otherwise you'll get a 32 bit value, regardless of i.

Thanks Emil, this was a good catch.

Quoted 8 lines

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3589

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +3 -0
+       for (count = 0; count < map_len; count++)
+               map = (db[2 + count] << 8 * count) | map;
+

The above issue is applicable here as well. With a small nitpick the whole thing will read

map |= (u64)db[2 + count] << (8 * count);

Agree, thanks.

Quoted 9 lines

include/drm/drm_connector.h struct drm_scdc { · line 139

Quoted 8 lines
include/drm/drm_connector.h +1 -0
@@ -136,6 +136,7 @@ struct drm_scdc {
  struct drm_hdmi_info {
         /** @scdc: sink's scdc support and capabilities */
         struct drm_scdc scdc;
+       u64 ycbcr420_vcb_map;

As pointed by the kbuild robot - you really want to document the field.

Agree, will handle this in next patch set.

Quoted 2 lines

Regards,
Emil

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

#18 lore raw

Re: [PATCH 04/11] drm: parse ycbcr420 vcb block

In reply to Shashank Sharma
Quoted 44 lines · Shashank Sharma

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

One of these new blocks is: ycbcr420 vcb
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vcb in the DRM layer. This block contains a bitmap about which mode, from among the list of normal svd videomodes, can support ycbcr420 output too.

So if bit 0 from first vcb byte is set, means first video mode in the svd list, can be supported in ycbcr420 output too. Bit 2 means second video mode from svd list, and so on.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/drm_edid.c  | 80 +++++++++++++++++++++++++++++++++++++++++++--
 include/drm/drm_connector.h |  1 +
 2 files changed, 79 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -0
index 64d8e2e..d01b7df 100644
@@ -2778,6 +2778,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 #define SPEAKER_BLOCK	0x04
 #define VIDEO_CAPABILITY_BLOCK	0x07
 #define VIDEO_DATA_BLOCK_420	0x0E
+#define VIDEO_CAP_BLOCK_420	0x0F
 #define EDID_BASIC_AUDIO	(1 << 6)
 #define EDID_CEA_YCRCB444	(1 << 5)
 #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3143,11 +3144,21 @@ static int
 do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len)
 {
 	int i, modes = 0;
+	u64 hdmi_420_cap_map = connector->display_info.hdmi.ycbcr420_vcb_map;
 
 	for (i = 0; i < len; i++) {
 		struct drm_display_mode *mode;

drivers/gpu/drm/drm_edid.c static int · line 3160

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
 		mode = drm_display_mode_from_vic_index(connector, db, len, i);
 		if (mode) {
+			/*
+			 * ycbcr420 capability block contains a bitmap which
+			 * gives the index of such CEA modes in VDB, which can
+			 * support ycbcr420 sampling output also.
+			 * For example, if the bit 0 in bitmap is set,
+			 * first mode in VDB can support ycbcr420 output too.
+			 */
+			if (hdmi_420_cap_map & (1 << i))

We'd need to make sure 'len' is <=64. Not sure if there's any point in making it possible to have more than 64 VDBs. If there is, then the standard bitops.h stuff could be used to make the map longer quite trivially.

Whatever limit we choose I think we should print some kind of warning to indicate that we've exceeded whatever arbitrary limit we chose. And I definitely think it should be a warning level at least to make sure we get a bug report about it.

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3540

Quoted 9 lines
drivers/gpu/drm/drm_edid.c +2 -0
+				mode->flags |= DRM_MODE_FLAG_420;
 			drm_mode_probed_add(connector, mode);
 			modes++;
 		}
@@ -3526,9 +3537,64 @@ static bool cea_db_is_hdmi_vdb420(const u8 *db)
 	return true;
 }
 
+static bool cea_db_is_hdmi_vcb420(const u8 *db)

To keep with the spec terminology this should probably be called cea_db_is_y420cmdb(). Same for the define and other functions dealing witrh this block.

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3544

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	if (cea_db_tag(db) != VIDEO_CAPABILITY_BLOCK)
+		return false;
+

We need to make sure the payload is long enough to actuall contain the extended tag.

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +7 -0
+	if (cea_db_extended_tag(db) != VIDEO_CAP_BLOCK_420)
+		return false;
+
+	return true;
+}
+
 #define for_each_cea_db(cea, i, start, end) \
 	for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
 
+static void drm_parse_vcb_420_bitmap(struct drm_connector *connector,

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3564

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+				     const u8 *db)
+{
+	struct drm_display_info *info = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &info->hdmi;
+	u8 map_len = cea_db_payload_len(db) - 1;
+	u8 count;
+	u64 map = 0;
+
+	if (!db)
+		return;

Is that possible somehow?

Quoted 55 lines
drivers/gpu/drm/drm_edid.c +37 -0
+
+	if (map_len == 0) {
+		/* All CEA modes support ycbcr420 sampling also.*/
+		hdmi->ycbcr420_vcb_map = U64_MAX;
+		return;
+	}
+
+	/*
+	 * This map indicates which of the existing CEA block modes
+	 * from VDB can support YCBCR420 output too. So if bit=0 is
+	 * set, first mode from VDB can support YCBCR420 output too.
+	 * We will parse and keep this map, before parsing VDB itself
+	 * to avoid going through the same block again and again.
+	 *
+	 * Spec is not clear about max possible size of this block.
+	 * Clamping max bitmap block size at 8 bytes. Every byte can
+	 * address 8 CEA modes, in this way this map can address
+	 * 8*8 = first 64 SVDs.
+	 */
+	if (map_len > 8)
+		map_len = 8;
+
+	for (count = 0; count < map_len; count++)
+		map = (db[2 + count] << 8 * count) | map;
+
+	if (map) {
+		DRM_DEBUG_KMS("Sink supports ycbcr 420\n");
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB420;
+	}
+
+	hdmi->ycbcr420_vcb_map = map;
+}
+
 static int
 add_cea_modes(struct drm_connector *connector, struct edid *edid)
 {
@@ -3561,6 +3627,8 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
 				/* Add 4:2:0(only) modes present in EDID */
 				modes += do_420_vdb_modes(connector, vdb420,
 							  vdb420_len);
+			} else if (cea_db_is_hdmi_vcb420(db)) {
+				drm_parse_vcb_420_bitmap(connector, db);
 			}
 		}
 	}
@@ -4241,6 +4309,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
 			drm_parse_hdmi_vsdb_video(connector, db);
 		if (cea_db_is_hdmi_forum_vsdb(db))
 			drm_parse_hdmi_forum_vsdb(connector, db);
+		if (cea_db_is_hdmi_vcb420(db))
+			drm_parse_vcb_420_bitmap(connector, db);
 	}
 }
 

drivers/gpu/drm/drm_edid.c int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) · line 4571

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +7 -0
@@ -4492,6 +4562,14 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	num_modes += add_cvt_modes(connector, edid);
 	num_modes += add_standard_modes(connector, edid);
 	num_modes += add_established_modes(connector, edid);
+
+	/*
+	 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
+	 * To avoid multiple parsing of same block, lets get the sink info
+	 * before parsing CEA modes.
+	 */
+	drm_add_display_info(connector, edid);

Is there any reason why this can't be moved to be called before any modes are added? Having it in the middle like this feels wrong.

Quoted 27 lines
drivers/gpu/drm/drm_edid.c +1 -2
+
 	num_modes += add_cea_modes(connector, edid);
 	num_modes += add_alternate_cea_modes(connector, edid);
 	num_modes += add_displayid_detailed_modes(connector, edid);
@@ -4501,8 +4579,6 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
 	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
 		edid_fixup_preferred(connector, quirks);
 
-	drm_add_display_info(connector, edid);
-
 	if (quirks & EDID_QUIRK_FORCE_6BPC)
 		connector->display_info.bpc = 6;
 
include/drm/drm_connector.h +1 -0
index cef76b2..dbfa6a1 100644
@@ -136,6 +136,7 @@ struct drm_scdc {
 struct drm_hdmi_info {
 	/** @scdc: sink's scdc support and capabilities */
 	struct drm_scdc scdc;
+	u64 ycbcr420_vcb_map;
 };
 
 /**
Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#19 lore raw

Re: [PATCH 04/11] drm: parse ycbcr420 vcb block

Regards

Shashank

Quoted 43 lines · Ville Syrjälä
Quoted 42 lines · Shashank Sharma

HDMI 2.0 spec adds support for ycbcr420 subsampled output. CEA-861-F adds two new blocks in EDID, to provide information about sink's support for ycbcr420 output.

One of these new blocks is: ycbcr420 vcb
- ycbcr420 video capability data (vcb) block: video modes which can be support in ycbcr420 output mode also (along with RGB, YCBCR 444/422 etc)

This patch adds parsing and handling of ycbcr420-vcb in the DRM layer. This block contains a bitmap about which mode, from among the list of normal svd videomodes, can support ycbcr420 output too.

So if bit 0 from first vcb byte is set, means first video mode in the svd list, can be supported in ycbcr420 output too. Bit 2 means second video mode from svd list, and so on.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
  drivers/gpu/drm/drm_edid.c  | 80 +++++++++++++++++++++++++++++++++++++++++++--
  include/drm/drm_connector.h |  1 +
  2 files changed, 79 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -0
index 64d8e2e..d01b7df 100644
@@ -2778,6 +2778,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
  #define SPEAKER_BLOCK	0x04
  #define VIDEO_CAPABILITY_BLOCK	0x07
  #define VIDEO_DATA_BLOCK_420	0x0E
+#define VIDEO_CAP_BLOCK_420	0x0F
  #define EDID_BASIC_AUDIO	(1 << 6)
  #define EDID_CEA_YCRCB444	(1 << 5)
  #define EDID_CEA_YCRCB422	(1 << 4)
@@ -3143,11 +3144,21 @@ static int
  do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len)
  {
  	int i, modes = 0;
+	u64 hdmi_420_cap_map = connector->display_info.hdmi.ycbcr420_vcb_map;
 
Quoted 15 lines

drivers/gpu/drm/drm_edid.c static int · line 3160

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +8 -0
  	for (i = 0; i < len; i++) {
  		struct drm_display_mode *mode;
  		mode = drm_display_mode_from_vic_index(connector, db, len, i);
  		if (mode) {
+			/*
+			 * ycbcr420 capability block contains a bitmap which
+			 * gives the index of such CEA modes in VDB, which can
+			 * support ycbcr420 sampling output also.
+			 * For example, if the bit 0 in bitmap is set,
+			 * first mode in VDB can support ycbcr420 output too.
+			 */
+			if (hdmi_420_cap_map & (1 << i))

We'd need to make sure 'len' is <=64. Not sure if there's any point in making it possible to have more than 64 VDBs. If there is, then the standard bitops.h stuff could be used to make the map longer quite trivially.

I know, among the monitors I have tested with (ACER and SAMSUNG) I have found only 1 or 2 modes in the capability map. But as there is no limit of a 420_VBD block length from the spec, so thought it would be good to assume some safe limit.

Quoted 5 lines

Whatever limit we choose I think we should print some kind of warning to indicate that we've exceeded whatever arbitrary limit we chose. And I definitely think it should be a warning level at least to make sure we get a bug report about it.

Sure, I can add a warning, for the cases where we cross 64 modes.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_edid.c +1 -0
+				mode->flags |= DRM_MODE_FLAG_420;
  			drm_mode_probed_add(connector, mode);
  			modes++;
  		}
@@ -3526,9 +3537,64 @@ static bool cea_db_is_hdmi_vdb420(const u8 *db)
  	return true;
  }
 
Quoted 4 lines

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3540

Quoted 1 line
drivers/gpu/drm/drm_edid.c +1 -0
+static bool cea_db_is_hdmi_vcb420(const u8 *db)

To keep with the spec terminology this should probably be called cea_db_is_y420cmdb(). Same for the define and other functions dealing witrh this block.

Got it.

Quoted 6 lines

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3544

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4 -0
+{
+	if (cea_db_tag(db) != VIDEO_CAPABILITY_BLOCK)
+		return false;
+

We need to make sure the payload is long enough to actuall contain the extended tag.

Dint I check that in the caller ? anyways, I will make sure there is a check.

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_edid.c +6 -0
+	if (cea_db_extended_tag(db) != VIDEO_CAP_BLOCK_420)
+		return false;
+
+	return true;
+}
+
  #define for_each_cea_db(cea, i, start, end) \
  	for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
 
Quoted 12 lines

drivers/gpu/drm/drm_edid.c static bool cea_db_is_hdmi_vdb420(const u8 *db) · line 3564

Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11 -0
+static void drm_parse_vcb_420_bitmap(struct drm_connector *connector,
+				     const u8 *db)
+{
+	struct drm_display_info *info = &connector->display_info;
+	struct drm_hdmi_info *hdmi = &info->hdmi;
+	u8 map_len = cea_db_payload_len(db) - 1;
+	u8 count;
+	u64 map = 0;
+
+	if (!db)
+		return;

Is that possible somehow?

Bad, corrupt EDID extension from a bad monitor ;-) ?

Quoted 55 lines
Quoted 55 lines
drivers/gpu/drm/drm_edid.c +37 -0
+
+	if (map_len == 0) {
+		/* All CEA modes support ycbcr420 sampling also.*/
+		hdmi->ycbcr420_vcb_map = U64_MAX;
+		return;
+	}
+
+	/*
+	 * This map indicates which of the existing CEA block modes
+	 * from VDB can support YCBCR420 output too. So if bit=0 is
+	 * set, first mode from VDB can support YCBCR420 output too.
+	 * We will parse and keep this map, before parsing VDB itself
+	 * to avoid going through the same block again and again.
+	 *
+	 * Spec is not clear about max possible size of this block.
+	 * Clamping max bitmap block size at 8 bytes. Every byte can
+	 * address 8 CEA modes, in this way this map can address
+	 * 8*8 = first 64 SVDs.
+	 */
+	if (map_len > 8)
+		map_len = 8;
+
+	for (count = 0; count < map_len; count++)
+		map = (db[2 + count] << 8 * count) | map;
+
+	if (map) {
+		DRM_DEBUG_KMS("Sink supports ycbcr 420\n");
+		info->color_formats |= DRM_COLOR_FORMAT_YCRCB420;
+	}
+
+	hdmi->ycbcr420_vcb_map = map;
+}
+
  static int
  add_cea_modes(struct drm_connector *connector, struct edid *edid)
  {
@@ -3561,6 +3627,8 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
  				/* Add 4:2:0(only) modes present in EDID */
  				modes += do_420_vdb_modes(connector, vdb420,
  							  vdb420_len);
+			} else if (cea_db_is_hdmi_vcb420(db)) {
+				drm_parse_vcb_420_bitmap(connector, db);
  			}
  		}
  	}
@@ -4241,6 +4309,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
  			drm_parse_hdmi_vsdb_video(connector, db);
  		if (cea_db_is_hdmi_forum_vsdb(db))
  			drm_parse_hdmi_forum_vsdb(connector, db);
+		if (cea_db_is_hdmi_vcb420(db))
+			drm_parse_vcb_420_bitmap(connector, db);
  	}
  }
 
Quoted 13 lines

drivers/gpu/drm/drm_edid.c int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) · line 4571

Quoted 11 lines
drivers/gpu/drm/drm_edid.c +7 -0
@@ -4492,6 +4562,14 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
  	num_modes += add_cvt_modes(connector, edid);
  	num_modes += add_standard_modes(connector, edid);
  	num_modes += add_established_modes(connector, edid);
+
+	/*
+	 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
+	 * To avoid multiple parsing of same block, lets get the sink info
+	 * before parsing CEA modes.
+	 */
+	drm_add_display_info(connector, edid);

Is there any reason why this can't be moved to be called before any modes are added? Having it in the middle like this feels wrong.

In fact I was also thinking about moving it to the start, due to the look and feel of the code, then though it would be better to have minimum changes in the routine. But sure, I would be happy to move it.

- Shashank

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/drm_edid.c +1 -2
+
  	num_modes += add_cea_modes(connector, edid);
  	num_modes += add_alternate_cea_modes(connector, edid);
  	num_modes += add_displayid_detailed_modes(connector, edid);
@@ -4501,8 +4579,6 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
  	if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
  		edid_fixup_preferred(connector, quirks);
 
-	drm_add_display_info(connector, edid);
-
  	if (quirks & EDID_QUIRK_FORCE_6BPC)
  		connector->display_info.bpc = 6;
 
include/drm/drm_connector.h +1 -0
index cef76b2..dbfa6a1 100644
@@ -136,6 +136,7 @@ struct drm_scdc {
  struct drm_hdmi_info {
  	/** @scdc: sink's scdc support and capabilities */
  	struct drm_scdc scdc;
+	u64 ycbcr420_vcb_map;
  };
 
Quoted 3 lines
Quoted 3 lines
include/drm/drm_connector.h +0 -0
  /**
Signature · 1 line
2.7.4

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

#20 lore raw

PATCH 5/11 drm: parse ycbcr 420 deep color information

In reply to Shashank Sharma

CEA-861-F spec adds ycbcr420 deep color support information in hf-vsdb block. This patch extends the existing hf-vsdb parsing function by adding parsing of ycbcr420 deep color support from the EDID and adding it into display information stored.

Cc Ville Syrjälä <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/drm_edid.c  | 15 +++++++++++++++
 include/drm/drm_connector.h |  1 +
 include/drm/drm_edid.h      |  5 +++++
 3 files changed, 21 insertions(+)
drivers/gpu/drm/drm_edid.c +15 -0
index d01b7df..828b781 100644
@@ -4151,6 +4151,19 @@ drm_default_rgb_quant_range(const struct drm_display_mode *mode)
 }
 EXPORT_SYMBOL(drm_default_rgb_quant_range);
 
+static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector,
+					     const u8 *db)
+{
+	struct drm_hdmi_info *info = &connector->display_info.hdmi;
+
+	if (db[7] & DRM_EDID_YCBCR420_DC_48)
+		info->ycbcr420_dc_modes |= DRM_EDID_YCBCR420_DC_48;
+	if (db[7] & DRM_EDID_YCBCR420_DC_36)
+		info->ycbcr420_dc_modes |= DRM_EDID_YCBCR420_DC_36;
+	if (db[7] & DRM_EDID_YCBCR420_DC_30)
+		info->ycbcr420_dc_modes |= DRM_EDID_YCBCR420_DC_30;
+}
+
 static void drm_parse_hdmi_forum_vsdb(struct drm_connector *connector,
 				 const u8 *hf_vsdb)
 {
@@ -4191,6 +4204,8 @@ static void drm_parse_hdmi_forum_vsdb(struct drm_connector *connector,
 				scdc->scrambling.low_rates = true;
 		}
 	}
+
+	drm_parse_ycbcr420_deep_color_info(connector, hf_vsdb);
 }
 
 static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
include/drm/drm_connector.h +1 -0
index dbfa6a1..4545c6e 100644
@@ -136,6 +136,7 @@ struct drm_scdc {
 struct drm_hdmi_info {
 	/** @scdc: sink's scdc support and capabilities */
 	struct drm_scdc scdc;
+	u8 ycbcr420_dc_modes;
 	u64 ycbcr420_vcb_map;
 };
 
include/drm/drm_edid.h +5 -0
index c07eb81..a4d174e7 100644
@@ -213,6 +213,11 @@ struct detailed_timing {
 #define DRM_EDID_HDMI_DC_30               (1 << 4)
 #define DRM_EDID_HDMI_DC_Y444             (1 << 3)
 
+/* YCBCR 420 deep color modes */
+#define DRM_EDID_YCBCR420_DC_48		  (1 << 6)
+#define DRM_EDID_YCBCR420_DC_36		  (1 << 5)
+#define DRM_EDID_YCBCR420_DC_30		  (1 << 4)
+
 /* ELD Header Block */
 #define DRM_ELD_HEADER_BLOCK_SIZE	4
 
Signature · 6 lines
2.7.4

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

Re: [PATCH 05/11] drm: parse ycbcr 420 deep color information

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651 reproduce: make htmldocs

Hi Shashank,

[auto build test WARNING on next-20170407]
[cannot apply to drm/drm-next drm-intel/for-linux-next tegra/for-next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found include/linux/init.h:1: warning: no structured comments found
kernel/sched/core.c:2088: warning: No description found for parameter 'rf' kernel/sched/core.c:2088: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found
include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/iio/iio.h:597: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:970: warning: No description found for parameter 'dma_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'set_busid' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_handler' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_preinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_postinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_uninstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'major' include/drm/drm_drv.h:524: warning: No description found for parameter 'minor' include/drm/drm_drv.h:524: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:524: warning: No description found for parameter 'name' include/drm/drm_drv.h:524: warning: No description found for parameter 'desc' include/drm/drm_drv.h:524: warning: No description found for parameter 'date' include/drm/drm_drv.h:524: warning: No description found for parameter 'driver_features' include/drm/drm_drv.h:524: warning: No description found for parameter 'ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'num_ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'fops'

>> include/drm/drm_connector.h:142: warning: No description found for parameter 'ycbcr420_dc_modes'

include/drm/drm_connector.h:142: warning: No description found for parameter 'ycbcr420_vcb_map' include/drm/drm_color_mgmt.h:1: warning: no structured comments found drivers/gpu/drm/drm_plane_helper.c:403: warning: No description found for parameter 'ctx' drivers/gpu/drm/drm_plane_helper.c:404: warning: No description found for parameter 'ctx' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'link_rate' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'link_rate' Documentation/core-api/assoc_array.rst:13: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/doc-guide/sphinx.rst:126: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7701: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation.
kernel/time/timer.c:1202: ERROR: Unexpected indentation.
kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:122: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:125: ERROR: Unexpected indentation.
include/linux/wait.h:127: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:990: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:322: WARNING: Inline literal start-string without end-string. include/linux/iio/iio.h:219: ERROR: Unexpected indentation.
include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:638: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:645: ERROR: Unknown target name: "iio_val". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1898: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:370: ERROR: Unexpected indentation.
drivers/usb/core/message.c:478: ERROR: Unexpected indentation.
drivers/usb/core/message.c:479: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_type". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_dir". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_recip". Documentation/driver-api/usb.rst:689: ERROR: Unknown target name: "usbdevfs_urb_type". drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation. drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent. drivers/gpu/drm/drm_ioctl.c:690: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb".
sound/soc/soc-core.c:2665: ERROR: Unknown target name: "snd_soc_daifmt".
sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn". Documentation/usb/typec.rst:116: ERROR: Error in "kernel-doc" directive:
invalid option block.

vim +/ycbcr420_dc_modes +142 include/drm/drm_connector.h

62c58af32 Shashank Sharma 2017-03-13  126  	struct drm_scrambling scrambling;
afa1c7636 Shashank Sharma 2017-03-13  127  };
afa1c7636 Shashank Sharma 2017-03-13  128  
62c58af32 Shashank Sharma 2017-03-13  129  
afa1c7636 Shashank Sharma 2017-03-13  130  /**
afa1c7636 Shashank Sharma 2017-03-13  131   * struct drm_hdmi_info - runtime information about the connected HDMI sink
afa1c7636 Shashank Sharma 2017-03-13  132   *
afa1c7636 Shashank Sharma 2017-03-13  133   * Describes if a given display supports advanced HDMI 2.0 features.
afa1c7636 Shashank Sharma 2017-03-13  134   * This information is available in CEA-861-F extension blocks (like HF-VSDB).
afa1c7636 Shashank Sharma 2017-03-13  135   */
afa1c7636 Shashank Sharma 2017-03-13  136  struct drm_hdmi_info {
86cc921cb Shashank Sharma 2017-03-28  137  	/** @scdc: sink's scdc support and capabilities */
afa1c7636 Shashank Sharma 2017-03-13  138  	struct drm_scdc scdc;
a6110e8d2 Shashank Sharma 2017-04-07  139  	u8 ycbcr420_dc_modes;
862bf9f3d Shashank Sharma 2017-04-07  140  	u64 ycbcr420_vcb_map;
522171951 Daniel Vetter   2016-08-12  141  };
522171951 Daniel Vetter   2016-08-12 @142  
b3c6c8bfe Daniel Vetter   2016-08-12  143  /**
40ee6fbef Manasi Navare   2016-12-16  144   * enum drm_link_status - connector's link_status property value
40ee6fbef Manasi Navare   2016-12-16  145   *
40ee6fbef Manasi Navare   2016-12-16  146   * This enum is used as the connector's link status property value.
40ee6fbef Manasi Navare   2016-12-16  147   * It is set to the values defined in uapi.
41232c1b7 Manasi Navare   2017-03-01  148   *
41232c1b7 Manasi Navare   2017-03-01  149   * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
41232c1b7 Manasi Navare   2017-03-01  150   *                        link training

:::::: The code at line 142 was first introduced by commit
:::::: 522171951761153172c75b94ae1f4bc9ab631745 drm: Extract drm_connector.[hc]

:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#22 lore raw

PATCH 6/11 drm: create hdmi output property

In reply to Shashank Sharma

HDMI displays can support various output types, based on the color space and subsampling type. The possible outputs from a HDMI 2.0 monitor could be:
- RGB
- YCBCR 444
- YCBCR 422
- YCBCR 420

This patch adds a drm property, using which, a userspace can specify its preference, for the HDMI output type.
The output type enums are similar to the mentioned outputs above. To handle various subsampling of YCBCR output types, this property allows two special cases:
- DRM_HDMI_OUTPUT_YCBCR_HQ
This indicates preferred output should be YCBCR output, with highest subsampling rate by the source/sink, which can be typically:
- ycbcr444
- ycbcr422
- ycbcr420
- DRM_HDMI_OUTPUT_YCBCR_LQ
This indicates preferred output should be YCBCR output, with lowest subsampling rate supported by source/sink, which can be:
- ycbcr420
- ycbcr422
- ycbcr444

Default value of the property is set to 0 = RGB, so no changes if you dont set the property.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_atomic.c        |  2 ++
 drivers/gpu/drm/drm_atomic_helper.c |  4 ++++
 drivers/gpu/drm/drm_connector.c     | 31 +++++++++++++++++++++++++++++++
 include/drm/drm_connector.h         | 14 ++++++++++++++
 include/drm/drm_mode_config.h       |  5 +++++
 5 files changed, 56 insertions(+)
drivers/gpu/drm/drm_atomic.c +2 -0
index f32506a..6ef34dc 100644
@@ -1123,6 +1123,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
 		 */
 		if (state->link_status != DRM_LINK_STATUS_GOOD)
 			state->link_status = val;
+	} else if (property == config->hdmi_output_property) {
+		state->hdmi_output = val;
 	} else if (connector->funcs->atomic_set_property) {
 		return connector->funcs->atomic_set_property(connector,
 				state, property, val);
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 8be9719..fcba3c0 100644
@@ -567,6 +567,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 			if (old_connector_state->link_status !=
 			    new_connector_state->link_status)
 				new_crtc_state->connectors_changed = true;
+
+			if (old_connector_state->hdmi_output !=
+			    new_connector_state->hdmi_output)
+				new_crtc_state->connectors_changed = true;
 		}
 
 		if (funcs->atomic_check)
drivers/gpu/drm/drm_connector.c +31 -0
index 9f84761..10201b1 100644
@@ -227,6 +227,11 @@ int drm_connector_init(struct drm_device *dev,
 					      config->edid_property,
 					      0);
 
+	if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
+		drm_object_attach_property(&connector->base,
+					   config->hdmi_output_property,
+					   0);
+
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
@@ -617,6 +622,25 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
 };
 DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
 
+static const struct drm_prop_enum_list drm_hdmi_output_enum_list[] = {
+	{ DRM_HDMI_OUTPUT_DEFAULT_RGB, "output_rgb" },
+	{ DRM_HDMI_OUTPUT_YCBCR422, "output_ycbcr422" },
+	{ DRM_HDMI_OUTPUT_YCBCR444, "output_ycbcr444" },
+	{ DRM_HDMI_OUTPUT_YCBCR420, "output_ycbcr420" },
+	{ DRM_HDMI_OUTPUT_YCBCR_HQ, "output_ycbcr_high_subsampling" },
+	{ DRM_HDMI_OUTPUT_YCBCR_LQ, "output_ycbcr_low_subsampling" },
+};
+
+/**
+ * drm_get_hdmi_output_name - return a string for a given hdmi output enum
+ * @type: enum of output type
+ */
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type)
+{
+	return drm_hdmi_output_enum_list[type].name;
+}
+EXPORT_SYMBOL(drm_get_hdmi_output_name);
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -789,6 +813,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.link_status_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "hdmi_output_format",
+					drm_hdmi_output_enum_list,
+					ARRAY_SIZE(drm_hdmi_output_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.hdmi_output_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +14 -0
index 4545c6e..e872a88 100644
@@ -300,6 +300,17 @@ struct drm_tv_connector_state {
 	unsigned int hue;
 };
 
+/* HDMI output pixel format */
+enum drm_hdmi_output_type {
+	DRM_HDMI_OUTPUT_DEFAULT_RGB, /* default RGB */
+	DRM_HDMI_OUTPUT_YCBCR422, /* YCBCR 422 */
+	DRM_HDMI_OUTPUT_YCBCR444, /* YCBCR 444 */
+	DRM_HDMI_OUTPUT_YCBCR420, /* YCBCR 420 */
+	DRM_HDMI_OUTPUT_YCBCR_HQ, /* Highest subsampled YUV */
+	DRM_HDMI_OUTPUT_YCBCR_LQ, /* Lowest subsampled YUV */
+	DRM_HDMI_OUTPUT_INVALID, /* Guess what ? */
+};
+
 /**
  * struct drm_connector_state - mutable connector state
  * @connector: backpointer to the connector
@@ -329,6 +340,8 @@ struct drm_connector_state {
 	struct drm_atomic_state *state;
 
 	struct drm_tv_connector_state tv;
+
+	enum drm_hdmi_output_type hdmi_output;
 };
 
 /**
@@ -945,6 +958,7 @@ static inline void drm_connector_unreference(struct drm_connector *connector)
 
 const char *drm_get_connector_status_name(enum drm_connector_status status);
 const char *drm_get_subpixel_order_name(enum subpixel_order order);
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type);
 const char *drm_get_dpms_name(int val);
 const char *drm_get_dvi_i_subconnector_name(int val);
 const char *drm_get_dvi_i_select_name(int val);
include/drm/drm_mode_config.h +5 -0
index 4298171..1887261 100644
@@ -740,6 +740,11 @@ struct drm_mode_config {
 	 * the position of the output on the host's screen.
 	 */
 	struct drm_property *suggested_y_property;
+	/**
+	 * @hdmi_output_property: output pixel format from HDMI display
+	 * Default is set for RGB
+	 */
+	struct drm_property *hdmi_output_property;
 
 	/* dumb ioctl parameters */
 	uint32_t preferred_depth, prefer_shadow;
Signature · 6 lines
2.7.4

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

Re: [PATCH 06/11] drm: create hdmi output property

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651 reproduce: make htmldocs

Hi Shashank,

[auto build test WARNING on next-20170407]
[cannot apply to drm/drm-next drm-intel/for-linux-next tegra/for-next v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.11-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Shashank-Sharma/HDMI-YCBCR-output-handling-in-DRM-layer/20170408-190651
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found include/linux/init.h:1: warning: no structured comments found
kernel/sched/core.c:2088: warning: No description found for parameter 'rf' kernel/sched/core.c:2088: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found
include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/iio/iio.h:597: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:970: warning: No description found for parameter 'dma_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'set_busid' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_handler' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_preinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_postinstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_uninstall' include/drm/drm_drv.h:524: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:524: warning: No description found for parameter 'major' include/drm/drm_drv.h:524: warning: No description found for parameter 'minor' include/drm/drm_drv.h:524: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:524: warning: No description found for parameter 'name' include/drm/drm_drv.h:524: warning: No description found for parameter 'desc' include/drm/drm_drv.h:524: warning: No description found for parameter 'date' include/drm/drm_drv.h:524: warning: No description found for parameter 'driver_features' include/drm/drm_drv.h:524: warning: No description found for parameter 'ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'num_ioctls' include/drm/drm_drv.h:524: warning: No description found for parameter 'fops' include/drm/drm_connector.h:142: warning: No description found for parameter 'ycbcr420_dc_modes' include/drm/drm_connector.h:142: warning: No description found for parameter 'ycbcr420_vcb_map'

>> include/drm/drm_connector.h:346: warning: No description found for parameter 'hdmi_output'

include/drm/drm_color_mgmt.h:1: warning: no structured comments found drivers/gpu/drm/drm_plane_helper.c:403: warning: No description found for parameter 'ctx' drivers/gpu/drm/drm_plane_helper.c:404: warning: No description found for parameter 'ctx' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'link_rate' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:344: warning: No description found for parameter 'link_rate' Documentation/core-api/assoc_array.rst:13: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/doc-guide/sphinx.rst:126: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7701: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation.
kernel/time/timer.c:1202: ERROR: Unexpected indentation.
kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:122: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:125: ERROR: Unexpected indentation.
include/linux/wait.h:127: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:990: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:322: WARNING: Inline literal start-string without end-string. include/linux/iio/iio.h:219: ERROR: Unexpected indentation.
include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:638: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:645: ERROR: Unknown target name: "iio_val". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1898: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:370: ERROR: Unexpected indentation.
drivers/usb/core/message.c:478: ERROR: Unexpected indentation.
drivers/usb/core/message.c:479: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_type". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_dir". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_recip". Documentation/driver-api/usb.rst:689: ERROR: Unknown target name: "usbdevfs_urb_type". drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation. drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent. drivers/gpu/drm/drm_ioctl.c:690: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb".
sound/soc/soc-core.c:2665: ERROR: Unknown target name: "snd_soc_daifmt".
sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn". Documentation/usb/typec.rst:116: ERROR: Error in "kernel-doc" directive:
invalid option block.

vim +/hdmi_output +346 include/drm/drm_connector.h

afb21ea63 Daniel Vetter   2016-08-31  330  	struct drm_crtc *crtc;
522171951 Daniel Vetter   2016-08-12  331  
522171951 Daniel Vetter   2016-08-12  332  	struct drm_encoder *best_encoder;
522171951 Daniel Vetter   2016-08-12  333  
40ee6fbef Manasi Navare   2016-12-16  334  	/**
40ee6fbef Manasi Navare   2016-12-16  335  	 * @link_status: Connector link_status to keep track of whether link is
40ee6fbef Manasi Navare   2016-12-16  336  	 * GOOD or BAD to notify userspace if retraining is necessary.
40ee6fbef Manasi Navare   2016-12-16  337  	 */
40ee6fbef Manasi Navare   2016-12-16  338  	enum drm_link_status link_status;
40ee6fbef Manasi Navare   2016-12-16  339  
522171951 Daniel Vetter   2016-08-12  340  	struct drm_atomic_state *state;
299a16b16 Boris Brezillon 2016-12-02  341  
299a16b16 Boris Brezillon 2016-12-02  342  	struct drm_tv_connector_state tv;
928e46431 Shashank Sharma 2017-04-07  343  
928e46431 Shashank Sharma 2017-04-07  344  	enum drm_hdmi_output_type hdmi_output;
522171951 Daniel Vetter   2016-08-12  345  };
522171951 Daniel Vetter   2016-08-12 @346  
522171951 Daniel Vetter   2016-08-12  347  /**
522171951 Daniel Vetter   2016-08-12  348   * struct drm_connector_funcs - control connectors on a given device
522171951 Daniel Vetter   2016-08-12  349   *
522171951 Daniel Vetter   2016-08-12  350   * Each CRTC may have one or more connectors attached to it.  The functions
522171951 Daniel Vetter   2016-08-12  351   * below allow the core DRM code to control connectors, enumerate available modes,
522171951 Daniel Vetter   2016-08-12  352   * etc.
522171951 Daniel Vetter   2016-08-12  353   */
522171951 Daniel Vetter   2016-08-12  354  struct drm_connector_funcs {

:::::: The code at line 346 was first introduced by commit
:::::: 522171951761153172c75b94ae1f4bc9ab631745 drm: Extract drm_connector.[hc]

:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#24 lore raw

Re: [PATCH 06/11] drm: create hdmi output property

In reply to Shashank Sharma

Hi Shashank,

Quoted 26 lines · Shashank Sharma

HDMI displays can support various output types, based on the color space and subsampling type. The possible outputs from a HDMI 2.0 monitor could be:
- RGB
- YCBCR 444
- YCBCR 422
- YCBCR 420

This patch adds a drm property, using which, a userspace can specify its preference, for the HDMI output type.
The output type enums are similar to the mentioned outputs above. To handle various subsampling of YCBCR output types, this property allows two special cases:
- DRM_HDMI_OUTPUT_YCBCR_HQ
This indicates preferred output should be YCBCR output, with highest subsampling rate by the source/sink, which can be typically:
- ycbcr444
- ycbcr422
- ycbcr420
- DRM_HDMI_OUTPUT_YCBCR_LQ
This indicates preferred output should be YCBCR output, with lowest subsampling rate supported by source/sink, which can be:
- ycbcr420
- ycbcr422
- ycbcr444

Quoted 2 lines

Default value of the property is set to 0 = RGB, so no changes if you dont set the property.

The HQ/LQ properties are a nice idea but where are you parsing them (because in patch 07/11 you reject these properties)? Also, you need to make sure that source and sink supports the color space.

Best regards,
Jose Miguel Abreu

Quoted 142 lines
Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/drm_atomic.c        |  2 ++
 drivers/gpu/drm/drm_atomic_helper.c |  4 ++++
 drivers/gpu/drm/drm_connector.c     | 31 +++++++++++++++++++++++++++++++
 include/drm/drm_connector.h         | 14 ++++++++++++++
 include/drm/drm_mode_config.h       |  5 +++++
 5 files changed, 56 insertions(+)
drivers/gpu/drm/drm_atomic.c +2 -0
index f32506a..6ef34dc 100644
@@ -1123,6 +1123,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
 		 */
 		if (state->link_status != DRM_LINK_STATUS_GOOD)
 			state->link_status = val;
+	} else if (property == config->hdmi_output_property) {
+		state->hdmi_output = val;
 	} else if (connector->funcs->atomic_set_property) {
 		return connector->funcs->atomic_set_property(connector,
 				state, property, val);
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 8be9719..fcba3c0 100644
@@ -567,6 +567,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 			if (old_connector_state->link_status !=
 			    new_connector_state->link_status)
 				new_crtc_state->connectors_changed = true;
+
+			if (old_connector_state->hdmi_output !=
+			    new_connector_state->hdmi_output)
+				new_crtc_state->connectors_changed = true;
 		}
 
 		if (funcs->atomic_check)
drivers/gpu/drm/drm_connector.c +31 -0
index 9f84761..10201b1 100644
@@ -227,6 +227,11 @@ int drm_connector_init(struct drm_device *dev,
 					      config->edid_property,
 					      0);
 
+	if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
+		drm_object_attach_property(&connector->base,
+					   config->hdmi_output_property,
+					   0);
+
 	drm_object_attach_property(&connector->base,
 				      config->dpms_property, 0);
 
@@ -617,6 +622,25 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
 };
 DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
 
+static const struct drm_prop_enum_list drm_hdmi_output_enum_list[] = {
+	{ DRM_HDMI_OUTPUT_DEFAULT_RGB, "output_rgb" },
+	{ DRM_HDMI_OUTPUT_YCBCR422, "output_ycbcr422" },
+	{ DRM_HDMI_OUTPUT_YCBCR444, "output_ycbcr444" },
+	{ DRM_HDMI_OUTPUT_YCBCR420, "output_ycbcr420" },
+	{ DRM_HDMI_OUTPUT_YCBCR_HQ, "output_ycbcr_high_subsampling" },
+	{ DRM_HDMI_OUTPUT_YCBCR_LQ, "output_ycbcr_low_subsampling" },
+};
+
+/**
+ * drm_get_hdmi_output_name - return a string for a given hdmi output enum
+ * @type: enum of output type
+ */
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type)
+{
+	return drm_hdmi_output_enum_list[type].name;
+}
+EXPORT_SYMBOL(drm_get_hdmi_output_name);
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -789,6 +813,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.link_status_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "hdmi_output_format",
+					drm_hdmi_output_enum_list,
+					ARRAY_SIZE(drm_hdmi_output_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.hdmi_output_property = prop;
+
 	return 0;
 }
 
include/drm/drm_connector.h +14 -0
index 4545c6e..e872a88 100644
@@ -300,6 +300,17 @@ struct drm_tv_connector_state {
 	unsigned int hue;
 };
 
+/* HDMI output pixel format */
+enum drm_hdmi_output_type {
+	DRM_HDMI_OUTPUT_DEFAULT_RGB, /* default RGB */
+	DRM_HDMI_OUTPUT_YCBCR422, /* YCBCR 422 */
+	DRM_HDMI_OUTPUT_YCBCR444, /* YCBCR 444 */
+	DRM_HDMI_OUTPUT_YCBCR420, /* YCBCR 420 */
+	DRM_HDMI_OUTPUT_YCBCR_HQ, /* Highest subsampled YUV */
+	DRM_HDMI_OUTPUT_YCBCR_LQ, /* Lowest subsampled YUV */
+	DRM_HDMI_OUTPUT_INVALID, /* Guess what ? */
+};
+
 /**
  * struct drm_connector_state - mutable connector state
  * @connector: backpointer to the connector
@@ -329,6 +340,8 @@ struct drm_connector_state {
 	struct drm_atomic_state *state;
 
 	struct drm_tv_connector_state tv;
+
+	enum drm_hdmi_output_type hdmi_output;
 };
 
 /**
@@ -945,6 +958,7 @@ static inline void drm_connector_unreference(struct drm_connector *connector)
 
 const char *drm_get_connector_status_name(enum drm_connector_status status);
 const char *drm_get_subpixel_order_name(enum subpixel_order order);
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type);
 const char *drm_get_dpms_name(int val);
 const char *drm_get_dvi_i_subconnector_name(int val);
 const char *drm_get_dvi_i_select_name(int val);
include/drm/drm_mode_config.h +0 -0
index 4298171..1887261 100644
@@ -740,6 +740,11 @@ struct drm_mode_config {
 	 * the position of the output on the host's screen.

include/drm/drm_mode_config.h struct drm_mode_config { · line 750

Quoted 10 lines
include/drm/drm_mode_config.h +5 -0
 	 */
 	struct drm_property *suggested_y_property;
+	/**
+	 * @hdmi_output_property: output pixel format from HDMI display
+	 * Default is set for RGB
+	 */
+	struct drm_property *hdmi_output_property;
 
 	/* dumb ioctl parameters */
 	uint32_t preferred_depth, prefer_shadow;

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

#25 lore raw

Re: [PATCH 06/11] drm: create hdmi output property

Hello Jose,

Sorry for delay in response, I was on vacation.
Please find my comments inline.

Regards
Shashank

Quoted 30 lines · Jose Abreu

Hi Shashank,

Quoted 26 lines · Shashank Sharma

HDMI displays can support various output types, based on the color space and subsampling type. The possible outputs from a HDMI 2.0 monitor could be:
- RGB
- YCBCR 444
- YCBCR 422
- YCBCR 420

This patch adds a drm property, using which, a userspace can specify its preference, for the HDMI output type.
The output type enums are similar to the mentioned outputs above. To handle various subsampling of YCBCR output types, this property allows two special cases:
- DRM_HDMI_OUTPUT_YCBCR_HQ
This indicates preferred output should be YCBCR output, with highest subsampling rate by the source/sink, which can be typically:
- ycbcr444
- ycbcr422
- ycbcr420
- DRM_HDMI_OUTPUT_YCBCR_LQ
This indicates preferred output should be YCBCR output, with lowest subsampling rate supported by source/sink, which can be:
- ycbcr420
- ycbcr422
- ycbcr444

Quoted 3 lines
Quoted 2 lines

Default value of the property is set to 0 = RGB, so no changes if you dont set the property.

The HQ/LQ properties are a nice idea

Courtesy Ville :)

Quoted 3 lines

but where are you parsing
them (because in patch 07/11 you reject these properties)? Also, you need to make sure that source and sink supports the color space.

Yes, and that's why its handling is kept in the core driver. If you see my I915 patches, I have parsed and handled the HQ and LQ properties in intel_hdmi_compute_ycbcr_config function. I am rejecting the HQ/LQ in 07/11, coz by the time we want to set AVI_IF the driver should have picked the highest/lowest YCBCR mode, and now we should have a definite one out of 444,422 or 420.

Do you think it would be a good idea to find the HQ/LQ YCBCR output in DRM layer ? In that case it would be difficult if source supports these outputs

- Shashank

Quoted 152 lines

Best regards,
Jose Miguel Abreu

Quoted 149 lines
Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/drm_atomic.c        |  2 ++
  drivers/gpu/drm/drm_atomic_helper.c |  4 ++++
  drivers/gpu/drm/drm_connector.c     | 31 +++++++++++++++++++++++++++++++
  include/drm/drm_connector.h         | 14 ++++++++++++++
  include/drm/drm_mode_config.h       |  5 +++++
  5 files changed, 56 insertions(+)
drivers/gpu/drm/drm_atomic.c +2 -0
index f32506a..6ef34dc 100644
@@ -1123,6 +1123,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
  		 */
  		if (state->link_status != DRM_LINK_STATUS_GOOD)
  			state->link_status = val;
+	} else if (property == config->hdmi_output_property) {
+		state->hdmi_output = val;
  	} else if (connector->funcs->atomic_set_property) {
  		return connector->funcs->atomic_set_property(connector,
  				state, property, val);
drivers/gpu/drm/drm_atomic_helper.c +4 -0
index 8be9719..fcba3c0 100644
@@ -567,6 +567,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
  			if (old_connector_state->link_status !=
  			    new_connector_state->link_status)
  				new_crtc_state->connectors_changed = true;
+
+			if (old_connector_state->hdmi_output !=
+			    new_connector_state->hdmi_output)
+				new_crtc_state->connectors_changed = true;
  		}
 
  		if (funcs->atomic_check)
drivers/gpu/drm/drm_connector.c +31 -0
index 9f84761..10201b1 100644
@@ -227,6 +227,11 @@ int drm_connector_init(struct drm_device *dev,
  					      config->edid_property,
  					      0);
 
+	if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
+		drm_object_attach_property(&connector->base,
+					   config->hdmi_output_property,
+					   0);
+
  	drm_object_attach_property(&connector->base,
  				      config->dpms_property, 0);
 
@@ -617,6 +622,25 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
  };
  DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
 
+static const struct drm_prop_enum_list drm_hdmi_output_enum_list[] = {
+	{ DRM_HDMI_OUTPUT_DEFAULT_RGB, "output_rgb" },
+	{ DRM_HDMI_OUTPUT_YCBCR422, "output_ycbcr422" },
+	{ DRM_HDMI_OUTPUT_YCBCR444, "output_ycbcr444" },
+	{ DRM_HDMI_OUTPUT_YCBCR420, "output_ycbcr420" },
+	{ DRM_HDMI_OUTPUT_YCBCR_HQ, "output_ycbcr_high_subsampling" },
+	{ DRM_HDMI_OUTPUT_YCBCR_LQ, "output_ycbcr_low_subsampling" },
+};
+
+/**
+ * drm_get_hdmi_output_name - return a string for a given hdmi output enum
+ * @type: enum of output type
+ */
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type)
+{
+	return drm_hdmi_output_enum_list[type].name;
+}
+EXPORT_SYMBOL(drm_get_hdmi_output_name);
+
  /**
   * drm_display_info_set_bus_formats - set the supported bus formats
   * @info: display info to store bus formats in
@@ -789,6 +813,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
  		return -ENOMEM;
  	dev->mode_config.link_status_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "hdmi_output_format",
+					drm_hdmi_output_enum_list,
+					ARRAY_SIZE(drm_hdmi_output_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.hdmi_output_property = prop;
+
  	return 0;
  }
 
include/drm/drm_connector.h +14 -0
index 4545c6e..e872a88 100644
@@ -300,6 +300,17 @@ struct drm_tv_connector_state {
  	unsigned int hue;
  };
 
+/* HDMI output pixel format */
+enum drm_hdmi_output_type {
+	DRM_HDMI_OUTPUT_DEFAULT_RGB, /* default RGB */
+	DRM_HDMI_OUTPUT_YCBCR422, /* YCBCR 422 */
+	DRM_HDMI_OUTPUT_YCBCR444, /* YCBCR 444 */
+	DRM_HDMI_OUTPUT_YCBCR420, /* YCBCR 420 */
+	DRM_HDMI_OUTPUT_YCBCR_HQ, /* Highest subsampled YUV */
+	DRM_HDMI_OUTPUT_YCBCR_LQ, /* Lowest subsampled YUV */
+	DRM_HDMI_OUTPUT_INVALID, /* Guess what ? */
+};
+
  /**
   * struct drm_connector_state - mutable connector state
   * @connector: backpointer to the connector
@@ -329,6 +340,8 @@ struct drm_connector_state {
  	struct drm_atomic_state *state;
 
  	struct drm_tv_connector_state tv;
+
+	enum drm_hdmi_output_type hdmi_output;
  };
 
  /**
@@ -945,6 +958,7 @@ static inline void drm_connector_unreference(struct drm_connector *connector)
 
  const char *drm_get_connector_status_name(enum drm_connector_status status);
  const char *drm_get_subpixel_order_name(enum subpixel_order order);
+const char *drm_get_hdmi_output_name(enum drm_hdmi_output_type type);
  const char *drm_get_dpms_name(int val);
  const char *drm_get_dvi_i_subconnector_name(int val);
  const char *drm_get_dvi_i_select_name(int val);
include/drm/drm_mode_config.h +5 -0
index 4298171..1887261 100644
@@ -740,6 +740,11 @@ struct drm_mode_config {
  	 * the position of the output on the host's screen.
  	 */
  	struct drm_property *suggested_y_property;
+	/**
+	 * @hdmi_output_property: output pixel format from HDMI display
+	 * Default is set for RGB
+	 */
+	struct drm_property *hdmi_output_property;
 
Quoted 2 lines

include/drm/drm_mode_config.h struct drm_mode_config { · line 750

Quoted 2 lines
include/drm/drm_mode_config.h +0 -0
  	/* dumb ioctl parameters */
  	uint32_t preferred_depth, prefer_shadow;

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

#26 lore raw

PATCH 7/11 drm: set output colorspace in AVI infoframe

In reply to Shashank Sharma

HDMI source must set output colorspace information in AVI infoframes, so that the sink can decode upcoming frames accordingly.

As this patch series is adding support for HDMI output modes other than RGB, this patch adds a function in DRM layer, to add the output colorspace information in the AVI infoframes.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |  5 +++++
 2 files changed, 45 insertions(+)
drivers/gpu/drm/drm_edid.c +40 -0
index 828b781..a02d35b 100644
@@ -4734,6 +4734,46 @@ 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_set_colorspace() - fill an HDMI AVI infoframe with
+ * colorspace data of the output type
+ *
+ * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
+ * @hdmi_output: HDMI output colorspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output)
+{
+	switch (hdmi_output) {
+	case DRM_HDMI_OUTPUT_YCBCR444:
+		frame->colorspace = HDMI_COLORSPACE_YUV444;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR422:
+		frame->colorspace = HDMI_COLORSPACE_YUV422;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR420:
+		frame->colorspace = HDMI_COLORSPACE_YUV420;
+		frame->pixel_repeat = 0;
+		break;
+	case DRM_HDMI_OUTPUT_DEFAULT_RGB:
+		frame->colorspace = HDMI_COLORSPACE_RGB;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR_HQ:
+	case DRM_HDMI_OUTPUT_YCBCR_LQ:
+	case DRM_HDMI_OUTPUT_INVALID:
+		DRM_ERROR("Invalid HDMI output type\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_set_colorspace);
+
+/**
  * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
  *                                        quantization range information
  * @frame: HDMI AVI infoframe
include/drm/drm_edid.h +5 -0
index a4d174e7..8980366 100644
@@ -329,6 +329,7 @@ struct cea_sad {
 struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
+enum drm_hdmi_output_type;
 
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
@@ -351,6 +352,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 					 const struct drm_display_mode *mode,
 					 bool is_hdmi2);
 int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output);
+int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
 void
Signature · 6 lines
2.7.4

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

Re: [PATCH 07/11] drm: set output colorspace in AVI infoframe

Hi Shashank,

Quoted 38 lines · Shashank Sharma

HDMI source must set output colorspace information in AVI infoframes, so that the sink can decode upcoming frames accordingly.

As this patch series is adding support for HDMI output modes other than RGB, this patch adds a function in DRM layer, to add the output colorspace information in the AVI infoframes.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_edid.h     |  5 +++++
 2 files changed, 45 insertions(+)
drivers/gpu/drm/drm_edid.c +14 -0
index 828b781..a02d35b 100644
@@ -4734,6 +4734,46 @@ 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_set_colorspace() - fill an HDMI AVI infoframe with
+ * colorspace data of the output type
+ *
+ * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
+ * @hdmi_output: HDMI output colorspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output)
+{

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

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10 -0
+	switch (hdmi_output) {
+	case DRM_HDMI_OUTPUT_YCBCR444:
+		frame->colorspace = HDMI_COLORSPACE_YUV444;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR422:
+		frame->colorspace = HDMI_COLORSPACE_YUV422;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR420:
+		frame->colorspace = HDMI_COLORSPACE_YUV420;
+		frame->pixel_repeat = 0;

Why only 4:2:0 is set with pixel repetition off? Is this per spec?

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

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		break;
+	case DRM_HDMI_OUTPUT_DEFAULT_RGB:
+		frame->colorspace = HDMI_COLORSPACE_RGB;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR_HQ:
+	case DRM_HDMI_OUTPUT_YCBCR_LQ:
+	case DRM_HDMI_OUTPUT_INVALID:

Maybe default to RGB here? I don't know if spec says anything about sending empty colorspace field.

Best regards,
Jose Miguel Abreu

Quoted 25 lines
drivers/gpu/drm/drm_edid.c +9 -0
+		DRM_ERROR("Invalid HDMI output type\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_set_colorspace);
+
+/**
  * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
  *                                        quantization range information
  * @frame: HDMI AVI infoframe
include/drm/drm_edid.h +1 -0
index a4d174e7..8980366 100644
@@ -329,6 +329,7 @@ struct cea_sad {
 struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
+enum drm_hdmi_output_type;
 
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);

include/drm/drm_edid.h drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 361

Quoted 10 lines
include/drm/drm_edid.h +4 -0
@@ -351,6 +352,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
 					 const struct drm_display_mode *mode,
 					 bool is_hdmi2);
 int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output);
+int
 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
 					    const struct drm_display_mode *mode);
 void

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

#28 lore raw

Re: [PATCH 07/11] drm: set output colorspace in AVI infoframe

Regards

Shashank

Quoted 45 lines · Jose Abreu

Hi Shashank,

Quoted 41 lines · Shashank Sharma

HDMI source must set output colorspace information in AVI infoframes, so that the sink can decode upcoming frames accordingly.

As this patch series is adding support for HDMI output modes other than RGB, this patch adds a function in DRM layer, to add the output colorspace information in the AVI infoframes.

Cc Ville Syrjala <[email protected]>
Cc Jose Abreu <[email protected]>
---
  drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++++++++++++++++++++++
  include/drm/drm_edid.h     |  5 +++++
  2 files changed, 45 insertions(+)
drivers/gpu/drm/drm_edid.c +17 -0
index 828b781..a02d35b 100644
@@ -4734,6 +4734,46 @@ 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_set_colorspace() - fill an HDMI AVI infoframe with
+ * colorspace data of the output type
+ *
+ * @frame: HDMI AVI infoframe
+ * @mode: DRM display mode
+ * @hdmi_output: HDMI output colorspace
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output)
+{
+	switch (hdmi_output) {
+	case DRM_HDMI_OUTPUT_YCBCR444:
+		frame->colorspace = HDMI_COLORSPACE_YUV444;
Quoted 8 lines

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

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR422:
+		frame->colorspace = HDMI_COLORSPACE_YUV422;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR420:
+		frame->colorspace = HDMI_COLORSPACE_YUV420;
+		frame->pixel_repeat = 0;

Why only 4:2:0 is set with pixel repetition off? Is this per spec?

Yes, the HDMI 2.0/CEA-861-F mandates the source to turn off pixel repetition for YCBCR420 output.

Quoted 9 lines

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

Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7 -0
+		break;
+	case DRM_HDMI_OUTPUT_DEFAULT_RGB:
+		frame->colorspace = HDMI_COLORSPACE_RGB;
+		break;
+	case DRM_HDMI_OUTPUT_YCBCR_HQ:
+	case DRM_HDMI_OUTPUT_YCBCR_LQ:
+	case DRM_HDMI_OUTPUT_INVALID:

Maybe default to RGB here? I don't know if spec says anything about sending empty colorspace field.

Actually, by default the enum value for RGB is 0, that's why we were not setting this field at all, as there was only RGB output. case HQ/LQ indicate that user wanted to have YCBCR output (but it should have never reached this point), so I am not sure if its good idea to default to RGB, or is it :) ? lets hear from others too.

- Shashank

Quoted 25 lines

Best regards,
Jose Miguel Abreu

Quoted 22 lines
drivers/gpu/drm/drm_edid.c +9 -0
+		DRM_ERROR("Invalid HDMI output type\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdmi_avi_infoframe_set_colorspace);
+
+/**
   * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
   *                                        quantization range information
   * @frame: HDMI AVI infoframe
include/drm/drm_edid.h +1 -0
index a4d174e7..8980366 100644
@@ -329,6 +329,7 @@ struct cea_sad {
  struct drm_encoder;
  struct drm_connector;
  struct drm_display_mode;
+enum drm_hdmi_output_type;
 
Quoted 13 lines

include/drm/drm_edid.h drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, · line 361

Quoted 13 lines
include/drm/drm_edid.h +4 -0
  void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
  int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
@@ -351,6 +352,10 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
  					 const struct drm_display_mode *mode,
  					 bool is_hdmi2);
  int
+drm_hdmi_avi_infoframe_set_colorspace(struct hdmi_avi_infoframe *frame,
+					 const struct drm_display_mode *mode,
+					 enum drm_hdmi_output_type hdmi_output);
+int
  drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
  					    const struct drm_display_mode *mode);
  void

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

#29 lore raw

PATCH 8/11 drm/i915: handle ycbcr outputs

In reply to Shashank Sharma

This patch adds support for HDMI ycbcr outputs in i915 layer. HDMI output mode is a connector property, this patch checks if source and sink can support the HDMI output type selected by user. And if they both can, it commits the hdmi output type into crtc state, for further staging in driver.

Cc Ville Syrjala <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ander Conselvan De Oliveira <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c |   1 +
 drivers/gpu/drm/i915/intel_drv.h     |   3 +
 drivers/gpu/drm/i915/intel_hdmi.c    | 161 ++++++++++++++++++++++++++++++++++-
 3 files changed, 162 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index b6b40cd..fc43a28 100644
@@ -11705,6 +11705,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
 	PIPE_CONF_CHECK_I(hdmi_scrambling);
 	PIPE_CONF_CHECK_I(hdmi_high_tmds_clock_ratio);
 	PIPE_CONF_CHECK_I(has_infoframe);
+	PIPE_CONF_CHECK_I(hdmi_output);
 
 	PIPE_CONF_CHECK_I(has_audio);
 
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 43ea748..98902d4 100644
@@ -738,6 +738,9 @@ struct intel_crtc_state {
 
 	/* HDMI High TMDS char rate ratio */
 	bool hdmi_high_tmds_clock_ratio;
+
+	/* HDMI output type */
+	enum drm_hdmi_output_type hdmi_output;
 };
 
 struct intel_crtc {
drivers/gpu/drm/i915/intel_hdmi.c +158 -3

197 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

PATCH 9/11 drm/i915: handle csc for ycbcr HDMI output

In reply to Shashank Sharma

To support ycbcr HDMI output, we need a pipe CSC block to do the RGB->YCBCR conversion, as the blender output is in RGB.

Current Intel platforms have only one pipe CSC unit, so we can either do color correction using it, or we can perform RGB->YCBCR conversion.

This function adds a csc handler, to perform RGB->YCBCR conversion as per recommended spec values.

Cc Ville Syrjala <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Ander Conselvan De Oliveira <[email protected]>
---
 drivers/gpu/drm/i915/intel_color.c   | 49 +++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_display.c | 32 +++++++++++++++++++++++
 2 files changed, 80 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_color.c +48 -1
index 306c6b0..e677996 100644
@@ -41,6 +41,21 @@
 
 #define LEGACY_LUT_LENGTH		(sizeof(struct drm_color_lut) * 256)
 
+/* Post offset values for RGB->YCBCR conversion */
+#define POSTOFF_RGB_TO_YUV_HI 0x800
+#define POSTOFF_RGB_TO_YUV_ME 0x100
+#define POSTOFF_RGB_TO_YUV_LO 0x800
+
+/* Direct spec values for RGB->YUV conversion matrix */
+#define CSC_RGB_TO_YUV_RU_GU 0x2D980B70
+#define CSC_RGB_TO_YUV_BU 0x39400000
+
+#define CSC_RGB_TO_YUV_RY_GY 0xBEA89C58
+#define CSC_RGB_TO_YUV_BY 0x08000000
+
+#define CSC_RGB_TO_YUV_RV_GV 0x08009E88
+#define CSC_RGB_TO_YUV_BV 0xB25E0000
+
 /*
  * Extract the CSC coefficient from a CTM coefficient (in U32.32 fixed point
  * format). This macro takes the coefficient we want transformed and the
@@ -91,6 +106,35 @@ static void ctm_mult_by_limited(uint64_t *result, int64_t *input)
 	}
 }
 
+void i9xx_load_ycbcr_conversion_matrix(struct intel_crtc *intel_crtc)
+{
+	int pipe = intel_crtc->pipe;
+	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
+
+	/* We don't use high values for conversion */
+	I915_WRITE(PIPE_CSC_PREOFF_HI(pipe), 0);
+	I915_WRITE(PIPE_CSC_PREOFF_ME(pipe), 0);
+	I915_WRITE(PIPE_CSC_PREOFF_LO(pipe), 0);
+
+	/* Program direct spec values for RGB to YCBCR conversion matrix */
+	I915_WRITE(PIPE_CSC_COEFF_RU_GU(pipe), CSC_RGB_TO_YUV_RU_GU);
+	I915_WRITE(PIPE_CSC_COEFF_BU(pipe), CSC_RGB_TO_YUV_BU);
+
+	I915_WRITE(PIPE_CSC_COEFF_RY_GY(pipe), CSC_RGB_TO_YUV_RY_GY);
+	I915_WRITE(PIPE_CSC_COEFF_BY(pipe), CSC_RGB_TO_YUV_BY);
+
+	I915_WRITE(PIPE_CSC_COEFF_RV_GV(pipe), CSC_RGB_TO_YUV_RV_GV);
+	I915_WRITE(PIPE_CSC_COEFF_BV(pipe), CSC_RGB_TO_YUV_BV);
+
+	/* Spec postoffset values */
+	I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), POSTOFF_RGB_TO_YUV_HI);
+	I915_WRITE(PIPE_CSC_POSTOFF_ME(pipe), POSTOFF_RGB_TO_YUV_ME);
+	I915_WRITE(PIPE_CSC_POSTOFF_LO(pipe), POSTOFF_RGB_TO_YUV_LO);
+
+	/* CSC mode before gamma */
+	I915_WRITE(PIPE_CSC_MODE(pipe), 0);
+}
+
 /* Set up the pipe CSC unit. */
 static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state)
 {
@@ -101,7 +145,10 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state)
 	uint16_t coeffs[9] = { 0, };
 	struct intel_crtc_state *intel_crtc_state = to_intel_crtc_state(crtc_state);
 
-	if (crtc_state->ctm) {
+	if (intel_crtc_state->hdmi_output) {
+		i9xx_load_ycbcr_conversion_matrix(intel_crtc);
+		return;
+	} else if (crtc_state->ctm) {
 		struct drm_color_ctm *ctm =
 			(struct drm_color_ctm *)crtc_state->ctm->data;
 		uint64_t input[9] = { 0, };
drivers/gpu/drm/i915/intel_display.c +32 -0
index fc43a28..b03e5f3 100644
@@ -6206,6 +6206,29 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
 			ilk_pipe_pixel_rate(crtc_state);
 }
 
+static int intel_crtc_ycbcr_config(struct intel_crtc_state *state)
+{
+	struct drm_crtc_state *drm_state = &state->base;
+	struct drm_i915_private *dev_priv = to_i915(drm_state->crtc->dev);
+
+	/* YCBCR420 is supported only in HDMI 2.0 controllers */
+	if ((state->hdmi_output == DRM_HDMI_OUTPUT_YCBCR420) &&
+		!IS_GEMINILAKE(dev_priv)) {
+		DRM_ERROR("YCBCR420 output is not supported\n");
+		return -EINVAL;
+	}
+
+	/* We need CSC for output conversion from RGB->YCBCR */
+	if (drm_state->ctm) {
+		DRM_ERROR("YCBCR output and CTM is not possible together\n");
+		return -EINVAL;
+	}
+
+	DRM_DEBUG_DRIVER("Output %s can be supported\n",
+			 drm_get_hdmi_output_name(state->hdmi_output));
+	return 0;
+}
+
 static int intel_crtc_compute_config(struct intel_crtc *crtc,
 				     struct intel_crtc_state *pipe_config)
 {
@@ -6235,6 +6258,14 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
 		return -EINVAL;
 	}
 
+	/* YCBCR output check */
+	if (pipe_config->hdmi_output) {
+		if (intel_crtc_ycbcr_config(pipe_config)) {
+			DRM_ERROR("Cant enable HDMI YCBCR output\n");
+			return -EINVAL;
+		}
+	}
+
 	/*
 	 * Pipe horizontal size must be even in:
 	 * - DVO ganged mode
@@ -11392,6 +11423,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 			DRM_DEBUG_KMS("Encoder config failure\n");
 			goto fail;
 		}
+
 	}
 
 	/* Set default port clock if not overwritten by the encoder. Needs to be
Signature · 6 lines
2.7.4

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

PATCH 10/11 drm/i915: prepare ycbcr420 modeset

In reply to Shashank Sharma

To get a ycbcr420 output from intel platforms, there are two major steps:
- RGB->YCBCR conversion using a pipe CSC.
- Program PIPE_MISC register to generate a ycbcr420 output.
- Scaling down YCBCR444 samples to YCBCR420 samples using a pipe scaler.

This patch:
- Does scaler allocation for HDMI ycbcr420 outputs.
- Programs PIPE_MISC register for ycbcr420 output.
- Adds a new scaler user "HDMI output" to plug-into existing scaler framework. This output is identified with bit 30 of the scaler users bitmap.

Cc Ville Syrjala <[email protected]>
Cc Ander Conselvan De Oliveira <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h      |  3 +++
 drivers/gpu/drm/i915/intel_atomic.c  |  6 ++++++
 drivers/gpu/drm/i915/intel_display.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     | 10 +++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c    | 11 +++++++++++
 drivers/gpu/drm/i915/intel_panel.c   |  3 ++-
 6 files changed, 65 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 11b12f4..ecf28df 100644
@@ -5024,6 +5024,9 @@ enum {
 
 #define _PIPE_MISC_A			0x70030
 #define _PIPE_MISC_B			0x71030
+#define   PIPEMISC_YCBCR420_ENABLE	(1<<27)
+#define   PIPEMISC_YCBCR420_MODE_BLEND	(1<<26)
+#define   PIPEMISC_OUTPUT_YCBCR		(1<<11)
 #define   PIPEMISC_DITHER_BPC_MASK	(7<<5)
 #define   PIPEMISC_DITHER_8_BPC		(0<<5)
 #define   PIPEMISC_DITHER_10_BPC	(1<<5)
drivers/gpu/drm/i915/intel_atomic.c +6 -0
index 50fb1f7..592b0d2 100644
@@ -187,6 +187,12 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
 
 			/* panel fitter case: assign as a crtc scaler */
 			scaler_id = &scaler_state->scaler_id;
+		} else if (i == SKL_HDMI_OUTPUT_INDEX) {
+			name = "HDMI-OUTPUT";
+			idx = intel_crtc->base.base.id;
+
+			/* hdmi output case: needs a pipe scaler */
+			scaler_id = &scaler_state->scaler_id;
 		} else {
 			name = "PLANE";
 
drivers/gpu/drm/i915/intel_display.c +34 -0
index b03e5f3..5c4b342 100644
@@ -4611,6 +4611,11 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		(src_h != dst_w || src_w != dst_h):
 		(src_w != dst_w || src_h != dst_h);
 
+	if (crtc_state->hdmi_output == DRM_HDMI_OUTPUT_YCBCR420
+		&& scaler_user == SKL_HDMI_OUTPUT_INDEX)
+		/* YCBCR 444 -> 420 conversion needs a scaler */
+		need_scaling = true;
+
 	/*
 	 * if plane is being disabled or scaler is no more required or force detach
 	 *  - free scaler binded to this plane/crtc
@@ -4658,6 +4663,26 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 }
 
 /**
+ * skl_update_scaler_hdmi_output - Stages update to scaler state for HDMI.
+ * HDMI YCBCR 420 output needs a scaler, for downsampling.
+ *
+ * @state: crtc's scaler state
+ *
+ * Return
+ *     0 - scaler_usage updated successfully
+ *    error - requested scaling cannot be supported or other error condition
+ */
+int skl_update_scaler_crtc_hdmi_output(struct intel_crtc_state *state)
+{
+	const struct drm_display_mode *mode = &state->base.adjusted_mode;
+
+	return skl_update_scaler(state, !state->base.active,
+		SKL_HDMI_OUTPUT_INDEX, &state->scaler_state.scaler_id,
+		DRM_ROTATE_0, state->pipe_src_w, state->pipe_src_h,
+		mode->crtc_hdisplay, mode->crtc_vdisplay);
+}
+
+/**
  * skl_update_scaler_crtc - Stages update to scaler state for a given crtc.
  *
  * @state: crtc's scaler state
@@ -8053,6 +8078,7 @@ static void haswell_set_pipemisc(struct drm_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	enum drm_hdmi_output_type hdmi_out = intel_crtc->config->hdmi_output;
 
 	if (IS_BROADWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 9) {
 		u32 val = 0;
@@ -8078,6 +8104,14 @@ static void haswell_set_pipemisc(struct drm_crtc *crtc)
 		if (intel_crtc->config->dither)
 			val |= PIPEMISC_DITHER_ENABLE | PIPEMISC_DITHER_TYPE_SP;
 
+		if (hdmi_out) {
+			val |= PIPEMISC_OUTPUT_YCBCR;
+			if (hdmi_out == DRM_HDMI_OUTPUT_YCBCR420) {
+				val |= PIPEMISC_YCBCR420_ENABLE |
+				       PIPEMISC_YCBCR420_MODE_BLEND;
+			}
+		}
+
 		I915_WRITE(PIPEMISC(intel_crtc->pipe), val);
 	}
 }
drivers/gpu/drm/i915/intel_drv.h +9 -1
index 98902d4..2a336d7 100644
@@ -454,7 +454,8 @@ struct intel_crtc_scaler_state {
 	 *
 	 *     If a bit is set, a user is using a scaler.
 	 *     Here user can be a plane or crtc as defined below:
-	 *       bits 0-30 - plane (bit position is index from drm_plane_index)
+	 *       bits 0-29 - plane (bit position is index from drm_plane_index)
+	 *       bit 30    - hdmi output
 	 *       bit 31    - crtc
 	 *
 	 * Instead of creating a new index to cover planes and crtc, using
@@ -467,6 +468,12 @@ struct intel_crtc_scaler_state {
 	 * avilability.
 	 */
 #define SKL_CRTC_INDEX 31
+
+	/*
+	 * HDMI YCBCR 420 output consume a scaler. So adding a user
+	 * for HDMI output 420 requirement.
+	 */
+#define SKL_HDMI_OUTPUT_INDEX 30
 	unsigned scaler_users;
 
 	/* scaler used by crtc for panel fitting purpose */
@@ -1450,6 +1457,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
 				 struct intel_crtc_state *pipe_config);
 
 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
+int skl_update_scaler_crtc_hdmi_output(struct intel_crtc_state *state);
 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
 
 static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)
drivers/gpu/drm/i915/intel_hdmi.c +11 -0
index 40d3414..f0826a5 100644
@@ -1412,6 +1412,7 @@ intel_hdmi_compute_ycbcr_config(struct drm_connector_state *conn_state,
 {
 	struct drm_connector *connector = conn_state->connector;
 	struct drm_display_info *info = &connector->display_info;
+	struct intel_crtc *intel_crtc = to_intel_crtc(conn_state->crtc);
 	struct drm_display_mode *mode = &config->base.adjusted_mode;
 	enum drm_hdmi_output_type type = conn_state->hdmi_output;
 
@@ -1455,6 +1456,16 @@ intel_hdmi_compute_ycbcr_config(struct drm_connector_state *conn_state,
 		config->port_clock /= 2;
 		*clock_12bpc /= 2;
 		*clock_8bpc /= 2;
+
+		/* ycbcr 420 output conversion needs a scaler */
+		if (skl_update_scaler_crtc_hdmi_output(config)) {
+			DRM_ERROR("Scaler allocation for output failed\n");
+			return DRM_HDMI_OUTPUT_INVALID;
+		}
+
+		/* Bind this scaler to pipe */
+		intel_pch_panel_fitting(intel_crtc, config,
+					DRM_MODE_SCALE_FULLSCREEN);
 		break;
 
 	case DRM_HDMI_OUTPUT_YCBCR422:
drivers/gpu/drm/i915/intel_panel.c +2 -1
index cb50c52..b20aa1e 100644
@@ -110,7 +110,8 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc,
 
 	/* Native modes don't need fitting */
 	if (adjusted_mode->crtc_hdisplay == pipe_config->pipe_src_w &&
-	    adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h)
+	    adjusted_mode->crtc_vdisplay == pipe_config->pipe_src_h &&
+	    pipe_config->hdmi_output != DRM_HDMI_OUTPUT_YCBCR420)
 		goto done;
 
 	switch (fitting_mode) {
Signature · 6 lines
2.7.4

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

PATCH 11/11 drm/i915: set colorspace for ycbcr outputs

In reply to Shashank Sharma

When HDMI output is other than RGB, we have to load the corresponding colorspace of output mode. This patch fills the colorspace of AVI infoframe as per the HDMI output mode.

Cc Ville Syrjala <[email protected]>
Cc Ander Conselvan De Oliveira <[email protected]>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +8 -0
index f0826a5..6999f63 100644
@@ -472,6 +472,14 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 		return;
 	}
 
+	ret = drm_hdmi_avi_infoframe_set_colorspace(&frame.avi,
+						    adjusted_mode,
+						    crtc_state->hdmi_output);
+	if (ret < 0) {
+		DRM_ERROR("couldn't fill AVI colorspace\n");
+		return;
+	}
+
 	drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
 					   crtc_state->limited_color_range ?
 					   HDMI_QUANTIZATION_RANGE_LIMITED :
Signature · 6 lines
2.7.4

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

✓ Fi.CI.BAT: success for HDMI YCBCR output handling in DRM layer

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: HDMI YCBCR output handling in DRM layer
URL : https://patchwork.freedesktop.org/series/22684/
State : success

== Summary ==

Series 22684v1 HDMI YCBCR output handling in DRM layer
https://patchwork.freedesktop.org/api/1.0/series/22684/revisions/1/mbox/

Test gem_exec_fence:

        Subgroup await-hang-default:
                incomplete -> PASS       (fi-hsw-4770)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test kms_frontbuffer_tracking:
        Subgroup basic:
                notrun     -> INCOMPLETE (fi-hsw-4770)
                none       -> INCOMPLETE (fi-bxt-t5700)

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007

fi-bdw-5557u     total:215  pass:206  dwarn:0   dfail:0   fail:0   skip:8  
fi-bdw-gvtdvm    total:215  pass:203  dwarn:2   dfail:0   fail:0   skip:9  
fi-bsw-n3050     total:215  pass:194  dwarn:0   dfail:0   fail:0   skip:20 
fi-bxt-j4205     total:215  pass:198  dwarn:0   dfail:0   fail:0   skip:16 
fi-bxt-t5700     total:215  pass:197  dwarn:0   dfail:0   fail:0   skip:17 
fi-byt-j1900     total:215  pass:199  dwarn:0   dfail:0   fail:0   skip:15 
fi-byt-n2820     total:215  pass:195  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770      total:215  pass:201  dwarn:0   dfail:0   fail:0   skip:13 
fi-hsw-4770r     total:215  pass:201  dwarn:0   dfail:0   fail:0   skip:13 
fi-ilk-650       total:215  pass:177  dwarn:0   dfail:0   fail:0   skip:37 
fi-ivb-3520m     total:215  pass:201  dwarn:0   dfail:0   fail:0   skip:13 
fi-ivb-3770      total:215  pass:201  dwarn:0   dfail:0   fail:0   skip:13 
fi-kbl-7500u     total:215  pass:199  dwarn:0   dfail:0   fail:0   skip:15 
fi-kbl-7560u     total:215  pass:207  dwarn:0   dfail:0   fail:0   skip:7  
fi-skl-6260u     total:215  pass:207  dwarn:0   dfail:0   fail:0   skip:7  
fi-skl-6700hq    total:215  pass:199  dwarn:0   dfail:0   fail:0   skip:15 
fi-skl-6700k     total:215  pass:199  dwarn:0   dfail:0   fail:0   skip:15 
fi-skl-6770hq    total:215  pass:207  dwarn:0   dfail:0   fail:0   skip:7  
fi-skl-gvtdvm    total:215  pass:206  dwarn:0   dfail:0   fail:0   skip:8  
fi-snb-2520m     total:215  pass:196  dwarn:0   dfail:0   fail:0   skip:18 
fi-snb-2600      total:215  pass:195  dwarn:0   dfail:0   fail:1   skip:18 

50ff2d4f1de470b3ceb6f716a3f57c46f9d57d27 drm-tip: 2017y-04m-07d-16h-45m-21s UTC integration manifest 72a773c drm/i915: set colorspace for ycbcr outputs
1b04f64 drm/i915: prepare ycbcr420 modeset
6394179 drm/i915: handle csc for ycbcr HDMI output
08d812e drm/i915: handle ycbcr outputs
9625fc9 drm: set output colorspace in AVI infoframe
41749f5 drm: create hdmi output property
18177fb drm: parse ycbcr 420 deep color information
1cca36c drm: parse ycbcr420 vcb block
248afde drm: parse ycbcr 420 vdb block
ebf011b drm/edid: Complete CEA modedb(VIC 1-107)
035d93b drm: Add HDMI 2.0 VIC support for AVI info-frames

== Logs ==

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