Message ID | 20240318133757.1479189-3-luciano.coelho@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/display: DMC wakelock implementation | expand |
> -----Original Message----- > From: Coelho, Luciano <luciano.coelho@intel.com> > Sent: Monday, March 18, 2024 7:08 PM > To: intel-gfx@lists.freedesktop.org > Cc: intel-xe@lists.freedesktop.org; Shankar, Uma <uma.shankar@intel.com>; > ville.syrjala@linux.intel.com; Nikula, Jani <jani.nikula@intel.com> > Subject: [PATCH v3 2/4] drm/i915/display: don't allow DMC wakelock on older > hardware > > Only allow running DMC wakelock code if the display version is 20 or greater. One for previous one, don't do intel_dmc_wl_init unconditionally but protect it with Platform check. > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > --- > drivers/gpu/drm/i915/display/intel_dmc_wl.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > index 5c3d8204ae7e..7c991e22c616 100644 > --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > @@ -120,6 +120,9 @@ void intel_dmc_wl_enable(struct drm_i915_private > *i915) > struct intel_dmc_wl *wl = &i915->display.wl; > unsigned long flags; > > + if (DISPLAY_VER(i915) < 20) > + return; > + > spin_lock_irqsave(&wl->lock, flags); > > if (wl->enabled) > @@ -143,6 +146,9 @@ void intel_dmc_wl_disable(struct drm_i915_private > *i915) > struct intel_dmc_wl *wl = &i915->display.wl; > unsigned long flags; > > + if (DISPLAY_VER(i915) < 20) > + return; There can be case where DMC is not loaded, address that as well. We should not do wakelock in that case. > flush_delayed_work(&wl->work); > > spin_lock_irqsave(&wl->lock, flags); > @@ -171,6 +177,9 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, > i915_reg_t reg) > struct intel_dmc_wl *wl = &i915->display.wl; > unsigned long flags; > > + if (DISPLAY_VER(i915) < 20) > + return; > + > if (!intel_dmc_wl_check_range(reg.reg)) > return; > > @@ -203,6 +212,9 @@ void intel_dmc_wl_put(struct drm_i915_private *i915, > i915_reg_t reg) > struct intel_dmc_wl *wl = &i915->display.wl; > unsigned long flags; > > + if (DISPLAY_VER(i915) < 20) > + return; > + > if (!intel_dmc_wl_check_range(reg.reg)) > return; > > -- > 2.39.2
On Thu, 2024-03-21 at 08:02 +0000, Shankar, Uma wrote: > > > -----Original Message----- > > From: Coelho, Luciano <luciano.coelho@intel.com> > > Sent: Monday, March 18, 2024 7:08 PM > > To: intel-gfx@lists.freedesktop.org > > Cc: intel-xe@lists.freedesktop.org; Shankar, Uma <uma.shankar@intel.com>; > > ville.syrjala@linux.intel.com; Nikula, Jani <jani.nikula@intel.com> > > Subject: [PATCH v3 2/4] drm/i915/display: don't allow DMC wakelock on older > > hardware > > > > Only allow running DMC wakelock code if the display version is 20 or greater. > > One for previous one, don't do intel_dmc_wl_init unconditionally but protect it with > Platform check. Good point. I have removed the call to intel_dmc_wl_init() completely from the previous patch, like with intel_dmc_wl_enable(), so the call to init will be in this patch and protected by the platform version as well. > > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > > --- > > drivers/gpu/drm/i915/display/intel_dmc_wl.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > > b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > > index 5c3d8204ae7e..7c991e22c616 100644 > > --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c > > +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c > > @@ -120,6 +120,9 @@ void intel_dmc_wl_enable(struct drm_i915_private > > *i915) > > struct intel_dmc_wl *wl = &i915->display.wl; > > unsigned long flags; > > > > + if (DISPLAY_VER(i915) < 20) > > + return; > > + > > spin_lock_irqsave(&wl->lock, flags); > > > > if (wl->enabled) > > @@ -143,6 +146,9 @@ void intel_dmc_wl_disable(struct drm_i915_private > > *i915) > > struct intel_dmc_wl *wl = &i915->display.wl; > > unsigned long flags; > > > > + if (DISPLAY_VER(i915) < 20) > > + return; > > There can be case where DMC is not loaded, address that as well. > We should not do wakelock in that case. Right. I have added a helper function, intel_dmc_wl_supported(), to keep all this checks in one place. > > flush_delayed_work(&wl->work); > > > > spin_lock_irqsave(&wl->lock, flags); > > @@ -171,6 +177,9 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, > > i915_reg_t reg) > > struct intel_dmc_wl *wl = &i915->display.wl; > > unsigned long flags; > > > > + if (DISPLAY_VER(i915) < 20) > > + return; > > + > > if (!intel_dmc_wl_check_range(reg.reg)) > > return; > > > > @@ -203,6 +212,9 @@ void intel_dmc_wl_put(struct drm_i915_private *i915, > > i915_reg_t reg) > > struct intel_dmc_wl *wl = &i915->display.wl; > > unsigned long flags; > > > > + if (DISPLAY_VER(i915) < 20) > > + return; > > + > > if (!intel_dmc_wl_check_range(reg.reg)) > > return; > > > > -- > > 2.39.2 > -- Cheers, Luca.
diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c b/drivers/gpu/drm/i915/display/intel_dmc_wl.c index 5c3d8204ae7e..7c991e22c616 100644 --- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c +++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c @@ -120,6 +120,9 @@ void intel_dmc_wl_enable(struct drm_i915_private *i915) struct intel_dmc_wl *wl = &i915->display.wl; unsigned long flags; + if (DISPLAY_VER(i915) < 20) + return; + spin_lock_irqsave(&wl->lock, flags); if (wl->enabled) @@ -143,6 +146,9 @@ void intel_dmc_wl_disable(struct drm_i915_private *i915) struct intel_dmc_wl *wl = &i915->display.wl; unsigned long flags; + if (DISPLAY_VER(i915) < 20) + return; + flush_delayed_work(&wl->work); spin_lock_irqsave(&wl->lock, flags); @@ -171,6 +177,9 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, i915_reg_t reg) struct intel_dmc_wl *wl = &i915->display.wl; unsigned long flags; + if (DISPLAY_VER(i915) < 20) + return; + if (!intel_dmc_wl_check_range(reg.reg)) return; @@ -203,6 +212,9 @@ void intel_dmc_wl_put(struct drm_i915_private *i915, i915_reg_t reg) struct intel_dmc_wl *wl = &i915->display.wl; unsigned long flags; + if (DISPLAY_VER(i915) < 20) + return; + if (!intel_dmc_wl_check_range(reg.reg)) return;
Only allow running DMC wakelock code if the display version is 20 or greater. Signed-off-by: Luca Coelho <luciano.coelho@intel.com> --- drivers/gpu/drm/i915/display/intel_dmc_wl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)