All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Convert pxvid to extvid lookup table
Date: Fri, 28 Nov 2014 16:55:11 +0200	[thread overview]
Message-ID: <20141128145511.GS10649@intel.com> (raw)
In-Reply-To: <1417098192-26995-1-git-send-email-mika.kuoppala@intel.com>

On Thu, Nov 27, 2014 at 04:23:12PM +0200, Mika Kuoppala wrote:
> to a procedural to save space.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 155 +++++-----------------------------------
>  1 file changed, 18 insertions(+), 137 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 9af0af4..78911e2 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -5681,146 +5681,27 @@ unsigned long i915_mch_val(struct drm_i915_private *dev_priv)
>  	return ((m * x) / 127) - b;
>  }
>  
> -static u16 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid)
> +static int _pxvid_to_vd(u8 pxvid)
> +{
> +	if (pxvid == 0)
> +		return 0;
> +
> +	if (pxvid >= 8 && pxvid < 31)
> +		pxvid = 31;
> +
> +	return (pxvid + 2) * 125;
> +}

Seems simple enough as a function. I copy pasted the stuff into a small c
program and it confirmed that we get identical values from the old and
new code. So looks good.

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


> +
> +static u32 pvid_to_extvid(struct drm_i915_private *dev_priv, u8 pxvid)
>  {
>  	struct drm_device *dev = dev_priv->dev;
> -	static const struct v_table {
> -		u16 vd; /* in .1 mil */
> -		u16 vm; /* in .1 mil */
> -	} v_table[] = {
> -		{ 0, 0, },
> -		{ 375, 0, },
> -		{ 500, 0, },
> -		{ 625, 0, },
> -		{ 750, 0, },
> -		{ 875, 0, },
> -		{ 1000, 0, },
> -		{ 1125, 0, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4125, 3000, },
> -		{ 4250, 3125, },
> -		{ 4375, 3250, },
> -		{ 4500, 3375, },
> -		{ 4625, 3500, },
> -		{ 4750, 3625, },
> -		{ 4875, 3750, },
> -		{ 5000, 3875, },
> -		{ 5125, 4000, },
> -		{ 5250, 4125, },
> -		{ 5375, 4250, },
> -		{ 5500, 4375, },
> -		{ 5625, 4500, },
> -		{ 5750, 4625, },
> -		{ 5875, 4750, },
> -		{ 6000, 4875, },
> -		{ 6125, 5000, },
> -		{ 6250, 5125, },
> -		{ 6375, 5250, },
> -		{ 6500, 5375, },
> -		{ 6625, 5500, },
> -		{ 6750, 5625, },
> -		{ 6875, 5750, },
> -		{ 7000, 5875, },
> -		{ 7125, 6000, },
> -		{ 7250, 6125, },
> -		{ 7375, 6250, },
> -		{ 7500, 6375, },
> -		{ 7625, 6500, },
> -		{ 7750, 6625, },
> -		{ 7875, 6750, },
> -		{ 8000, 6875, },
> -		{ 8125, 7000, },
> -		{ 8250, 7125, },
> -		{ 8375, 7250, },
> -		{ 8500, 7375, },
> -		{ 8625, 7500, },
> -		{ 8750, 7625, },
> -		{ 8875, 7750, },
> -		{ 9000, 7875, },
> -		{ 9125, 8000, },
> -		{ 9250, 8125, },
> -		{ 9375, 8250, },
> -		{ 9500, 8375, },
> -		{ 9625, 8500, },
> -		{ 9750, 8625, },
> -		{ 9875, 8750, },
> -		{ 10000, 8875, },
> -		{ 10125, 9000, },
> -		{ 10250, 9125, },
> -		{ 10375, 9250, },
> -		{ 10500, 9375, },
> -		{ 10625, 9500, },
> -		{ 10750, 9625, },
> -		{ 10875, 9750, },
> -		{ 11000, 9875, },
> -		{ 11125, 10000, },
> -		{ 11250, 10125, },
> -		{ 11375, 10250, },
> -		{ 11500, 10375, },
> -		{ 11625, 10500, },
> -		{ 11750, 10625, },
> -		{ 11875, 10750, },
> -		{ 12000, 10875, },
> -		{ 12125, 11000, },
> -		{ 12250, 11125, },
> -		{ 12375, 11250, },
> -		{ 12500, 11375, },
> -		{ 12625, 11500, },
> -		{ 12750, 11625, },
> -		{ 12875, 11750, },
> -		{ 13000, 11875, },
> -		{ 13125, 12000, },
> -		{ 13250, 12125, },
> -		{ 13375, 12250, },
> -		{ 13500, 12375, },
> -		{ 13625, 12500, },
> -		{ 13750, 12625, },
> -		{ 13875, 12750, },
> -		{ 14000, 12875, },
> -		{ 14125, 13000, },
> -		{ 14250, 13125, },
> -		{ 14375, 13250, },
> -		{ 14500, 13375, },
> -		{ 14625, 13500, },
> -		{ 14750, 13625, },
> -		{ 14875, 13750, },
> -		{ 15000, 13875, },
> -		{ 15125, 14000, },
> -		{ 15250, 14125, },
> -		{ 15375, 14250, },
> -		{ 15500, 14375, },
> -		{ 15625, 14500, },
> -		{ 15750, 14625, },
> -		{ 15875, 14750, },
> -		{ 16000, 14875, },
> -		{ 16125, 15000, },
> -	};
> +	const int vd = _pxvid_to_vd(pxvid);
> +	const int vm = vd - 1125;
> +
>  	if (INTEL_INFO(dev)->is_mobile)
> -		return v_table[pxvid].vm;
> -	else
> -		return v_table[pxvid].vd;
> +		return vm > 0 ? vm : 0;
> +
> +	return vd;
>  }
>  
>  static void __i915_update_gfx_val(struct drm_i915_private *dev_priv)
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-11-28 14:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 14:23 [PATCH] drm/i915: Convert pxvid to extvid lookup table Mika Kuoppala
2014-11-27 22:03 ` shuang.he
2014-11-28 14:55 ` Ville Syrjälä [this message]
2014-11-28 16:22   ` Chris Wilson
2014-11-28 18:18     ` Daniel Vetter
2014-12-01  9:48     ` Jani Nikula
2014-12-01 16:01     ` [PATCH] drm/i915: Convert pxvid to extvid lookup table to a function Mika Kuoppala
2014-12-01 16:49       ` Daniel Vetter
2014-12-03  0:54       ` shuang.he

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=20141128145511.GS10649@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@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.