Re: [Intel-gfx] [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()

2016-12-06 Thread Maarten Lankhorst
Hey,

Op 02-12-16 om 14:07 schreef Ville Syrjälä:
> On Thu, Dec 01, 2016 at 03:47:55PM +0100, Maarten Lankhorst wrote:
>> Op 28-11-16 om 18:37 schreef ville.syrj...@linux.intel.com:
>>> From: Ville Syrjälä 
>>>
>>> Rather than accessing crtc->config in vlv_compute_wm_level() let's
>>> pass in the crtc state explicitly. One step closer to atomic.
>>>
>>> Signed-off-by: Ville Syrjälä 
>> Yay. All users of intel_crtc->config have to die in the future, but this is 
>> temporarily a legit use for it.
> Pardon the stray reply earlier. What I wanted to say was that I was
> playing around with coccinelle a bit the other night, and managed to
> trick it into a little bit of crtc->config killing. I think I'll try
> to expand my efforts there a bit more before posting the stuff though.
>
Don't worry about it, most of them have to be audited to make sure that the 
right crtc_state passed in is used. It shouldn't blindly be used to convert to 
crtc->state.
I did some of the more tricky conversions in my nightly branch. 
https://cgit.freedesktop.org/~mlankhorst/linux/log/?h=nightly
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()

2016-12-02 Thread Ville Syrjälä
On Thu, Dec 01, 2016 at 03:47:55PM +0100, Maarten Lankhorst wrote:
> Op 28-11-16 om 18:37 schreef ville.syrj...@linux.intel.com:
> > From: Ville Syrjälä 
> >
> > Rather than accessing crtc->config in vlv_compute_wm_level() let's
> > pass in the crtc state explicitly. One step closer to atomic.
> >
> > Signed-off-by: Ville Syrjälä 
> Yay. All users of intel_crtc->config have to die in the future, but this is 
> temporarily a legit use for it.

Pardon the stray reply earlier. What I wanted to say was that I was
playing around with coccinelle a bit the other night, and managed to
trick it into a little bit of crtc->config killing. I think I'll try
to expand my efforts there a bit more before posting the stuff though.

> 
> For patch 13, 14 and 15
> 
> Reviewed-by: Maarten Lankhorst 
> >  drivers/gpu/drm/i915/intel_pm.c | 20 +++-
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c 
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index 291843c2b61b..2a2aa8968b93 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct 
> > drm_i915_private *dev_priv)
> > }
> >  }
> >  
> > -static uint16_t vlv_compute_wm_level(struct intel_plane *plane,
> > -struct intel_crtc *crtc,
> > -const struct intel_plane_state *state,
> > +static uint16_t vlv_compute_wm_level(const struct intel_crtc_state 
> > *crtc_state,
> > +const struct intel_plane_state 
> > *plane_state,
> >  int level)
> >  {
> > +   struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
> > struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> > +   const struct drm_display_mode *adjusted_mode =
> > +   _state->base.adjusted_mode;
> > int clock, htotal, cpp, width, wm;
> >  
> > if (dev_priv->wm.pri_latency[level] == 0)
> > return USHRT_MAX;
> >  
> > -   if (!state->base.visible)
> > +   if (!plane_state->base.visible)
> > return 0;
> >  
> > -   cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
> > -   clock = crtc->config->base.adjusted_mode.crtc_clock;
> > -   htotal = crtc->config->base.adjusted_mode.crtc_htotal;
> > -   width = crtc->config->pipe_src_w;
> > +   cpp = drm_format_plane_cpp(plane_state->base.fb->pixel_format, 0);
> > +   clock = adjusted_mode->crtc_clock;
> > +   htotal = adjusted_mode->crtc_htotal;
> > +   width = crtc_state->pipe_src_w;
> > if (WARN_ON(htotal == 0))
> > htotal = 1;
> >  
> > @@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)
> >  
> > /* normal watermarks */
> > for (level = 0; level < wm_state->num_levels; level++) {
> > -   int wm = vlv_compute_wm_level(plane, crtc, state, 
> > level);
> > +   int wm = vlv_compute_wm_level(crtc->config, state, 
> > level);
> > int max_wm = plane->wm.fifo_size;
> >  
> > /* hack */
> 

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


Re: [Intel-gfx] [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()

2016-12-02 Thread Ville Syrjälä
On Thu, Dec 01, 2016 at 03:47:55PM +0100, Maarten Lankhorst wrote:
> Op 28-11-16 om 18:37 schreef ville.syrj...@linux.intel.com:
> > From: Ville Syrjälä 
> >
> > Rather than accessing crtc->config in vlv_compute_wm_level() let's
> > pass in the crtc state explicitly. One step closer to atomic.
> >
> > Signed-off-by: Ville Syrjälä 
> Yay. All users of intel_crtc->config have to die in the future, but this is 
> temporarily a legit use for it.
> 
> For patch 13, 14 and 15
> 
> Reviewed-by: Maarten Lankhorst 
> >  drivers/gpu/drm/i915/intel_pm.c | 20 +++-
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c 
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index 291843c2b61b..2a2aa8968b93 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct 
> > drm_i915_private *dev_priv)
> > }
> >  }
> >  
> > -static uint16_t vlv_compute_wm_level(struct intel_plane *plane,
> > -struct intel_crtc *crtc,
> > -const struct intel_plane_state *state,
> > +static uint16_t vlv_compute_wm_level(const struct intel_crtc_state 
> > *crtc_state,
> > +const struct intel_plane_state 
> > *plane_state,
> >  int level)
> >  {
> > +   struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
> > struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> > +   const struct drm_display_mode *adjusted_mode =
> > +   _state->base.adjusted_mode;
> > int clock, htotal, cpp, width, wm;
> >  
> > if (dev_priv->wm.pri_latency[level] == 0)
> > return USHRT_MAX;
> >  
> > -   if (!state->base.visible)
> > +   if (!plane_state->base.visible)
> > return 0;
> >  
> > -   cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
> > -   clock = crtc->config->base.adjusted_mode.crtc_clock;
> > -   htotal = crtc->config->base.adjusted_mode.crtc_htotal;
> > -   width = crtc->config->pipe_src_w;
> > +   cpp = drm_format_plane_cpp(plane_state->base.fb->pixel_format, 0);
> > +   clock = adjusted_mode->crtc_clock;
> > +   htotal = adjusted_mode->crtc_htotal;
> > +   width = crtc_state->pipe_src_w;
> > if (WARN_ON(htotal == 0))
> > htotal = 1;
> >  
> > @@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)
> >  
> > /* normal watermarks */
> > for (level = 0; level < wm_state->num_levels; level++) {
> > -   int wm = vlv_compute_wm_level(plane, crtc, state, 
> > level);
> > +   int wm = vlv_compute_wm_level(crtc->config, state, 
> > level);
> > int max_wm = plane->wm.fifo_size;
> >  
> > /* hack */
> 

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


Re: [Intel-gfx] [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()

2016-12-01 Thread Maarten Lankhorst
Op 28-11-16 om 18:37 schreef ville.syrj...@linux.intel.com:
> From: Ville Syrjälä 
>
> Rather than accessing crtc->config in vlv_compute_wm_level() let's
> pass in the crtc state explicitly. One step closer to atomic.
>
> Signed-off-by: Ville Syrjälä 
Yay. All users of intel_crtc->config have to die in the future, but this is 
temporarily a legit use for it.

For patch 13, 14 and 15

Reviewed-by: Maarten Lankhorst 
>  drivers/gpu/drm/i915/intel_pm.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 291843c2b61b..2a2aa8968b93 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct 
> drm_i915_private *dev_priv)
>   }
>  }
>  
> -static uint16_t vlv_compute_wm_level(struct intel_plane *plane,
> -  struct intel_crtc *crtc,
> -  const struct intel_plane_state *state,
> +static uint16_t vlv_compute_wm_level(const struct intel_crtc_state 
> *crtc_state,
> +  const struct intel_plane_state 
> *plane_state,
>int level)
>  {
> + struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
>   struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> + const struct drm_display_mode *adjusted_mode =
> + _state->base.adjusted_mode;
>   int clock, htotal, cpp, width, wm;
>  
>   if (dev_priv->wm.pri_latency[level] == 0)
>   return USHRT_MAX;
>  
> - if (!state->base.visible)
> + if (!plane_state->base.visible)
>   return 0;
>  
> - cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
> - clock = crtc->config->base.adjusted_mode.crtc_clock;
> - htotal = crtc->config->base.adjusted_mode.crtc_htotal;
> - width = crtc->config->pipe_src_w;
> + cpp = drm_format_plane_cpp(plane_state->base.fb->pixel_format, 0);
> + clock = adjusted_mode->crtc_clock;
> + htotal = adjusted_mode->crtc_htotal;
> + width = crtc_state->pipe_src_w;
>   if (WARN_ON(htotal == 0))
>   htotal = 1;
>  
> @@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)
>  
>   /* normal watermarks */
>   for (level = 0; level < wm_state->num_levels; level++) {
> - int wm = vlv_compute_wm_level(plane, crtc, state, 
> level);
> + int wm = vlv_compute_wm_level(crtc->config, state, 
> level);
>   int max_wm = plane->wm.fifo_size;
>  
>   /* hack */


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()

2016-11-28 Thread ville . syrjala
From: Ville Syrjälä 

Rather than accessing crtc->config in vlv_compute_wm_level() let's
pass in the crtc state explicitly. One step closer to atomic.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/intel_pm.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 291843c2b61b..2a2aa8968b93 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct drm_i915_private 
*dev_priv)
}
 }
 
