<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div dir="auto"><span style="font-family:-apple-system, HelveticaNeue;font-size:14.6667px;display:inline !important">Reviewed-by: Srinivasan Shanmugam <</span><a href="mailto:srinivasan.shanmugam@amd.com" class="ms-outlook-linkify" style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; color: rgb(0, 120, 212);">srinivasan.shanmugam@amd.com</a><span style="font-family:-apple-system, HelveticaNeue;font-size:14.6667px;display:inline !important">></span><br>
</div>
<div><br>
</div>
<div id="ms-outlook-mobile-signature" dir="auto">Get <a href="https://aka.ms/AAb9ysg">
Outlook for Android</a></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> LIPSKI, IVAN <IVAN.LIPSKI@amd.com><br>
<b>Sent:</b> Friday, June 7, 2024 10:03:58 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Choi, Nicholas <Nicholas.Choi@amd.com>; Zhang, George <George.Zhang@amd.com>;
 alex.deucher@amd.com <alex.deucher@amd.com>; LIPSKI, IVAN <IVAN.LIPSKI@amd.com><br>
<b>Subject:</b> [PATCH 1/2] Revert "drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Ivan Lipski <ivlipski@amd.com><br>
<br>
[WHY]<br>
This commit introduced a regression with kms_plane_cursor IGT<br>
tests, causing AMD Asics to fail these tests.<br>
<br>
This reverts commit 14bcf29b706f8ef423b86c9b783055b5b0c2cd35.<br>
<br>
Signed-off-by: Ivan Lipski <ivlipski@amd.com><br>
---<br>
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 ++++------------<br>
 1 file changed, 4 insertions(+), 12 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 27acbe3ff57b..448932ac06fb 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>
@@ -8637,22 +8637,14 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane,<br>
 {<br>
         struct amdgpu_device *adev = drm_to_adev(plane->dev);<br>
         struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(plane->state->fb);<br>
-       struct drm_crtc *crtc;<br>
-       struct dm_crtc_state *crtc_state;<br>
-       struct amdgpu_crtc *amdgpu_crtc;<br>
-       u64 address;<br>
+       struct drm_crtc *crtc = afb ? plane->state->crtc : old_plane_state->crtc;<br>
+       struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;<br>
+       struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);<br>
+       uint64_t address = afb ? afb->address : 0;<br>
         struct dc_cursor_position position = {0};<br>
         struct dc_cursor_attributes attributes;<br>
         int ret;<br>
 <br>
-       if (!afb)<br>
-               return;<br>
-<br>
-       crtc = plane->state->crtc ? plane->state->crtc : old_plane_state->crtc;<br>
-       crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;<br>
-       amdgpu_crtc = to_amdgpu_crtc(crtc);<br>
-       address = afb->address;<br>
-<br>
         if (!plane->state->fb && !old_plane_state->fb)<br>
                 return;<br>
 <br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>