diff mbox

drm/i915: Convert pxvid to extvid lookup table

Message ID 1417098192-26995-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Nov. 27, 2014, 2:23 p.m. UTC
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(-)

Comments

Shuang He Nov. 27, 2014, 10:03 p.m. UTC | #1
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                 -1              364/364              363/364
ILK              +1-9              365/366              357/366
SNB                                  450/450              450/450
IVB                                  498/498              498/498
BYT                                  289/289              289/289
HSW                 -1              564/564              563/564
BDW                                  417/417              417/417
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*PNV  igt_gem_concurrent_blit_gpu-bcs-gpu-read-after-write      PASS(2, M25M23)      NO_RESULT(1, M23)
*ILK  igt_kms_flip_nonblocking-read      PASS(2, M26)      DMESG_WARN(1, M26)
 ILK  igt_kms_flip_nonexisting-fb      DMESG_WARN(1, M26)PASS(2, M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_rcs-flip-vs-panning-interruptible      PASS(2, M26)      DMESG_WARN(1, M26)
 ILK  igt_kms_flip_rcs-wf_vblank-vs-dpms-interruptible      DMESG_WARN(1, M26)PASS(1, M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_blocking-absolute-wf_vblank-interruptible      NSPT(1, M26)PASS(1, M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_plain-flip-fb-recreate-interruptible      PASS(2, M26)      NSPT(1, M26)
*ILK  igt_kms_flip_plain-flip-ts-check-interruptible      PASS(2, M26)      DMESG_WARN(1, M26)
*ILK  igt_kms_flip_vblank-vs-hang      PASS(2, M26)      DMESG_WARN(1, M26)
 ILK  igt_kms_flip_wf_vblank-ts-check      DMESG_WARN(2, M26)PASS(2, M26M37)      PASS(1, M26)
 ILK  igt_kms_flip_wf_vblank-vs-modeset-interruptible      DMESG_WARN(1, M26)PASS(2, M26)      DMESG_WARN(1, M26)
*HSW  igt_kms_fence_pin_leak      PASS(2, M19M20)      DMESG_WARN(1, M20)
Note: You need to pay more attention to line start with '*'
Ville Syrjälä Nov. 28, 2014, 2:55 p.m. UTC | #2
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
Chris Wilson Nov. 28, 2014, 4:22 p.m. UTC | #3
On Fri, Nov 28, 2014 at 04:55:11PM +0200, Ville Syrjälä wrote:
> On Thu, Nov 27, 2014 at 04:23:12PM +0200, Mika Kuoppala wrote:
> > to a procedural to save space.

I really don't like this style of changelog (run on sentences from
the subject). For the benefit of verbosity, could you measure the impact
of the change in data/txt size.
-Chris
Daniel Vetter Nov. 28, 2014, 6:18 p.m. UTC | #4
On Fri, Nov 28, 2014 at 04:22:05PM +0000, Chris Wilson wrote:
> On Fri, Nov 28, 2014 at 04:55:11PM +0200, Ville Syrjälä wrote:
> > On Thu, Nov 27, 2014 at 04:23:12PM +0200, Mika Kuoppala wrote:
> > > to a procedural to save space.
> 
> I really don't like this style of changelog (run on sentences from
> the subject). For the benefit of verbosity, could you measure the impact
> of the change in data/txt size.

Yeah those stats would be nice to add to the commit message. Merged
meanwhile, but please follow up.

Thanks, Daniel
Jani Nikula Dec. 1, 2014, 9:48 a.m. UTC | #5
On Fri, 28 Nov 2014, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Fri, Nov 28, 2014 at 04:55:11PM +0200, Ville Syrjälä wrote:
>> On Thu, Nov 27, 2014 at 04:23:12PM +0200, Mika Kuoppala wrote:
>> > to a procedural to save space.
>
> I really don't like this style of changelog (run on sentences from
> the subject).

Agreed. In general, the commit message should make sense on its own,
without the subject line.

BR,
Jani.
diff mbox

Patch

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;
+}
+
+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)