<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>- /* If 2nd DBuf slice required, enable it here */</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> if (INTEL_GEN(dev_priv) >= 11 && slices_union != hw_enabled_slices)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>- icl_dbuf_slices_update(dev_priv, slices_union);</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>+ gen9_dbuf_slices_update(dev_priv, slices_union);</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>}</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"> </span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> static void icl_dbuf_slice_post_update(struct intel_atomic_state *state)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>@@ -15307,9 +15306,8 @@ static void icl_dbuf_slice_post_update(struct intel_atomic_state *state)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> u8 hw_enabled_slices = dev_priv->enabled_dbuf_slices_mask;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> u8 required_slices = state->enabled_dbuf_slices_mask;</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"> </span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>- /* If 2nd DBuf slice is no more required disable it */</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">> if (INTEL_GEN(dev_priv) >= 11 && required_slices != hw_enabled_slices)</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>- icl_dbuf_slices_update(dev_priv, required_slices);</span><br style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">>+ gen9_dbuf_slices_update(dev_priv, required_slices);</span><br>
</p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">Doesn't make much sense. Just look - previously we were checking if INTEL_GEN is >= than 11(which _is_ ICL)</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">and now we still _do_ check if INTEL_GEN is >= 11, but... call now function renamed to gen9</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px"><br>
</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">I guess you either need to change INTEL_GEN check to be >=9 to at least look somewhat consistent</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">or leave it as is. Or at least rename icl_ prefix to gen11_ otherwise that looks inconsistent, i.e</span></p>
<p><span style="color:rgb(33,33,33); font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont; font-size:13.3333px">you are now checking that gen is >= 11 and then OK - now let's call gen 9! :)</span></p>
<p><br>
</p>
<div id="x_Signature">
<div style="font-family:Tahoma; font-size:13px"><font size="2"><span style="font-size:10pt">Stan</span></font></div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Ville Syrjala <ville.syrjala@linux.intel.com><br>
<b>Sent:</b> Tuesday, February 25, 2020 7:11:12 PM<br>
<b>To:</b> intel-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Lisovskiy, Stanislav<br>
<b>Subject:</b> [PATCH v2 07/20] drm/i915: Unify the low level dbuf code</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">From: Ville Syrjälä <ville.syrjala@linux.intel.com><br>
<br>
The low level dbuf slice code is rather inconsitent with its<br>
functiona naming and organization. Make it more consistent.<br>
<br>
Also share the enable/disable functions between all platforms<br>
since the same code works just fine for all of them.<br>
<br>
Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com><br>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com><br>
---<br>
drivers/gpu/drm/i915/display/intel_display.c | 6 +--<br>
.../drm/i915/display/intel_display_power.c | 44 ++++++++-----------<br>
.../drm/i915/display/intel_display_power.h | 6 +--<br>
3 files changed, 24 insertions(+), 32 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c<br>
index 3031e64ee518..6952c398cc43 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_display.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_display.c<br>
@@ -15296,9 +15296,8 @@ static void icl_dbuf_slice_pre_update(struct intel_atomic_state *state)<br>
u8 required_slices = state->enabled_dbuf_slices_mask;<br>
u8 slices_union = hw_enabled_slices | required_slices;<br>
<br>
- /* If 2nd DBuf slice required, enable it here */<br>
if (INTEL_GEN(dev_priv) >= 11 && slices_union != hw_enabled_slices)<br>
- icl_dbuf_slices_update(dev_priv, slices_union);<br>
+ gen9_dbuf_slices_update(dev_priv, slices_union);<br>
}<br>
<br>
static void icl_dbuf_slice_post_update(struct intel_atomic_state *state)<br>
@@ -15307,9 +15306,8 @@ static void icl_dbuf_slice_post_update(struct intel_atomic_state *state)<br>
u8 hw_enabled_slices = dev_priv->enabled_dbuf_slices_mask;<br>
u8 required_slices = state->enabled_dbuf_slices_mask;<br>
<br>
- /* If 2nd DBuf slice is no more required disable it */<br>
if (INTEL_GEN(dev_priv) >= 11 && required_slices != hw_enabled_slices)<br>
- icl_dbuf_slices_update(dev_priv, required_slices);<br>
+ gen9_dbuf_slices_update(dev_priv, required_slices);<br>
}<br>
<br>
static void skl_commit_modeset_enables(struct intel_atomic_state *state)<br>
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c<br>
index e81e561e8ac0..ce3bbc4c7a27 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_display_power.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c<br>
@@ -4433,15 +4433,18 @@ static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)<br>
mutex_unlock(&power_domains->lock);<br>
}<br>
<br>
-static void intel_dbuf_slice_set(struct drm_i915_private *dev_priv,<br>
- enum dbuf_slice slice, bool enable)<br>
+static void gen9_dbuf_slice_set(struct drm_i915_private *dev_priv,<br>
+ enum dbuf_slice slice, bool enable)<br>
{<br>
i915_reg_t reg = DBUF_CTL_S(slice);<br>
bool state;<br>
u32 val;<br>
<br>
val = intel_de_read(dev_priv, reg);<br>
- val = enable ? (val | DBUF_POWER_REQUEST) : (val & ~DBUF_POWER_REQUEST);<br>
+ if (enable)<br>
+ val |= DBUF_POWER_REQUEST;<br>
+ else<br>
+ val &= ~DBUF_POWER_REQUEST;<br>
intel_de_write(dev_priv, reg, val);<br>
intel_de_posting_read(dev_priv, reg);<br>
udelay(10);<br>
@@ -4452,18 +4455,8 @@ static void intel_dbuf_slice_set(struct drm_i915_private *dev_priv,<br>
slice, enable ? "enable" : "disable");<br>
}<br>
<br>
-static void gen9_dbuf_enable(struct drm_i915_private *dev_priv)<br>
-{<br>
- icl_dbuf_slices_update(dev_priv, BIT(DBUF_S1));<br>
-}<br>
-<br>
-static void gen9_dbuf_disable(struct drm_i915_private *dev_priv)<br>
-{<br>
- icl_dbuf_slices_update(dev_priv, 0);<br>
-}<br>
-<br>
-void icl_dbuf_slices_update(struct drm_i915_private *dev_priv,<br>
- u8 req_slices)<br>
+void gen9_dbuf_slices_update(struct drm_i915_private *dev_priv,<br>
+ u8 req_slices)<br>
{<br>
int num_slices = INTEL_INFO(dev_priv)->num_supported_dbuf_slices;<br>
struct i915_power_domains *power_domains = &dev_priv->power_domains;<br>
@@ -4486,28 +4479,29 @@ void icl_dbuf_slices_update(struct drm_i915_private *dev_priv,<br>
mutex_lock(&power_domains->lock);<br>
<br>
for (slice = DBUF_S1; slice < num_slices; slice++)<br>
- intel_dbuf_slice_set(dev_priv, slice,<br>
- req_slices & BIT(slice));<br>
+ gen9_dbuf_slice_set(dev_priv, slice, req_slices & BIT(slice));<br>
<br>
dev_priv->enabled_dbuf_slices_mask = req_slices;<br>
<br>
mutex_unlock(&power_domains->lock);<br>
}<br>
<br>
-static void icl_dbuf_enable(struct drm_i915_private *dev_priv)<br>
+static void gen9_dbuf_enable(struct drm_i915_private *dev_priv)<br>
{<br>
- skl_ddb_get_hw_state(dev_priv);<br>
+ dev_priv->enabled_dbuf_slices_mask =<br>
+ intel_enabled_dbuf_slices_mask(dev_priv);<br>
+<br>
/*<br>
* Just power up at least 1 slice, we will<br>
* figure out later which slices we have and what we need.<br>
*/<br>
- icl_dbuf_slices_update(dev_priv, dev_priv->enabled_dbuf_slices_mask |<br>
- BIT(DBUF_S1));<br>
+ gen9_dbuf_slices_update(dev_priv, BIT(DBUF_S1) |<br>
+ dev_priv->enabled_dbuf_slices_mask);<br>
}<br>
<br>
-static void icl_dbuf_disable(struct drm_i915_private *dev_priv)<br>
+static void gen9_dbuf_disable(struct drm_i915_private *dev_priv)<br>
{<br>
- icl_dbuf_slices_update(dev_priv, 0);<br>
+ gen9_dbuf_slices_update(dev_priv, 0);<br>
}<br>
<br>
static void icl_mbus_init(struct drm_i915_private *dev_priv)<br>
@@ -5067,7 +5061,7 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,<br>
intel_cdclk_init_hw(dev_priv);<br>
<br>
/* 5. Enable DBUF. */<br>
- icl_dbuf_enable(dev_priv);<br>
+ gen9_dbuf_enable(dev_priv);<br>
<br>
/* 6. Setup MBUS. */<br>
icl_mbus_init(dev_priv);<br>
@@ -5090,7 +5084,7 @@ static void icl_display_core_uninit(struct drm_i915_private *dev_priv)<br>
/* 1. Disable all display engine functions -> aready done */<br>
<br>
/* 2. Disable DBUF */<br>
- icl_dbuf_disable(dev_priv);<br>
+ gen9_dbuf_disable(dev_priv);<br>
<br>
/* 3. Disable CD clock */<br>
intel_cdclk_uninit_hw(dev_priv);<br>
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h b/drivers/gpu/drm/i915/display/intel_display_power.h<br>
index 601e000ffd0d..1a275611241e 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_display_power.h<br>
+++ b/drivers/gpu/drm/i915/display/intel_display_power.h<br>
@@ -312,13 +312,13 @@ enum dbuf_slice {<br>
DBUF_S2,<br>
};<br>
<br>
+void gen9_dbuf_slices_update(struct drm_i915_private *dev_priv,<br>
+ u8 req_slices);<br>
+<br>
#define with_intel_display_power(i915, domain, wf) \<br>
for ((wf) = intel_display_power_get((i915), (domain)); (wf); \<br>
intel_display_power_put_async((i915), (domain), (wf)), (wf) = 0)<br>
<br>
-void icl_dbuf_slices_update(struct drm_i915_private *dev_priv,<br>
- u8 req_slices);<br>
-<br>
void chv_phy_powergate_lanes(struct intel_encoder *encoder,<br>
bool override, unsigned int mask);<br>
bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy,<br>
-- <br>
2.24.1<br>
<br>
</div>
</span></font>
</body>
</html>