From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 02/13] drm/i915: Pull watermark level validity check out Date: Tue, 6 Aug 2013 20:41:03 +0100 Message-ID: <20130806194103.GD8181@cantiga.alporthouse.com> References: <1375817052-32310-1-git-send-email-ville.syrjala@linux.intel.com> <1375817052-32310-3-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from fireflyinternet.com (s16502780.onlinehome-server.info [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A120E63C4 for ; Tue, 6 Aug 2013 12:41:10 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1375817052-32310-3-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Aug 06, 2013 at 10:24:01PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > Refactor the code a bit to split the watermark level validity check into > a separate function. > = > Also add hack there that allows us to use it even for LP0 watermarks. > ATM we don't pre-compute/check the LP0 watermarks, so we just have to > clamp them to the maximum and hope things work out. I don't see where we log the unclamped or post-clamped values. This would be a good opportunity to improve the logging in a common spot. Comment inline. > Signed-off-by: Ville Syrj=E4l=E4 > --- > drivers/gpu/drm/i915/intel_pm.c | 35 +++++++++++++++++++++++++++++++---- > 1 file changed, 31 insertions(+), 4 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel= _pm.c > index fe0c2af..f2374e0 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -2284,6 +2284,36 @@ static uint32_t ilk_compute_fbc_wm(struct hsw_pipe= _wm_parameters *params, > params->pri_bytes_per_pixel); > } > = > +static bool ilk_check_wm(int level, > + const struct hsw_wm_maximums *max, > + struct hsw_lp_wm_result *result) > +{ > + bool ret; > + > + result->enable =3D result->pri_val <=3D max->pri && > + result->spr_val <=3D max->spr && > + result->cur_val <=3D max->cur; > + > + ret =3D result->enable; > + > + /* > + * HACK until we can pre-compute everything, > + * and thus fail gracefully if LP0 watermarks > + * are exceeded... > + */ > + if (level =3D=3D 0 && !result->enable) { > + result->pri_val =3D min_t(uint32_t, result->pri_val, max->pri); > + result->spr_val =3D min_t(uint32_t, result->spr_val, max->spr); > + result->cur_val =3D min_t(uint32_t, result->cur_val, max->cur); > + result->enable =3D true; > + ret =3D false; ret is already false. > + } > + > + DRM_DEBUG_KMS("WM%d: %sabled\n", level, result->enable ? "en" : "dis"); > + > + return ret; > +} > + -- = Chris Wilson, Intel Open Source Technology Centre