<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size:12pt">Hi Kenneth,<br>
<br>
<span style="font-size:12pt">The patches currently have the Kconfig so make sure to enable that first.</span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size:12pt"><span style="font-size:12pt"></span><br>
</span><span style="font-size:12pt">And dc_allow_idle_optimizations() will be called when all the vblank irqs are off. On Ubuntu, this will happen after the desktop is idle for a few seconds.
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Bhawan<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Sent:</b> December 18, 2020 12:46 AM<br>
<b>To:</b> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> RE: [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:DengXian}
@font-face
{font-family:Calibri}
@font-face
{}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
span.x_EmailStyle18
{font-family:"Calibri",sans-serif;
color:windowtext}
p.x_msipheader251902e5, li.x_msipheader251902e5, div.x_msipheader251902e5
{margin-right:0in;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
.x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<p align="Left" style="font-family:Arial; font-size:10pt; color:#317100; margin:15pt">
[AMD Public Use]<br>
</p>
<br>
<div>
<div class="x_WordSection1">
<p class="x_msipheader251902e5" style="margin:0in"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"><span style="font-size:12.0pt">Hi Bhawanpreet,</span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt">With the two patches, I still can’t see that dc_allow_idle_optimizations(struct dc *dc, bool allow) is called with allow = true after modprobe and startx.</span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt">Is there anything else missing?</span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt"> </span></p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt">Best Regards</span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt">Kenneth</span></p>
</div>
<p class="x_MsoNormal"><span style="font-size:12.0pt"> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Lakha, Bhawanpreet<br>
<b>Sent:</b> Friday, December 18, 2020 1:42 AM<br>
<b>To:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<p class="x_MsoNormal">[CAUTION: External Email] </p>
<div>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Actually, I will drop the guards and if we see issues related to this, we can block it.</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Bhawan</span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Lakha, Bhawanpreet <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>><br>
<b>Sent:</b> December 17, 2020 12:32 PM<br>
<b>To:</b> Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>; Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">I would but MALL is not fully validated so it might cause underflow issues if we keep it enabled by default. I can create a feature flag mask if that helps?</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Bhawan</span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
<b>Sent:</b> December 17, 2020 12:04 PM<br>
<b>To:</b> Lakha, Bhawanpreet <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>>; Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Can we drop the Kconfig? With that, the series is:</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Acked-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>></span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_x_x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Bhawanpreet Lakha <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>><br>
<b>Sent:</b> Thursday, December 17, 2020 11:54 AM<br>
<b>To:</b> Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>>; Lakha, Bhawanpreet <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>>;
Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>><br>
<b>Subject:</b> [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt">[Why]<br>
We can only use this feature when the display is idle. When active vblank<br>
irq count is 0 we know all the displays are idle.<br>
<br>
[How]<br>
-Add a active vblank irq counter<br>
-Update the counter when we enable/disable vblank irq<br>
-if vblank irq count is 0 we can consider mall stutter<br>
<br>
Change-Id: Ib1e14a84ee2e8c6e057072128693449665012584<br>
Signed-off-by: Bhawanpreet Lakha <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>><br>
Acked-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>><br>
Reviewed-by: Nick Kazlauskas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/display/Kconfig | 6 +++++<br>
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 22 +++++++++++++++++++<br>
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 9 ++++++++<br>
drivers/gpu/drm/amd/display/dc/dc.h | 3 +++<br>
4 files changed, 40 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig<br>
index 797b5d4b43e5..2444e664c7ee 100644<br>
--- a/drivers/gpu/drm/amd/display/Kconfig<br>
+++ b/drivers/gpu/drm/amd/display/Kconfig<br>
@@ -23,6 +23,12 @@ config DRM_AMD_DC_HDCP<br>
help<br>
Choose this option if you want to support HDCP authentication.<br>
<br>
+config DRM_AMD_DC_MALL<br>
+ bool "Enable MALL support"<br>
+ depends on DRM_AMD_DC<br>
+ help<br>
+ Choose this option if you want to support MALL<br>
+<br>
config DRM_AMD_DC_SI<br>
bool "AMD DC support for Southern Islands ASICs"<br>
default n<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
index a78ec16418b3..080f2a52cfed 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
@@ -5479,6 +5479,7 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)<br>
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);<br>
struct amdgpu_device *adev = drm_to_adev(crtc->dev);<br>
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);<br>
+ struct amdgpu_display_manager *dm = &adev->dm;<br>
int rc = 0;<br>
<br>
if (enable) {<br>
@@ -5494,7 +5495,28 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)<br>
return rc;<br>
<br>
irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst;<br>
+#if defined(CONFIG_DRM_AMD_DC_MALL)<br>
+<br>
+ if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))<br>
+ return -EBUSY;<br>
+<br>
+ mutex_lock(&dm->dc_lock);<br>
+<br>
+ if (enable)<br>
+ dm->active_vblank_irq_count++;<br>
+ else<br>
+ dm->active_vblank_irq_count--;<br>
+<br>
+ dc_allow_idle_optimizations(<br>
+ adev->dm.dc, dm->active_vblank_irq_count == 0 ? true : false);<br>
+<br>
+ DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);<br>
+ mutex_unlock(&dm->dc_lock);<br>
+<br>
+ return 0;<br>
+#else<br>
return dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;<br>
+#endif<br>
}<br>
<br>
static int dm_enable_vblank(struct drm_crtc *crtc)<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h<br>
index 251af783f6b1..cab44bbd2e35 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h<br>
@@ -336,6 +336,15 @@ struct amdgpu_display_manager {<br>
*/<br>
const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;<br>
<br>
+#if defined(CONFIG_DRM_AMD_DC_MALL)<br>
+ /**<br>
+ * @active_vblank_irq_count<br>
+ *<br>
+ * number of currently active vblank irqs<br>
+ */<br>
+ uint32_t active_vblank_irq_count;<br>
+#endif<br>
+<br>
#ifdef CONFIG_DEBUG_FS<br>
/* set the crc calculation window*/<br>
struct drm_property *crc_win_x_start_property;<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h<br>
index 33642566bcb2..9d245033eb3d 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dc.h<br>
+++ b/drivers/gpu/drm/amd/display/dc/dc.h<br>
@@ -504,6 +504,9 @@ struct dc_debug_options {<br>
bool dmcub_emulation;<br>
#if defined(CONFIG_DRM_AMD_DC_DCN)<br>
bool disable_idle_power_optimizations;<br>
+#endif<br>
+#ifdef CONFIG_DRM_AMD_DC_MALL<br>
+ unsigned int mall_size_override;<br>
#endif<br>
bool dmub_command_table; /* for testing only */<br>
struct dc_bw_validation_profile bw_val_profile;<br>
-- <br>
2.25.1</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>