diff mbox

[4/5] drm/i915: Use ilk_wm_max_level() in latency debugfs files

Message ID 1399991428-32763-5-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien May 13, 2014, 2:30 p.m. UTC
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ville Syrjala May 13, 2014, 4:30 p.m. UTC | #1
On Tue, May 13, 2014 at 03:30:27PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 18b3565..6801987 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3084,7 +3084,7 @@ static const struct file_operations i915_display_crc_ctl_fops = {
>  static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
>  {
>  	struct drm_device *dev = m->private;
> -	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
> +	int num_levels = ilk_wm_max_level(dev) + 1;
>  	int level;
>  
>  	drm_modeset_lock_all(dev);
> @@ -3167,7 +3167,7 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
>  	struct seq_file *m = file->private_data;
>  	struct drm_device *dev = m->private;
>  	uint16_t new[5] = { 0 };
> -	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
> +	int num_levels = ilk_wm_max_level(dev) + 1;

One idea that has been rattling in my head would be to introduce
dev_priv->wm.max_level or some such thing that would be computed
dynamically like so:
dev_priv->wm.max_level = min(hw_max, last_level_with_valid_latency_value);

This way we could actually disable some of the deeper levels without
worrying that the watermark code will encounter a zero latency value
somewhere. We could even do other crazy things like trying out LP3
on ILK ;)

But that's a bit orthogonal, and even then this patch does make sense.

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

I'll let someone else bikeshed the for_each_crtc macros.

>  	int level;
>  	int ret;
>  	char tmp[32];
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter May 13, 2014, 4:46 p.m. UTC | #2
On Tue, May 13, 2014 at 03:30:27PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

I prefer "expose foo" and "use foo" in the same patch. I'll squash these
two if you're ok.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 18b3565..6801987 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3084,7 +3084,7 @@ static const struct file_operations i915_display_crc_ctl_fops = {
>  static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
>  {
>  	struct drm_device *dev = m->private;
> -	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
> +	int num_levels = ilk_wm_max_level(dev) + 1;
>  	int level;
>  
>  	drm_modeset_lock_all(dev);
> @@ -3167,7 +3167,7 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
>  	struct seq_file *m = file->private_data;
>  	struct drm_device *dev = m->private;
>  	uint16_t new[5] = { 0 };
> -	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
> +	int num_levels = ilk_wm_max_level(dev) + 1;
>  	int level;
>  	int ret;
>  	char tmp[32];
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lespiau, Damien May 13, 2014, 4:51 p.m. UTC | #3
On Tue, May 13, 2014 at 06:46:23PM +0200, Daniel Vetter wrote:
> On Tue, May 13, 2014 at 03:30:27PM +0100, Damien Lespiau wrote:
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> 
> I prefer "expose foo" and "use foo" in the same patch. I'll squash these
> two if you're ok.

Sure, no problem. There have been a lot of these in the past, so I was
just assuming that was the unspoken way of doing it. I sure don't mind
either way.
Daniel Vetter May 13, 2014, 6:03 p.m. UTC | #4
On Tue, May 13, 2014 at 05:51:45PM +0100, Damien Lespiau wrote:
> On Tue, May 13, 2014 at 06:46:23PM +0200, Daniel Vetter wrote:
> > On Tue, May 13, 2014 at 03:30:27PM +0100, Damien Lespiau wrote:
> > > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> > 
> > I prefer "expose foo" and "use foo" in the same patch. I'll squash these
> > two if you're ok.
> 
> Sure, no problem. There have been a lot of these in the past, so I was
> just assuming that was the unspoken way of doing it. I sure don't mind
> either way.

Hm, I guess I'm not super-consistent with my bikesheds, but generally I
prefer this stuff squashed. Exception is patches to add piles of registers
to i915_reg.h, imo for those it makes sense to keep them separate. That
helps in review since the grunk work of double-checking Bspec is separate
from the more behavioural review of the actual code.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 18b3565..6801987 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3084,7 +3084,7 @@  static const struct file_operations i915_display_crc_ctl_fops = {
 static void wm_latency_show(struct seq_file *m, const uint16_t wm[5])
 {
 	struct drm_device *dev = m->private;
-	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
+	int num_levels = ilk_wm_max_level(dev) + 1;
 	int level;
 
 	drm_modeset_lock_all(dev);
@@ -3167,7 +3167,7 @@  static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
 	struct seq_file *m = file->private_data;
 	struct drm_device *dev = m->private;
 	uint16_t new[5] = { 0 };
-	int num_levels = IS_HASWELL(dev) || IS_BROADWELL(dev) ? 5 : 4;
+	int num_levels = ilk_wm_max_level(dev) + 1;
 	int level;
 	int ret;
 	char tmp[32];