All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0
@ 2015-06-25 17:08 Damien Lespiau
  2015-06-26 17:18 ` Paulo Zanoni
  2015-06-29  4:57 ` [PATCH] " shuang.he
  0 siblings, 2 replies; 7+ messages in thread
From: Damien Lespiau @ 2015-06-25 17:08 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni

We can't improve a 0 deviation, so when we find such a divider, skip the
remaining ones they won't be better.

This short-circuit the search for 34 of the 373 test frequencies in the
corresponding i-g-t test (tools/skl_compute_wrpll)

Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
This patch has to be applied after patch 12 and 13 for the recent SKL DPLL
series.

 drivers/gpu/drm/i915/intel_ddi.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index f6b3ccc..45116d8 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1122,7 +1122,11 @@ static void skl_wrpll_context_init(struct skl_wrpll_context *ctx)
 #define SKL_DCO_MAX_PDEVIATION	100
 #define SKL_DCO_MAX_NDEVIATION	600
 
-static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
+/*
+ * Returns true if we're sure to have found the definitive divider (ie
+ * deviation == 0).
+ */
+static bool skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
 				  uint64_t central_freq,
 				  uint64_t dco_freq,
 				  unsigned int divider)
@@ -1141,6 +1145,10 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
 			ctx->dco_freq = dco_freq;
 			ctx->p = divider;
 		}
+
+		/* we can't improve a 0 deviation */
+		if (deviation == 0)
+			return true;
 	/* negative deviation */
 	} else if (deviation < SKL_DCO_MAX_NDEVIATION &&
 		   deviation < ctx->min_deviation) {
@@ -1150,6 +1158,7 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
 		ctx->p = divider;
 	}
 
+	return false;
 }
 
 static void skl_wrpll_get_multipliers(unsigned int p,
@@ -1311,13 +1320,15 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */,
 				unsigned int p = dividers[d].list[i];
 				uint64_t dco_freq = p * afe_clock;
 
-				skl_wrpll_try_divider(&ctx,
-						      dco_central_freq[dco],
-						      dco_freq,
-						      p);
+				if (skl_wrpll_try_divider(&ctx,
+							  dco_central_freq[dco],
+							  dco_freq,
+							  p))
+					goto skip_remaining_dividers;
 			}
 		}
 
+skip_remaining_dividers:
 		/*
 		 * If a solution is found with an even divider, prefer
 		 * this one.
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-25 17:08 [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0 Damien Lespiau
@ 2015-06-26 17:18 ` Paulo Zanoni
  2015-06-26 17:23   ` Damien Lespiau
  2015-06-26 17:34   ` [PATCH v2] " Damien Lespiau
  2015-06-29  4:57 ` [PATCH] " shuang.he
  1 sibling, 2 replies; 7+ messages in thread
From: Paulo Zanoni @ 2015-06-26 17:18 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: Intel Graphics Development, Paulo Zanoni

2015-06-25 14:08 GMT-03:00 Damien Lespiau <damien.lespiau@intel.com>:
> We can't improve a 0 deviation, so when we find such a divider, skip the
> remaining ones they won't be better.
>
> This short-circuit the search for 34 of the 373 test frequencies in the
> corresponding i-g-t test (tools/skl_compute_wrpll)
>
> Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> This patch has to be applied after patch 12 and 13 for the recent SKL DPLL
> series.
>
>  drivers/gpu/drm/i915/intel_ddi.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index f6b3ccc..45116d8 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1122,7 +1122,11 @@ static void skl_wrpll_context_init(struct skl_wrpll_context *ctx)
>  #define SKL_DCO_MAX_PDEVIATION 100
>  #define SKL_DCO_MAX_NDEVIATION 600
>
> -static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
> +/*
> + * Returns true if we're sure to have found the definitive divider (ie
> + * deviation == 0).
> + */
> +static bool skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
>                                   uint64_t central_freq,
>                                   uint64_t dco_freq,
>                                   unsigned int divider)
> @@ -1141,6 +1145,10 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
>                         ctx->dco_freq = dco_freq;
>                         ctx->p = divider;
>                 }
> +
> +               /* we can't improve a 0 deviation */
> +               if (deviation == 0)
> +                       return true;