-static uint16_t vlv_compute_wm_level(struct intel_plane *plane,
-struct intel_crtc *crtc,
-const struct intel_plane_state *state,
+static uint16_t vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
+const struct intel_plane_state 
*plane_state,
 int level)
 {
+   struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+   const struct drm_display_mode *adjusted_mode =
+   _state->base.adjusted_mode;
int clock, htotal, cpp, width, wm;
 
if (dev_priv->wm.pri_latency[level] == 0)
return USHRT_MAX;
 
-   if (!state->base.visible)
+   if (!plane_state->base.visible)
return 0;
 
-   cpp = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
-   clock = crtc->config->base.adjusted_mode.crtc_clock;
-   htotal = crtc->config->base.adjusted_mode.crtc_htotal;
-   width = crtc->config->pipe_src_w;
+   cpp = drm_format_plane_cpp(plane_state->base.fb->pixel_format, 0);
+   clock = adjusted_mode->crtc_clock;
+   htotal = adjusted_mode->crtc_htotal;
+   width = crtc_state->pipe_src_w;
if (WARN_ON(htotal == 0))
htotal = 1;
 
@@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)
 
/* normal watermarks */
for (level = 0; level < wm_state->num_levels; level++) {
-   int wm = vlv_compute_wm_level(plane, crtc, state, 
level);
+   int wm = vlv_compute_wm_level(crtc->config, state, 
level);
int max_wm = plane->wm.fifo_size;
 
/* hack */
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx