dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Dave Airlie <airlied@gmail.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/edid: move displayid tiled block parsing into separate function.
Date: Wed, 04 May 2016 11:04:19 +0300	[thread overview]
Message-ID: <87d1p2fdvg.fsf@intel.com> (raw)
In-Reply-To: <1462307812-3341-4-git-send-email-airlied@gmail.com>

On Tue, 03 May 2016, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> This just makes the code easier to follow.

Swapping the order of patches 2 and 3 would make the patch series easier
to follow. ;)

BR,
Jani.

>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 110 ++++++++++++++++++++++++---------------------
>  1 file changed, 59 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 1a364b3..e4c681f 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4152,6 +4152,60 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
>  }
>  EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode);
>  
> +static int drm_parse_tiled_block(struct drm_connector *connector,
> +				 struct displayid_block *block)
> +{
> +	struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block;
> +	u16 w, h;
> +	u8 tile_v_loc, tile_h_loc;
> +	u8 num_v_tile, num_h_tile;
> +	struct drm_tile_group *tg;
> +
> +	w = tile->tile_size[0] | tile->tile_size[1] << 8;
> +	h = tile->tile_size[2] | tile->tile_size[3] << 8;
> +
> +	num_v_tile = (tile->topo[0] & 0xf) | (tile->topo[2] & 0x30);
> +	num_h_tile = (tile->topo[0] >> 4) | ((tile->topo[2] >> 2) & 0x30);
> +	tile_v_loc = (tile->topo[1] & 0xf) | ((tile->topo[2] & 0x3) << 4);
> +	tile_h_loc = (tile->topo[1] >> 4) | (((tile->topo[2] >> 2) & 0x3) << 4);
> +
> +	connector->has_tile = true;
> +	if (tile->tile_cap & 0x80)
> +		connector->tile_is_single_monitor = true;
> +
> +	connector->num_h_tile = num_h_tile + 1;
> +	connector->num_v_tile = num_v_tile + 1;
> +	connector->tile_h_loc = tile_h_loc;
> +	connector->tile_v_loc = tile_v_loc;
> +	connector->tile_h_size = w + 1;
> +	connector->tile_v_size = h + 1;
> +
> +	DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap);
> +	DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1);
> +	DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n",
> +		      num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc);
> +	DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]);
> +
> +	tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
> +	if (!tg) {
> +		tg = drm_mode_create_tile_group(connector->dev, tile->topology_id);
> +	}
> +	if (!tg)
> +		return -ENOMEM;
> +
> +	if (connector->tile_group != tg) {
> +		/* if we haven't got a pointer,
> +		   take the reference, drop ref to old tile group */
> +		if (connector->tile_group) {
> +			drm_mode_put_tile_group(connector->dev, connector->tile_group);
> +		}
> +		connector->tile_group = tg;
> +	} else
> +		/* if same tile group, then release the ref we just took. */
> +		drm_mode_put_tile_group(connector->dev, tg);
> +	return 0;
> +}
> +
>  static int drm_parse_display_id(struct drm_connector *connector,
>  				u8 *displayid, int length,
>  				bool is_edid_extension)
> @@ -4162,6 +4216,7 @@ static int drm_parse_display_id(struct drm_connector *connector,
>  	struct displayid_block *block;
>  	u8 csum = 0;
>  	int i;
> +	int ret;
>  
>  	if (is_edid_extension)
>  		idx = 1;
> @@ -4192,57 +4247,10 @@ static int drm_parse_display_id(struct drm_connector *connector,
>  			      block->tag, block->rev, block->num_bytes);
>  
>  		switch (block->tag) {
> -		case DATA_BLOCK_TILED_DISPLAY: {
> -			struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block;
> -
> -			u16 w, h;
> -			u8 tile_v_loc, tile_h_loc;
> -			u8 num_v_tile, num_h_tile;
> -			struct drm_tile_group *tg;
> -
> -			w = tile->tile_size[0] | tile->tile_size[1] << 8;
> -			h = tile->tile_size[2] | tile->tile_size[3] << 8;
> -
> -			num_v_tile = (tile->topo[0] & 0xf) | (tile->topo[2] & 0x30);
> -			num_h_tile = (tile->topo[0] >> 4) | ((tile->topo[2] >> 2) & 0x30);
> -			tile_v_loc = (tile->topo[1] & 0xf) | ((tile->topo[2] & 0x3) << 4);
> -			tile_h_loc = (tile->topo[1] >> 4) | (((tile->topo[2] >> 2) & 0x3) << 4);
> -
> -			connector->has_tile = true;
> -			if (tile->tile_cap & 0x80)
> -				connector->tile_is_single_monitor = true;
> -
> -			connector->num_h_tile = num_h_tile + 1;
> -			connector->num_v_tile = num_v_tile + 1;
> -			connector->tile_h_loc = tile_h_loc;
> -			connector->tile_v_loc = tile_v_loc;
> -			connector->tile_h_size = w + 1;
> -			connector->tile_v_size = h + 1;
> -
> -			DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap);
> -			DRM_DEBUG_KMS("tile_size %d x %d\n", w + 1, h + 1);
> -			DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n",
> -			       num_h_tile + 1, num_v_tile + 1, tile_h_loc, tile_v_loc);
> -			DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]);
> -
> -			tg = drm_mode_get_tile_group(connector->dev, tile->topology_id);
> -			if (!tg) {
> -				tg = drm_mode_create_tile_group(connector->dev, tile->topology_id);
> -			}
> -			if (!tg)
> -				return -ENOMEM;
> -
> -			if (connector->tile_group != tg) {
> -				/* if we haven't got a pointer,
> -				   take the reference, drop ref to old tile group */
> -				if (connector->tile_group) {
> -					drm_mode_put_tile_group(connector->dev, connector->tile_group);
> -				}
> -				connector->tile_group = tg;
> -			} else
> -				/* if same tile group, then release the ref we just took. */
> -				drm_mode_put_tile_group(connector->dev, tg);
> -		}
> +		case DATA_BLOCK_TILED_DISPLAY:
> +			ret = drm_parse_tiled_block(connector, block);
> +			if (ret)
> +				return ret;
>  			break;
>  		default:
>  			DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block->tag);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-05-04  8:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 20:36 [rfc] drm/edid: add support for displayid timings Dave Airlie
2016-05-03 20:36 ` [PATCH 1/5] drm/displayid: Enhance version reporting Dave Airlie
2016-05-04  9:10   ` Ville Syrjälä
2016-05-09  9:52     ` Michel Dänzer
2016-05-10  1:16       ` Dave Airlie
2016-05-03 20:36 ` [PATCH 2/5] drm/displayid: Iterate over all DisplayID blocks Dave Airlie
2016-05-03 20:36 ` [PATCH 3/5] drm/edid: move displayid tiled block parsing into separate function Dave Airlie
2016-05-04  8:04   ` Jani Nikula [this message]
2016-05-03 20:36 ` [PATCH 4/5] drm/edid: move displayid validation to it's own function Dave Airlie
2016-05-03 20:36 ` [PATCH 5/5] drm/edid: add displayid detailed 1 timings to the modelist Dave Airlie
2016-05-04  8:10   ` Jani Nikula
2016-05-10  1:18     ` Dave Airlie

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=87d1p2fdvg.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox