All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: "Jani Nikula" <jani.nikula@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Fwd: [PATCH 1/3] drm/edid: Set 8 bpc color depth for displays with "DFP 1.x compliant TMDS".
Date: Fri, 6 May 2016 19:41:28 +0200	[thread overview]
Message-ID: <572CD748.2030103@gmail.com> (raw)
In-Reply-To: <1459122767-13314-2-git-send-email-mario.kleiner.de@gmail.com>




-------- Forwarded Message --------
Subject: [PATCH 1/3] drm/edid: Set 8 bpc color depth for displays with 
"DFP 1.x compliant TMDS".
Date: Mon, 28 Mar 2016 01:52:45 +0200
From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: dri-devel@lists.freedesktop.org
CC: mario.kleiner.de@gmail.com, Jani Nikula <jani.nikula@intel.com>, 
Ville Syrjälä <ville.syrjala@linux.intel.com>, stable@vger.kernel.org

According to E-EDID spec 1.3, table 3.9, a digital video sink with the
"DFP 1.x compliant TMDS" bit set is "signal compatible with VESA DFP 1.x
TMDS CRGB, 1 pixel / clock, up to 8 bits / color MSB aligned".

For such displays, the DFP spec 1.0, section 3.10 "EDID support" says:

"If the DFP monitor only supports EDID 1.X (1.1, 1.2, etc.)
  without extensions, the host will make the following assumptions:

  1. 24-bit MSB-aligned RGB TFT
  2. DE polarity is active high
  3. H and V syncs are active high
  4. Established CRT timings will be used
  5. Dithering will not be enabled on the host"

So if we don't know the bit depth of the display from additional
colorimetry info we should assume 8 bpc / 24 bpp with no dithering
by default.

This patch adds info->bpc = 8 assignement for that case.

Now the DVI 1.0 spec (section 2.2.11.2 "Monitor data format support")
mandates that "...If the monitor implements the EDID 2.0, 1.3 or newer
data structure the monitor may specify any data format that is definable
within the EDID data structure used. In all cases the monitor must support
the 24-bit MSB aligned RGB TFT data format as a minimum."

So any DVI display with EDID 1.3 should also have at least info->bpc = 8,
even if the "DFP 1.x compliant" bit isn't set, but in our EDID handling
we don't know if the EDID comes from a DVI display or something else. I
therefore don't know if it is safe to always assume 8 bpc for digital
inputs?

Most of my tested DVI sinks set the DFP bit, but one tested Dell panel
doesn't.

Lack of handling this correctly was exposed by commit 013dd9e03872
("drm/i915/dp: fall back to 18 bpp when sink capability is unknown")
which assumes that the sink capability is unknown if our edid handling
reports 0 bpc.

As we return bpc = 0 for such displays, that patch will cause a
degradation of output precison to 6 bpc for such displays on Intel hw
if they are connected via an active DP->dual-link DVI converter and
thereby treated as Displayport.

As that patch was backported to stable we should include this one
also in stable to fix the regression in color depth for such panels.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org
---
  drivers/gpu/drm/drm_edid.c | 31 ++++++++++++++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 414d7f6..ff28815 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3810,8 +3810,12 @@ static void drm_add_display_info(struct edid *edid,
  	if (edid->revision < 3)
  		return;

-	if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
+	if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) {
+		/* Analog sinks = infinite bpc, but driver decides */
+		DRM_DEBUG("%s: Assigning analog sink color depth as %d bpc.\n",
+			  connector->name, info->bpc);
  		return;
+	}

  	/* Get data from CEA blocks if present */
  	edid_ext = drm_find_cea_extension(edid);
@@ -3829,6 +3833,31 @@ static void drm_add_display_info(struct edid *edid,
  	/* HDMI deep color modes supported? Assign to info, if so */
  	drm_assign_hdmi_deep_color_info(edid, info, connector);

+	/*
+	 * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
+	 *
+	 * For such displays, the DFP spec 1.0, section 3.10 "EDID support"
+	 * says:
+	 *
+	 * "If the DFP monitor only supports EDID 1.X (1.1, 1.2, etc.)
+	 * without extensions, the host will make the following assumptions:
+	 *
+	 * 1. 24-bit MSB-aligned RGB TFT
+	 * 2. DE polarity is active high
+	 * 3. H and V syncs are active high
+	 * 4. Established CRT timings will be used
+	 * 5. Dithering will not be enabled on the host"
+	 *
+	 * So we use 8 bpc in this case and "no dithering" will hopefully
+	 * follow.
+	 */
+	if ((info->bpc == 0) && (edid->revision < 4) &&
+	    (edid->input & DRM_EDID_DIGITAL_TYPE_DVI)) {
+		info->bpc = 8;
+		DRM_DEBUG("%s: Assigning DFP/DVI sink color depth as %d bpc.\n",
+			  connector->name, info->bpc);
+	}
+
  	/* Only defined for 1.4 with digital displays */
  	if (edid->revision < 4)
  		return;
-- 
2.7.0



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-05-06 17:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-27 23:52 EDID/DP color precision fixes on Intel hw for stable Mario Kleiner
2016-03-27 23:52 ` [PATCH 1/3] drm/edid: Set 8 bpc color depth for displays with "DFP 1.x compliant TMDS" Mario Kleiner
2016-05-06 17:41   ` Mario Kleiner [this message]
2016-03-27 23:52 ` [PATCH 2/3] drm/i915/dp: Try to find proper bpc for DP->legacy converters Mario Kleiner
2016-05-06 17:42   ` Fwd: " Mario Kleiner
2016-03-27 23:52 ` [PATCH 3/3] drm/edid: Add 6 bpc quirk for display AEO model 0 Mario Kleiner
2016-05-06 17:43   ` Fwd: " Mario Kleiner
2016-05-06 17:40 ` EDID/DP color precision fixes on Intel hw for stable Mario Kleiner
2016-05-06 18:27 ` Ville Syrjälä
2016-05-06 20:03   ` Mario Kleiner
2016-05-07 18:15     ` Ville Syrjälä
2016-05-12 16:52       ` Mario Kleiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=572CD748.2030103@gmail.com \
    --to=mario.kleiner.de@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.