From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Conselvan De Oliveira, Ander" <ander.conselvan.de.oliveira@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 01/13] drm/i915: Eliminate usage of plane_wm_parameters from ILK-style WM code
Date: Wed, 26 Aug 2015 16:23:39 +0300 [thread overview]
Message-ID: <20150826132339.GR5176@intel.com> (raw)
In-Reply-To: <1440593132.2519.1.camel@intel.com>
On Wed, Aug 26, 2015 at 12:45:32PM +0000, Conselvan De Oliveira, Ander wrote:
> On Thu, 2015-08-20 at 18:11 -0700, Matt Roper wrote:
> > Just pull the info out of the plane state structure rather than staging
> > it in an additional structure.
> >
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>
> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
>
> > ---
> > drivers/gpu/drm/i915/intel_pm.c | 133 +++++++++++++++++++++-------------------
> > 1 file changed, 70 insertions(+), 63 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index fff0c22..c9cf7cf 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -1791,9 +1791,6 @@ struct ilk_pipe_wm_parameters {
> > bool active;
> > uint32_t pipe_htotal;
> > uint32_t pixel_rate;
> > - struct intel_plane_wm_parameters pri;
> > - struct intel_plane_wm_parameters spr;
> > - struct intel_plane_wm_parameters cur;
> > };
> >
> > struct ilk_wm_maximums {
> > @@ -1815,25 +1812,25 @@ struct intel_wm_config {
> > * mem_value must be in 0.1us units.
> > */
> > static uint32_t ilk_compute_pri_wm(const struct ilk_pipe_wm_parameters *params,
> > + const struct intel_plane_state *pstate,
> > uint32_t mem_value,
> > bool is_lp)
> > {
> > + int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0;
> > uint32_t method1, method2;
> >
> > - if (!params->active || !params->pri.enabled)
> > + if (!params->active || !pstate->visible)
> > return 0;
> >
> > - method1 = ilk_wm_method1(params->pixel_rate,
> > - params->pri.bytes_per_pixel,
> > - mem_value);
> > + method1 = ilk_wm_method1(params->pixel_rate, bpp, mem_value);
> >
> > if (!is_lp)
> > return method1;
> >
> > method2 = ilk_wm_method2(params->pixel_rate,
> > params->pipe_htotal,
> > - params->pri.horiz_pixels,
> > - params->pri.bytes_per_pixel,
> > + drm_rect_width(&pstate->dst),
> > + bpp,
> > mem_value);
> >
> > return min(method1, method2);
> > @@ -1844,20 +1841,20 @@ static uint32_t ilk_compute_pri_wm(const struct ilk_pipe_wm_parameters
> > *params,
> > * mem_value must be in 0.1us units.
> > */
> > static uint32_t ilk_compute_spr_wm(const struct ilk_pipe_wm_parameters *params,
> > + const struct intel_plane_state *pstate,
> > uint32_t mem_value)
> > {
> > + int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0;
> > uint32_t method1, method2;
> >
> > - if (!params->active || !params->spr.enabled)
> > + if (!params->active || !pstate->visible)
> > return 0;
> >
> > - method1 = ilk_wm_method1(params->pixel_rate,
> > - params->spr.bytes_per_pixel,
> > - mem_value);
> > + method1 = ilk_wm_method1(params->pixel_rate, bpp, mem_value);
> > method2 = ilk_wm_method2(params->pixel_rate,
> > params->pipe_htotal,
> > - params->spr.horiz_pixels,
> > - params->spr.bytes_per_pixel,
> > + drm_rect_width(&pstate->dst),
> > + bpp,
> > mem_value);
> > return min(method1, method2);
> > }
> > @@ -1867,28 +1864,32 @@ static uint32_t ilk_compute_spr_wm(const struct ilk_pipe_wm_parameters
> > *params,
> > * mem_value must be in 0.1us units.
> > */
> > static uint32_t ilk_compute_cur_wm(const struct ilk_pipe_wm_parameters *params,
> > + const struct intel_plane_state *pstate,
> > uint32_t mem_value)
> > {
> > - if (!params->active || !params->cur.enabled)
> > + int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0;
> > +
> > + if (!params->active || !pstate->visible)
> > return 0;
> >
> > return ilk_wm_method2(params->pixel_rate,
> > params->pipe_htotal,
> > - params->cur.horiz_pixels,
> > - params->cur.bytes_per_pixel,
> > + drm_rect_width(&pstate->dst),
> > + bpp,
> > mem_value);
> > }
> >
> > /* Only for WM_LP. */
> > static uint32_t ilk_compute_fbc_wm(const struct ilk_pipe_wm_parameters *params,
> > + const struct intel_plane_state *pstate,
> > uint32_t pri_val)
> > {
> > - if (!params->active || !params->pri.enabled)
> > + int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0;
> > +
> > + if (!params->active || !pstate->visible)
> > return 0;
> >
> > - return ilk_wm_fbc(pri_val,
> > - params->pri.horiz_pixels,
> > - params->pri.bytes_per_pixel);
> > + return ilk_wm_fbc(pri_val, drm_rect_width(&pstate->dst), bpp);
> > }
> >
> > static unsigned int ilk_display_fifo_size(const struct drm_device *dev)
> > @@ -2053,10 +2054,12 @@ static bool ilk_validate_wm_level(int level,
> > }
> >
> > static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
> > + const struct intel_crtc *intel_crtc,
> > int level,
> > const struct ilk_pipe_wm_parameters *p,
> > struct intel_wm_level *result)
> > {
> > + struct intel_plane *intel_plane;
> > uint16_t pri_latency = dev_priv->wm.pri_latency[level];
> > uint16_t spr_latency = dev_priv->wm.spr_latency[level];
> > uint16_t cur_latency = dev_priv->wm.cur_latency[level];
> > @@ -2068,10 +2071,29 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
> > cur_latency *= 5;
> > }
> >
> > - result->pri_val = ilk_compute_pri_wm(p, pri_latency, level);
> > - result->spr_val = ilk_compute_spr_wm(p, spr_latency);
> > - result->cur_val = ilk_compute_cur_wm(p, cur_latency);
> > - result->fbc_val = ilk_compute_fbc_wm(p, result->pri_val);
> > + for_each_intel_plane_on_crtc(dev_priv->dev, intel_crtc, intel_plane) {
> > + struct intel_plane_state *pstate =
> > + to_intel_plane_state(intel_plane->base.state);
> > +
> > + switch (intel_plane->base.type) {
> > + case DRM_PLANE_TYPE_PRIMARY:
> > + result->pri_val = ilk_compute_pri_wm(p, pstate,
> > + pri_latency,
> > + level);
> > + result->fbc_val = ilk_compute_fbc_wm(p, pstate,
> > + result->pri_val);
> > + break;
> > + case DRM_PLANE_TYPE_OVERLAY:
> > + result->spr_val = ilk_compute_spr_wm(p, pstate,
> > + spr_latency);
> > + break;
> > + case DRM_PLANE_TYPE_CURSOR:
> > + result->cur_val = ilk_compute_cur_wm(p, pstate,
> > + cur_latency);
> > + break;
> > + }
> > + }
> > +
> > result->enable = true;
> > }
> >
> > @@ -2333,10 +2355,7 @@ static void skl_setup_wm_latency(struct drm_device *dev)
> > static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
> > struct ilk_pipe_wm_parameters *p)
> > {
> > - struct drm_device *dev = crtc->dev;
> > struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > - enum pipe pipe = intel_crtc->pipe;
> > - struct drm_plane *plane;
> >
> > if (!intel_crtc->active)
> > return;
> > @@ -2344,32 +2363,6 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
> > p->active = true;
> > p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal;
> > p->pixel_rate = ilk_pipe_pixel_rate(intel_crtc->config);
> > -
> > - if (crtc->primary->state->fb)
> > - p->pri.bytes_per_pixel =
> > - crtc->primary->state->fb->bits_per_pixel / 8;
> > - else
> > - p->pri.bytes_per_pixel = 4;
> > -
> > - p->cur.bytes_per_pixel = 4;
> > - /*
> > - * TODO: for now, assume primary and cursor planes are always enabled.
> > - * Setting them to false makes the screen flicker.
> > - */
> > - p->pri.enabled = true;
> > - p->cur.enabled = true;
> > -
> > - p->pri.horiz_pixels = intel_crtc->config->pipe_src_w;
> > - p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w;
> > -
> > - drm_for_each_legacy_plane(plane, dev) {
> > - struct intel_plane *intel_plane = to_intel_plane(plane);
> > -
> > - if (intel_plane->pipe == pipe) {
> > - p->spr = intel_plane->wm;
> > - break;
> > - }
> > - }
> > }
> >
> > static void ilk_compute_wm_config(struct drm_device *dev,
> > @@ -2397,28 +2390,42 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc,
> > {
> > struct drm_device *dev = crtc->dev;
> > const struct drm_i915_private *dev_priv = dev->dev_private;
> > + struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > + struct intel_plane *intel_plane;
> > + struct intel_plane_state *sprstate = NULL;
> > int level, max_level = ilk_wm_max_level(dev);
> > /* LP0 watermark maximums depend on this pipe alone */
> > struct intel_wm_config config = {
> > .num_pipes_active = 1,
> > - .sprites_enabled = params->spr.enabled,
> > - .sprites_scaled = params->spr.scaled,
> > };
> > struct ilk_wm_maximums max;
> >
> > + for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
> > + if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY) {
> > + sprstate = to_intel_plane_state(intel_plane->base.state);
> > + break;
> > + }
> > + }
> > +
> > + config.sprites_enabled = sprstate->visible;
> > + config.sprites_scaled =
> > + drm_rect_width(&sprstate->dst) != drm_rect_width(&sprstate->src) >> 16 ||
> > + drm_rect_height(&sprstate->dst) != drm_rect_height(&sprstate->src) >> 16;
This will now assume the rects will match when the sprite is invisible.
Not sure that would be the case, so I'd add a 'visible &&' here to make
sure we don't accidentally limite the wm level when the sprite isn't
even enabled.
> > +
> > +
> > pipe_wm->pipe_enabled = params->active;
> > - pipe_wm->sprites_enabled = params->spr.enabled;
> > - pipe_wm->sprites_scaled = params->spr.scaled;
> > + pipe_wm->sprites_enabled = sprstate->visible;
> > + pipe_wm->sprites_scaled = config.sprites_scaled;
> >
> > /* ILK/SNB: LP2+ watermarks only w/o sprites */
> > - if (INTEL_INFO(dev)->gen <= 6 && params->spr.enabled)
> > + if (INTEL_INFO(dev)->gen <= 6 && sprstate->visible)
> > max_level = 1;
> >
> > /* ILK/SNB/IVB: LP1+ watermarks only w/o scaling */
> > - if (params->spr.scaled)
> > + if (config.sprites_scaled)
> > max_level = 0;
> >
> > - ilk_compute_wm_level(dev_priv, 0, params, &pipe_wm->wm[0]);
> > + ilk_compute_wm_level(dev_priv, intel_crtc, 0, params, &pipe_wm->wm[0]);
> >
> > if (IS_HASWELL(dev) || IS_BROADWELL(dev))
> > pipe_wm->linetime = hsw_compute_linetime_wm(dev, crtc);
> > @@ -2435,7 +2442,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc,
> > for (level = 1; level <= max_level; level++) {
> > struct intel_wm_level wm = {};
> >
> > - ilk_compute_wm_level(dev_priv, level, params, &wm);
> > + ilk_compute_wm_level(dev_priv, intel_crtc, level, params, &wm);
> >
> > /*
> > * Disable any watermark level that exceeds the
> ---------------------------------------------------------------------
> Intel Finland Oy
> Registered Address: PL 281, 00181 Helsinki
> Business Identity Code: 0357606 - 4
> Domiciled in Helsinki
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> _______________________________________________
> 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
next prev parent reply other threads:[~2015-08-26 13:23 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 1:11 [PATCH 00/13] Atomic watermark updates (v3) Matt Roper
2015-08-21 1:11 ` [PATCH 01/13] drm/i915: Eliminate usage of plane_wm_parameters from ILK-style WM code Matt Roper
2015-08-26 12:45 ` Conselvan De Oliveira, Ander
2015-08-26 13:23 ` Ville Syrjälä [this message]
2015-08-21 1:11 ` [PATCH 02/13] drm/i915: Eliminate usage of pipe_wm_parameters from ILK-style WM Matt Roper
2015-08-26 12:45 ` Ander Conselvan De Oliveira
2015-08-26 13:39 ` Ville Syrjälä
2015-08-26 15:37 ` Matt Roper
2015-08-26 15:51 ` Ville Syrjälä
2015-08-28 23:57 ` [RFC 1/3] drm/i915: Roll intel_crtc->atomic into intel_crtc_state Matt Roper
2015-08-28 23:57 ` [RFC 2/3] drm/i915: Calculate an intermediate plane/crtc atomic state for modesets Matt Roper
2015-08-28 23:57 ` [RFC 3/3] drm/i915: Update modeset programming to use intermediate state Matt Roper
2015-09-01 5:24 ` [RFC 1/3] drm/i915: Roll intel_crtc->atomic into intel_crtc_state Maarten Lankhorst
2015-09-01 15:30 ` Matt Roper
2015-09-01 15:48 ` Ville Syrjälä
2015-09-02 5:15 ` Maarten Lankhorst
2015-09-02 10:35 ` Ville Syrjälä
2015-09-02 11:08 ` Maarten Lankhorst
2015-09-02 11:15 ` Ville Syrjälä
2015-09-02 14:22 ` Maarten Lankhorst
2015-09-02 15:33 ` Ville Syrjälä
2015-08-21 1:11 ` [PATCH 03/13] drm/i915/skl: Simplify wm structures slightly Matt Roper
2015-08-26 13:23 ` Ander Conselvan De Oliveira
2015-08-21 1:11 ` [PATCH 04/13] drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM Matt Roper
2015-08-27 12:55 ` Ander Conselvan De Oliveira
2015-08-21 1:11 ` [PATCH 05/13] drm/i915/ivb: Move WaCxSRDisabledForSpriteScaling w/a to atomic check Matt Roper
2015-08-21 1:11 ` [PATCH 06/13] drm/i915: Drop intel_update_sprite_watermarks Matt Roper
2015-08-21 1:11 ` [PATCH 07/13] drm/i915: Refactor ilk_update_wm (v3) Matt Roper
2015-08-21 1:11 ` [PATCH 08/13] drm/i915: Move active watermarks into CRTC state (v2) Matt Roper
2015-08-26 13:10 ` Ville Syrjälä
2015-08-21 1:12 ` [PATCH 09/13] drm/i915: Calculate ILK-style watermarks during atomic check (v2) Matt Roper
2015-08-28 12:53 ` Ander Conselvan De Oliveira
2015-08-28 12:56 ` Ander Conselvan De Oliveira
2015-08-21 1:12 ` [PATCH 10/13] drm/i915: Calculate watermark configuration during atomic check Matt Roper
2015-08-28 13:42 ` Ander Conselvan De Oliveira
2015-09-01 5:32 ` Maarten Lankhorst
2015-08-21 1:12 ` [PATCH 11/13] drm/i915: Add two-stage ILK-style watermark programming (v3) Matt Roper
2015-08-31 14:36 ` Ander Conselvan De Oliveira
2015-08-21 1:12 ` [PATCH 12/13] drm/i915/skl: Switch to atomic watermark programming Matt Roper
2015-08-21 1:12 ` [PATCH 13/13] drm/i915/skl: Clarify pending vs hw watermark values Matt Roper
2015-08-26 4:33 ` [PATCH 00/13] Atomic watermark updates (v3) Hindman, Gavin
2015-08-26 18:07 ` Matt Roper
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=20150826132339.GR5176@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=ander.conselvan.de.oliveira@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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.