<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:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Thanks for noticing, will fix it in a separate patch since I already merged this.<br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</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);">
Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jay<br>
</div>
</div>
</div>
</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> Chen, Guchun <Guchun.Chen@amd.com><br>
<b>Sent:</b> Thursday, June 9, 2022 9:28 PM<br>
<b>To:</b> Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Olsak, Marek <Marek.Olsak@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Li, Roman <Roman.Li@amd.com>; Qiao, Ken <Ken.Qiao@amd.com>; Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wentland,
 Harry <Harry.Wentland@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/display: ignore modifiers when checking for format support</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">+                                       return true;<br>
+                                       break;<br>
<br>
Possibly a coding style problem, 'break' after 'return' looks redundant.<br>
<br>
Regards,<br>
Guchun<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Aurabindo Pillai<br>
Sent: Thursday, June 9, 2022 10:27 PM<br>
To: Olsak, Marek <Marek.Olsak@amd.com>; amd-gfx@lists.freedesktop.org<br>
Cc: Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Li, Roman <Roman.Li@amd.com>; Qiao, Ken <Ken.Qiao@amd.com>; Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wentland, Harry
 <Harry.Wentland@amd.com><br>
Subject: [PATCH] drm/amd/display: ignore modifiers when checking for format support<br>
<br>
[Why&How]<br>
There are cases where swizzle modes are set but modifiers arent. For such a userspace, we need not check modifiers while checking compatibilty in the drm hook for checking plane format.<br>
<br>
Ignore checking modifiers but check the DCN generation for the supported swizzle mode.<br>
<br>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com><br>
---<br>
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 51 +++++++++++++++++--<br>
 1 file changed, 46 insertions(+), 5 deletions(-)<br>
<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 2023baf41b7e..1322df491736 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>
@@ -4938,6 +4938,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,  {<br>
         struct amdgpu_device *adev = drm_to_adev(plane->dev);<br>
         const struct drm_format_info *info = drm_format_info(format);<br>
+       struct hw_asic_id asic_id = adev->dm.dc->ctx->asic_id;<br>
         int i;<br>
 <br>
         enum dm_micro_swizzle microtile = modifier_gfx9_swizzle_mode(modifier) & 3; @@ -4955,13 +4956,53 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane,<br>
                 return true;<br>
         }<br>
 <br>
-       /* Check that the modifier is on the list of the plane's supported modifiers. */<br>
-       for (i = 0; i < plane->modifier_count; i++) {<br>
-               if (modifier == plane->modifiers[i])<br>
+       /* check if swizzle mode is supported by this version of DCN */<br>
+       switch (asic_id.chip_family) {<br>
+               case FAMILY_SI:<br>
+               case FAMILY_CI:<br>
+               case FAMILY_KV:<br>
+               case FAMILY_CZ:<br>
+               case FAMILY_VI:<br>
+                       /* AI and earlier asics does not have modifier support */<br>
+                       return false;<br>
+                       break;<br>
+               case FAMILY_AI:<br>
+               case FAMILY_RV:<br>
+               case FAMILY_NV:<br>
+               case FAMILY_VGH:<br>
+               case FAMILY_YELLOW_CARP:<br>
+               case AMDGPU_FAMILY_GC_10_3_6:<br>
+               case AMDGPU_FAMILY_GC_10_3_7:<br>
+                       switch (AMD_FMT_MOD_GET(TILE, modifier)) {<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_R_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_D_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_S_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_D:<br>
+                                       return true;<br>
+                                       break;<br>
+                               default:<br>
+                                       return false;<br>
+                                       break;<br>
+                       }<br>
+                       break;<br>
+               case AMDGPU_FAMILY_GC_11_0_0:<br>
+                       switch (AMD_FMT_MOD_GET(TILE, modifier)) {<br>
+                               case AMD_FMT_MOD_TILE_GFX11_256K_R_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_R_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_D_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_S_X:<br>
+                               case AMD_FMT_MOD_TILE_GFX9_64K_D:<br>
+                                       return true;<br>
+                                       break;<br>
+                               default:<br>
+                                       return false;<br>
+                                       break;<br>
+                       }<br>
+                       break;<br>
+               default:<br>
+                       ASSERT(0); /* Unknown asic */<br>
                         break;<br>
         }<br>
-       if (i == plane->modifier_count)<br>
-               return false;<br>
 <br>
         /*<br>
          * For D swizzle the canonical modifier depends on the bpp, so check<br>
--<br>
2.36.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>