From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 83/89] drm/i915/skl: Check the DDB state at modeset Date: Thu, 4 Sep 2014 15:27:49 +0200 Message-ID: <20140904132749.GS15520@phenom.ffwll.local> References: <1409830075-11139-1-git-send-email-damien.lespiau@intel.com> <1409830075-11139-84-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by gabe.freedesktop.org (Postfix) with ESMTP id EDFCF6E1CD for ; Thu, 4 Sep 2014 06:27:26 -0700 (PDT) Received: by mail-wg0-f46.google.com with SMTP id x13so10112848wgg.5 for ; Thu, 04 Sep 2014 06:27:25 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1409830075-11139-84-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Damien Lespiau Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Sep 04, 2014 at 12:27:49PM +0100, Damien Lespiau wrote: > v2: Don't check DDB on pre-SKL platforms > Don't check DDB state on disabled pipes > > Signed-off-by: Damien Lespiau We probably want to do this with a vfunc eventually ... but reall deferring to Ville here, he'll know best what might be useful to make sure that the wm readout/takeover is accurate enough. So lgtm for now. -Daniel > --- > drivers/gpu/drm/i915/i915_drv.h | 9 +++++++ > drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 95e57dc..0baf7f3 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -1424,6 +1424,15 @@ static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry) > return entry->end - entry->start + 1; > } > > +static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1, > + const struct skl_ddb_entry *e2) > +{ > + if (e1->start == e2->start && e1->end == e2->end) > + return true; > + > + return false; > +} > + > struct skl_ddb_allocation { > struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; > struct skl_ddb_entry cursor[I915_MAX_PIPES]; > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index 9b31342..35d3389 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -10944,6 +10944,56 @@ intel_pipe_config_compare(struct drm_device *dev, > return true; > } > > +static void check_wm_state(struct drm_device *dev) > +{ > + struct drm_i915_private *dev_priv = dev->dev_private; > + struct skl_ddb_allocation hw_ddb, *sw_ddb; > + struct intel_crtc *intel_crtc; > + int plane; > + > + if (INTEL_INFO(dev)->gen < 9) > + return; > + > + skl_ddb_get_hw_state(dev_priv, &hw_ddb); > + sw_ddb = &dev_priv->wm.skl_hw.ddb; > + > + for_each_intel_crtc(dev, intel_crtc) { > + struct skl_ddb_entry *hw_entry, *sw_entry; > + const enum pipe pipe = intel_crtc->pipe; > + > + if (!intel_crtc->active) > + continue; > + > + /* planes */ > + for_each_plane(pipe, plane) { > + hw_entry = &hw_ddb.plane[pipe][plane]; > + sw_entry = &sw_ddb->plane[pipe][plane]; > + > + if (skl_ddb_entry_equal(hw_entry, sw_entry)) > + continue; > + > + DRM_ERROR("mismatch in DDB state pipe %c plane %d " > + "(expected (%u,%u), found (%u,%u))\n", > + pipe_name(pipe), plane + 1, > + sw_entry->start, sw_entry->end, > + hw_entry->start, hw_entry->end); > + } > + > + /* cursor */ > + hw_entry = &hw_ddb.cursor[pipe]; > + sw_entry = &sw_ddb->cursor[pipe]; > + > + if (skl_ddb_entry_equal(hw_entry, sw_entry)) > + continue; > + > + DRM_ERROR("mismatch in DDB state pipe %c cursor " > + "(expected (%u,%u), found (%u,%u))\n", > + pipe_name(pipe), > + sw_entry->start, sw_entry->end, > + hw_entry->start, hw_entry->end); > + } > +} > + > static void > check_connector_state(struct drm_device *dev) > { > @@ -11143,6 +11193,7 @@ check_shared_dpll_state(struct drm_device *dev) > void > intel_modeset_check_state(struct drm_device *dev) > { > + check_wm_state(dev); > check_connector_state(dev); > check_encoder_state(dev); > check_crtc_state(dev); > -- > 1.8.3.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch