diff mbox series

[v2,14/15] drm/edid: take HF-EEODB extension count into account

Message ID 6b9ba99d9cc269e05aecf29e81566fc8ce9745a6.1654674560.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/edid: expand on struct drm_edid usage | expand

Commit Message

Jani Nikula June 8, 2022, 7:50 a.m. UTC
Take the HF-EEODB extension count override into account.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Ville Syrjala June 10, 2022, 7:34 p.m. UTC | #1
On Wed, Jun 08, 2022 at 10:50:44AM +0300, Jani Nikula wrote:
> Take the HF-EEODB extension count override into account.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 5cac357e50b0..b7b1f0639115 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1629,6 +1629,19 @@ static int drm_edid_block_count(const struct drm_edid *drm_edid)
>  	/* Starting point */
>  	num_blocks = edid_block_count(drm_edid->edid);
>  
> +	/* HF-EEODB override */
> +	if (drm_edid->size >= edid_size_by_blocks(2)) {
> +		int eeodb;
> +
> +		/*
> +		 * Note: HF-EEODB may specify a smaller extension count than the
> +		 * regular one. Unlike in buffer allocation, here we can use it.
> +		 */

Such a sink would be in violation of the spec. But the spec does
explicitly say sources are to ignore the normal ext count in those
cases. So this would seem to do what the spec asks of us.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +		eeodb = edid_hfeeodb_block_count(drm_edid->edid);
> +		if (eeodb)
> +			num_blocks = eeodb;
> +	}
> +
>  	/* Limit by allocated size */
>  	num_blocks = min(num_blocks, (int)drm_edid->size / EDID_LENGTH);
>  
> -- 
> 2.30.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5cac357e50b0..b7b1f0639115 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1629,6 +1629,19 @@  static int drm_edid_block_count(const struct drm_edid *drm_edid)
 	/* Starting point */
 	num_blocks = edid_block_count(drm_edid->edid);
 
+	/* HF-EEODB override */
+	if (drm_edid->size >= edid_size_by_blocks(2)) {
+		int eeodb;
+
+		/*
+		 * Note: HF-EEODB may specify a smaller extension count than the
+		 * regular one. Unlike in buffer allocation, here we can use it.
+		 */
+		eeodb = edid_hfeeodb_block_count(drm_edid->edid);
+		if (eeodb)
+			num_blocks = eeodb;
+	}
+
 	/* Limit by allocated size */
 	num_blocks = min(num_blocks, (int)drm_edid->size / EDID_LENGTH);