Took me a while to understand why this was exactly here :)


>         /* negative deviation */
>         } else if (deviation < SKL_DCO_MAX_NDEVIATION &&
>                    deviation < ctx->min_deviation) {
> @@ -1150,6 +1158,7 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
>                 ctx->p = divider;
>         }
>
> +       return false;
>  }
>
>  static void skl_wrpll_get_multipliers(unsigned int p,
> @@ -1311,13 +1320,15 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */,
>                                 unsigned int p = dividers[d].list[i];
>                                 uint64_t dco_freq = p * afe_clock;
>
> -                               skl_wrpll_try_divider(&ctx,
> -                                                     dco_central_freq[dco],
> -                                                     dco_freq,
> -                                                     p);
> +                               if (skl_wrpll_try_divider(&ctx,
> +                                                         dco_central_freq[dco],
> +                                                         dco_freq,
> +                                                         p))
> +                                       goto skip_remaining_dividers;

Bikeshed: instead of touching skl_wrpll_try_divider(), you could just:

if (ctx.min_deviation == 0) goto skip_remaining_dividers;

That would keep the logic of the optimization restricted to this
function. IMHO, much simpler.

With or without changes: Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>                         }
>                 }
>
> +skip_remaining_dividers:
>                 /*
>                  * If a solution is found with an even divider, prefer
>                  * this one.
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-26 17:18 ` Paulo Zanoni
@ 2015-06-26 17:23   ` Damien Lespiau
  2015-06-26 17:34   ` [PATCH v2] " Damien Lespiau
  1 sibling, 0 replies; 7+ messages in thread
From: Damien Lespiau @ 2015-06-26 17:23 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: Intel Graphics Development, Paulo Zanoni

On Fri, Jun 26, 2015 at 02:18:39PM -0300, Paulo Zanoni wrote:
> > @@ -1311,13 +1320,15 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */,
> >                                 unsigned int p = dividers[d].list[i];
> >                                 uint64_t dco_freq = p * afe_clock;
> >
> > -                               skl_wrpll_try_divider(&ctx,
> > -                                                     dco_central_freq[dco],
> > -                                                     dco_freq,
> > -                                                     p);
> > +                               if (skl_wrpll_try_divider(&ctx,
> > +                                                         dco_central_freq[dco],
> > +                                                         dco_freq,
> > +                                                         p))
> > +                                       goto skip_remaining_dividers;
> 
> Bikeshed: instead of touching skl_wrpll_try_divider(), you could just:
> 
> if (ctx.min_deviation == 0) goto skip_remaining_dividers;
> 
> That would keep the logic of the optimization restricted to this
> function. IMHO, much simpler.
> 
> With or without changes: Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

I like that, v2 it is!

-- 
Damien
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-26 17:18 ` Paulo Zanoni
  2015-06-26 17:23   ` Damien Lespiau
