<div dir="ltr"><div>Reviewed-by: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>></div><div><br></div>But I think it would be good now to change fbc_status interface on debugfs to show the current bit state as well.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 19, 2014 at 12:04 PM, Paulo Zanoni <span dir="ltr"><<a href="mailto:przanoni@gmail.com" target="_blank">przanoni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Paulo Zanoni <<a href="mailto:paulo.r.zanoni@intel.com">paulo.r.zanoni@intel.com</a>><br>
<br>
Currently, calling intel_fbc_enabled() will trigger a register read.<br>
And we call it a lot of times, even when FBC is disabled, so saving a<br>
few cycles would be a good thing.<br>
<br>
Another reason for this patch is because we currently call<br>
intel_fbc_enabled() while the HW is runtime suspended, so the read<br>
makes no sense and triggers a WARN. This happens even if FBC is<br>
disabled by default. Of course one could argue that we just shouldn't<br>
be calling intel_fbc_enabled() while the driver is runtime suspended,<br>
and I agree that's a good argument, but I still think that the reason<br>
explained in the first paragraph already justifies the patch.<br>
This problem can easily be reproduced with many subtests of<br>
igt/pm_rpm, and it is a regression introduced by:<br>
<br>
commit c5ad011d7d256ecbe173324029e992817194d2b0<br>
Author: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>><br>
Date: Mon Aug 4 03:51:38 2014 -0700<br>
drm/i915: FBC flush nuke for BDW<br>
<br>
Testcase: igt/pm_rpm/cursor (and others)<br>
Cc: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>><br>
Signed-off-by: Paulo Zanoni <<a href="mailto:paulo.r.zanoni@intel.com">paulo.r.zanoni@intel.com</a>><br>
---<br>
drivers/gpu/drm/i915/i915_drv.h | 4 ++++<br>
drivers/gpu/drm/i915/intel_pm.c | 31 ++++++++++++++++++++-----------<br>
2 files changed, 24 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h<br>
index 5fce16c..999bd57 100644<br>
--- a/drivers/gpu/drm/i915/i915_drv.h<br>
+++ b/drivers/gpu/drm/i915/i915_drv.h<br>
@@ -662,6 +662,10 @@ struct i915_fbc {<br>
<br>
bool false_color;<br>
<br>
+ /* Tracks whether the HW is actually enabled, not whether the feature is<br>
+ * possible. */<br>
+ bool enabled;<br>
+<br>
struct intel_fbc_work {<br>
struct delayed_work work;<br>
struct drm_crtc *crtc;<br>
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c<br>
index 2ca9fdb..6b41620 100644<br>
--- a/drivers/gpu/drm/i915/intel_pm.c<br>
+++ b/drivers/gpu/drm/i915/intel_pm.c<br>
@@ -71,6 +71,8 @@ static void i8xx_disable_fbc(struct drm_device *dev)<br>
struct drm_i915_private *dev_priv = dev->dev_private;<br>
u32 fbc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = false;<br>
+<br>
/* Disable compression */<br>
fbc_ctl = I915_READ(FBC_CONTROL);<br>
if ((fbc_ctl & FBC_CTL_EN) == 0)<br>
@@ -99,6 +101,8 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc)<br>
int i;<br>
u32 fbc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = true;<br>
+<br>
cfb_pitch = dev_priv->fbc.size / FBC_LL_SIZE;<br>
if (fb->pitches[0] < cfb_pitch)<br>
cfb_pitch = fb->pitches[0];<br>
@@ -153,6 +157,8 @@ static void g4x_enable_fbc(struct drm_crtc *crtc)<br>
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);<br>
u32 dpfc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = true;<br>
+<br>
dpfc_ctl = DPFC_CTL_PLANE(intel_crtc->plane) | DPFC_SR_EN;<br>
if (drm_format_plane_cpp(fb->pixel_format, 0) == 2)<br>
dpfc_ctl |= DPFC_CTL_LIMIT_2X;<br>
@@ -173,6 +179,8 @@ static void g4x_disable_fbc(struct drm_device *dev)<br>
struct drm_i915_private *dev_priv = dev->dev_private;<br>
u32 dpfc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = false;<br>
+<br>
/* Disable compression */<br>
dpfc_ctl = I915_READ(DPFC_CONTROL);<br>
if (dpfc_ctl & DPFC_CTL_EN) {<br>
@@ -224,6 +232,8 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc)<br>
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);<br>
u32 dpfc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = true;<br>
+<br>
dpfc_ctl = DPFC_CTL_PLANE(intel_crtc->plane);<br>
if (drm_format_plane_cpp(fb->pixel_format, 0) == 2)<br>
dev_priv->fbc.threshold++;<br>
@@ -264,6 +274,8 @@ static void ironlake_disable_fbc(struct drm_device *dev)<br>
struct drm_i915_private *dev_priv = dev->dev_private;<br>
u32 dpfc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = false;<br>
+<br>
/* Disable compression */<br>
dpfc_ctl = I915_READ(ILK_DPFC_CONTROL);<br>
if (dpfc_ctl & DPFC_CTL_EN) {<br>
@@ -290,6 +302,8 @@ static void gen7_enable_fbc(struct drm_crtc *crtc)<br>
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);<br>
u32 dpfc_ctl;<br>
<br>
+ dev_priv->fbc.enabled = true;<br>
+<br>
dpfc_ctl = IVB_DPFC_CTL_PLANE(intel_crtc->plane);<br>
if (drm_format_plane_cpp(fb->pixel_format, 0) == 2)<br>
dev_priv->fbc.threshold++;<br>
@@ -339,16 +353,7 @@ bool intel_fbc_enabled(struct drm_device *dev)<br>
{<br>
struct drm_i915_private *dev_priv = dev->dev_private;<br>
<br>
- /* If it wasn't never enabled by kernel parameter or platform default<br>
- * we can avoid reading registers so many times in vain<br>
- */<br>
- if (!i915.enable_fbc)<br>
- return false;<br>
-<br>
- if (!dev_priv->display.fbc_enabled)<br>
- return false;<br>
-<br>
- return dev_priv->display.fbc_enabled(dev);<br>
+ return dev_priv->fbc.enabled;<br>
}<br>
<br>
void gen8_fbc_sw_flush(struct drm_device *dev, u32 value)<br>
@@ -7360,8 +7365,10 @@ void intel_fini_runtime_pm(struct drm_i915_private *dev_priv)<br>
<br>
static void intel_init_fbc(struct drm_i915_private *dev_priv)<br>
{<br>
- if (!HAS_FBC(dev_priv))<br>
+ if (!HAS_FBC(dev_priv)) {<br>
+ dev_priv->fbc.enabled = false;<br>
return;<br>
+ }<br>
<br>
if (INTEL_INFO(dev_priv)->gen >= 7) {<br>
dev_priv->display.fbc_enabled = ironlake_fbc_enabled;<br>
@@ -7383,6 +7390,8 @@ static void intel_init_fbc(struct drm_i915_private *dev_priv)<br>
/* This value was pulled out of someone's hat */<br>
I915_WRITE(FBC_CONTROL, 500 << FBC_CTL_INTERVAL_SHIFT);<br>
}<br>
+<br>
+ dev_priv->fbc.enabled = dev_priv->display.fbc_enabled(dev_priv->dev);<br>
}<br>
<br>
/* Set up chip specific power management-related functions */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.0<br>
<br>
_______________________________________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org">Intel-gfx@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Rodrigo Vivi</div><div>Blog: <a href="http://blog.vivi.eng.br" target="_blank">http://blog.vivi.eng.br</a></div><div> </div>
</div>