diff mbox series

[v3,4/9] common: edid: Search for valid timing in extension block

Message ID 20210422001434.11367-5-andre.przywara@arm.com
State Accepted
Delegated to: Anatolij Gustschin
Headers show
Series video: sunxi: rework DE2 driver | expand

Commit Message

Andre Przywara April 22, 2021, 12:14 a.m. UTC
From: Jernej Skrabec <jernej.skrabec@siol.net>

One of my monitors have only 4k@60 timing in base EDID block which is
out of range for devices with HDMI 1.4. It turns out that it has
additional detailed timings in CTA-861 Extension Block and two of them
are appropriate for HDMI 1.4.

Add additional search for valid detailed timing in extension block.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 common/edid.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Neil Armstrong May 3, 2021, 1 p.m. UTC | #1
Hi,

On 22/04/2021 02:14, Andre Przywara wrote:
> From: Jernej Skrabec <jernej.skrabec@siol.net>
> 
> One of my monitors have only 4k@60 timing in base EDID block which is
> out of range for devices with HDMI 1.4. It turns out that it has
> additional detailed timings in CTA-861 Extension Block and two of them
> are appropriate for HDMI 1.4.
> 
> Add additional search for valid detailed timing in extension block.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> Acked-by: Andre Przywara <andre.przywara@arm.com>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  common/edid.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/common/edid.c b/common/edid.c
> index a6c875d9c8e..14d8836c360 100644
> --- a/common/edid.c
> +++ b/common/edid.c
> @@ -220,6 +220,24 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
>  	/* Look for detailed timing in base EDID */
>  	found = edid_find_valid_timing(edid->monitor_details.descriptor, 4,
>  				       timing, mode_valid, mode_valid_priv);
> +
> +	/* Look for detailed timing in CTA-861 Extension Block */
> +	if (!found && edid->extension_flag && buf_size >= EDID_EXT_SIZE) {
> +		struct edid_cea861_info *info =
> +			(struct edid_cea861_info *)(buf + sizeof(*edid));
> +
> +		if (info->extension_tag == EDID_CEA861_EXTENSION_TAG) {
> +			int count = EDID_CEA861_DTD_COUNT(*info);
> +			int offset = info->dtd_offset;
> +			int size = count * sizeof(struct edid_detailed_timing);
> +
> +			if (offset >= 4 && offset + size < EDID_SIZE)
> +				found = edid_find_valid_timing(
> +					(u8*)info + offset, count, timing,
> +					mode_valid, mode_valid_priv);
> +		}
> +	}
> +
>  	if (!found)
>  		return -EINVAL;
>  
> 

Thanks for doing that, we had the same issue on Amlogic SoCs !

Neil
diff mbox series

Patch

diff --git a/common/edid.c b/common/edid.c
index a6c875d9c8e..14d8836c360 100644
--- a/common/edid.c
+++ b/common/edid.c
@@ -220,6 +220,24 @@  int edid_get_timing_validate(u8 *buf, int buf_size,
 	/* Look for detailed timing in base EDID */
 	found = edid_find_valid_timing(edid->monitor_details.descriptor, 4,
 				       timing, mode_valid, mode_valid_priv);
+
+	/* Look for detailed timing in CTA-861 Extension Block */
+	if (!found && edid->extension_flag && buf_size >= EDID_EXT_SIZE) {
+		struct edid_cea861_info *info =
+			(struct edid_cea861_info *)(buf + sizeof(*edid));
+
+		if (info->extension_tag == EDID_CEA861_EXTENSION_TAG) {
+			int count = EDID_CEA861_DTD_COUNT(*info);
+			int offset = info->dtd_offset;
+			int size = count * sizeof(struct edid_detailed_timing);
+
+			if (offset >= 4 && offset + size < EDID_SIZE)
+				found = edid_find_valid_timing(
+					(u8*)info + offset, count, timing,
+					mode_valid, mode_valid_priv);
+		}
+	}
+
 	if (!found)
 		return -EINVAL;