@ 2015-06-26 17:34   ` Damien Lespiau
  2015-06-26 17:42     ` Daniel Vetter
  2015-06-28 19:15     ` shuang.he
  1 sibling, 2 replies; 7+ messages in thread
From: Damien Lespiau @ 2015-06-26 17:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: paulo.r.zanoni

We can't improve a 0 deviation, so when we find such a divider, skip the
remaining ones they won't be better.

This short-circuit the search for 34 of the 373 test frequencies in the
corresponding i-g-t test (tools/skl_compute_wrpll)

v2: Place the short-circuiting code in skl_compute_wrpll() (Paulo)

(I'm sure nobody will notice the spurious removal of a blank line)

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index f6b3ccc..42c1487 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1149,7 +1149,6 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
 		ctx->dco_freq = dco_freq;
 		ctx->p = divider;
 	}
-
 }
 
 static void skl_wrpll_get_multipliers(unsigned int p,
@@ -1315,9 +1314,17 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */,
 						      dco_central_freq[dco],
 						      dco_freq,
 						      p);
+				/*
+				 * Skip the remaining dividers if we're sure to
+				 * have found the definitive divider, we can't
+				 * improve a 0 deviation.
+				 */
+				if (ctx.min_deviation == 0)
+					goto skip_remaining_dividers;
 			}
 		}
 
+skip_remaining_dividers:
 		/*
 		 * If a solution is found with an even divider, prefer
 		 * this one.
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-26 17:34   ` [PATCH v2] " Damien Lespiau
@ 2015-06-26 17:42     ` Daniel Vetter
  2015-06-28 19:15     ` shuang.he
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2015-06-26 17:42 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx, paulo.r.zanoni

On Fri, Jun 26, 2015 at 06:34:29PM +0100, Damien Lespiau wrote:
> We can't improve a 0 deviation, so when we find such a divider, skip the
> remaining ones they won't be better.
> 
> This short-circuit the search for 34 of the 373 test frequencies in the
> corresponding i-g-t test (tools/skl_compute_wrpll)
> 
> v2: Place the short-circuiting code in skl_compute_wrpll() (Paulo)
> 
> (I'm sure nobody will notice the spurious removal of a blank line)
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index f6b3ccc..42c1487 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1149,7 +1149,6 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx,
>  		ctx->dco_freq = dco_freq;
>  		ctx->p = divider;
>  	}
> -
>  }
>  
>  static void skl_wrpll_get_multipliers(unsigned int p,
> @@ -1315,9 +1314,17 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */,
>  						      dco_central_freq[dco],
>  						      dco_freq,
>  						      p);
> +				/*
> +				 * Skip the remaining dividers if we're sure to
> +				 * have found the definitive divider, we can't
> +				 * improve a 0 deviation.
> +				 */
> +				if (ctx.min_deviation == 0)
> +					goto skip_remaining_dividers;
>  			}
>  		}
>  
> +skip_remaining_dividers:
>  		/*
>  		 * If a solution is found with an even divider, prefer
>  		 * this one.
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-26 17:34   ` [PATCH v2] " Damien Lespiau
  2015-06-26 17:42     ` Daniel Vetter
@ 2015-06-28 19:15     ` shuang.he
  1 sibling, 0 replies; 7+ messages in thread
From: shuang.he @ 2015-06-28 19:15 UTC (permalink / raw)
  To: shuang.he, lei.a.liu, intel-gfx, damien.lespiau

Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6627
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  343/343              343/343
BYT                 -1              287/287              286/287
HSW                                  380/380              380/380
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*BYT  igt@gem_partial_pwrite_pread@reads-display      PASS(1)      FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0
  2015-06-25 17:08 [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0 Damien Lespiau
  2015-06-26 17:18 ` Paulo Zanoni
@ 2015-06-29  4:57 ` shuang.he
  1 sibling, 0 replies; 7+ messages in thread
From: shuang.he @ 2015-06-29  4:57 UTC (permalink / raw)
  To: shuang.he, lei.a.liu, intel-gfx, damien.lespiau

Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6633
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  343/343              343/343
BYT                                  287/287              287/287
HSW                                  380/380              380/380
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-29  4:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 17:08 [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0 Damien Lespiau
2015-06-26 17:18 ` Paulo Zanoni
2015-06-26 17:23   ` Damien Lespiau
2015-06-26 17:34   ` [PATCH v2] " Damien Lespiau
2015-06-26 17:42     ` Daniel Vetter
2015-06-28 19:15     ` shuang.he
2015-06-29  4:57 ` [PATCH] " shuang.he

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.