<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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);">
Can we drop the Kconfig? With that, the series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><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> Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com><br>
<b>Sent:</b> Thursday, December 17, 2020 11:54 AM<br>
<b>To:</b> Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amd/display: enable idle optimizations for linux (MALL stutter)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[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 <Bhawanpreet.Lakha@amd.com><br>
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
Reviewed-by: Nick Kazlauskas <Nicholas.Kazlauskas@amd.com><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<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>