Re: [Intel-gfx] [RFC v1 6/6] drm/edid: use the new displayid iterator for tile info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 09, 2021 at 03:54:14PM +0200, Jani Nikula wrote:
> Neatly reduce displayid boilerplate in code. Remove excessive debug
> logging while at it, no other functional changes.
> 
> The old displayid iterator becomes unused; remove it as well as make
> drm_find_displayid_extension() static.
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Hopeuflly you tested with some of those weird EDIDs with
multiple DisplayID and/or CEA blocks ;)

I was thinking we should try to coalesce an iterator for
the CEA stuff as well...

> ---
>  drivers/gpu/drm/drm_displayid.c |  6 +++---
>  drivers/gpu/drm/drm_edid.c      | 37 +++++++--------------------------
>  include/drm/drm_displayid.h     | 12 -----------
>  3 files changed, 10 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
> index 88070267aac9..b146f2d0d72a 100644
> --- a/drivers/gpu/drm/drm_displayid.c
> +++ b/drivers/gpu/drm/drm_displayid.c
> @@ -33,9 +33,9 @@ static int validate_displayid(const u8 *displayid, int length, int idx)
>  	return 0;
>  }
>  
> -const u8 *drm_find_displayid_extension(const struct edid *edid,
> -				       int *length, int *idx,
> -				       int *ext_index)
> +static const u8 *drm_find_displayid_extension(const struct edid *edid,
> +					      int *length, int *idx,
> +					      int *ext_index)
>  {
>  	const u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index);
>  	const struct displayid_hdr *base;
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 4526e2557dca..81d5f2524246 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -5969,43 +5969,20 @@ static void drm_parse_tiled_block(struct drm_connector *connector,
>  	}
>  }
>  
> -static void drm_displayid_parse_tiled(struct drm_connector *connector,
> -				      const u8 *displayid, int length, int idx)
> -{
> -	const struct displayid_block *block;
> -
> -	idx += sizeof(struct displayid_hdr);
> -	for_each_displayid_db(displayid, block, idx, length) {
> -		DRM_DEBUG_KMS("block id 0x%x, rev %d, len %d\n",
> -			      block->tag, block->rev, block->num_bytes);
> -
> -		switch (block->tag) {
> -		case DATA_BLOCK_TILED_DISPLAY:
> -			drm_parse_tiled_block(connector, block);
> -			break;
> -		default:
> -			DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block->tag);
> -			break;
> -		}
> -	}
> -}
> -
>  void drm_update_tile_info(struct drm_connector *connector,
>  			  const struct edid *edid)
>  {
> -	const void *displayid = NULL;
> -	int ext_index = 0;
> -	int length, idx;
> +	const struct displayid_block *block;
> +	struct displayid_iter iter;
>  
>  	connector->has_tile = false;
> -	for (;;) {
> -		displayid = drm_find_displayid_extension(edid, &length, &idx,
> -							 &ext_index);
> -		if (!displayid)
> -			break;
>  
> -		drm_displayid_parse_tiled(connector, displayid, length, idx);
> +	displayid_iter_edid_begin(edid, &iter);
> +	displayid_iter_for_each(block, &iter) {
> +		if (block->tag == DATA_BLOCK_TILED_DISPLAY)
> +			drm_parse_tiled_block(connector, block);
>  	}
> +	displayid_iter_end(&iter);
>  
>  	if (!connector->has_tile && connector->tile_group) {
>  		drm_mode_put_tile_group(connector->dev, connector->tile_group);
> diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h
> index 27e06c98db17..10ee863f1734 100644
> --- a/include/drm/drm_displayid.h
> +++ b/include/drm/drm_displayid.h
> @@ -96,18 +96,6 @@ struct displayid_detailed_timing_block {
>  	struct displayid_detailed_timings_1 timings[];
>  };
>  
> -#define for_each_displayid_db(displayid, block, idx, length) \
> -	for ((block) = (const struct displayid_block *)&(displayid)[idx]; \
> -	     (idx) + sizeof(struct displayid_block) <= (length) && \
> -	     (idx) + sizeof(struct displayid_block) + (block)->num_bytes <= (length) && \
> -	     (block)->num_bytes > 0; \
> -	     (idx) += sizeof(struct displayid_block) + (block)->num_bytes, \
> -	     (block) = (const struct displayid_block *)&(displayid)[idx])
> -
> -const u8 *drm_find_displayid_extension(const struct edid *edid,
> -				       int *length, int *idx,
> -				       int *ext_index);
> -
>  /* DisplayID iteration */
>  struct displayid_iter {
>  	const struct edid *edid;
> -- 
> 2.20.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux