<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Monday, July 29, 2019 12:20 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> [PATCH] drm/amdgpu: Update pitch on page flips without DC as well</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
DC already handles this correctly since amdgpu minor version 31. Bump<br>
the minor version again so that xf86-video-amdgpu can take advantage of<br>
this working without DC as well now.<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
<br>
See <a href="https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/39">
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/39</a><br>
for the corresponding xf86-video-amdgpu change.<br>
<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-<br>
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c  | 4 ++++<br>
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c  | 4 ++++<br>
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c   | 4 ++++<br>
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c   | 4 ++++<br>
 5 files changed, 18 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
index 800d0ceb14b4..cf334c465805 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
@@ -77,9 +77,10 @@<br>
  * - 3.31.0 - Add support for per-flip tiling attribute changes with DC<br>
  * - 3.32.0 - Add syncobj timeline support to AMDGPU_CS.<br>
  * - 3.33.0 - Fixes for GDS ENOMEM failures in AMDGPU_CS.<br>
+ * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches<br>
  */<br>
 #define KMS_DRIVER_MAJOR        3<br>
-#define KMS_DRIVER_MINOR       33<br>
+#define KMS_DRIVER_MINOR       34<br>
 #define KMS_DRIVER_PATCHLEVEL   0<br>
 <br>
 #define AMDGPU_MAX_TIMEOUT_PARAM_LENTH  256<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c<br>
index 1f0426d2fc2a..c609b7af0b6b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c<br>
@@ -233,6 +233,7 @@ static void dce_v10_0_page_flip(struct amdgpu_device *adev,<br>
                                 int crtc_id, u64 crtc_base, bool async)<br>
 {<br>
         struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id];<br>
+       struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb;<br>
         u32 tmp;<br>
 <br>
         /* flip at hsync for async, default is vsync */<br>
@@ -240,6 +241,9 @@ static void dce_v10_0_page_flip(struct amdgpu_device *adev,<br>
         tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL,<br>
                             GRPH_SURFACE_UPDATE_H_RETRACE_EN, async ? 1 : 0);<br>
         WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp);<br>
+       /* update pitch */<br>
+       WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset,<br>
+              fb->pitches[0] / fb->format->cpp[0]);<br>
         /* update the primary scanout address */<br>
         WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset,<br>
                upper_32_bits(crtc_base));<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c<br>
index 2280b971d758..719db058b306 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c<br>
@@ -251,6 +251,7 @@ static void dce_v11_0_page_flip(struct amdgpu_device *adev,<br>
                                 int crtc_id, u64 crtc_base, bool async)<br>
 {<br>
         struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id];<br>
+       struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb;<br>
         u32 tmp;<br>
 <br>
         /* flip immediate for async, default is vsync */<br>
@@ -258,6 +259,9 @@ static void dce_v11_0_page_flip(struct amdgpu_device *adev,<br>
         tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL,<br>
                             GRPH_SURFACE_UPDATE_IMMEDIATE_EN, async ? 1 : 0);<br>
         WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp);<br>
+       /* update pitch */<br>
+       WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset,<br>
+              fb->pitches[0] / fb->format->cpp[0]);<br>
         /* update the scanout addresses */<br>
         WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset,<br>
                upper_32_bits(crtc_base));<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c<br>
index bea32f076b91..8ee99651d01a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c<br>
@@ -186,10 +186,14 @@ static void dce_v6_0_page_flip(struct amdgpu_device *adev,<br>
                                int crtc_id, u64 crtc_base, bool async)<br>
 {<br>
         struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id];<br>
+       struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb;<br>
 <br>
         /* flip at hsync for async, default is vsync */<br>
         WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ?<br>
                GRPH_FLIP_CONTROL__GRPH_SURFACE_UPDATE_H_RETRACE_EN_MASK : 0);<br>
+       /* update pitch */<br>
+       WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset,<br>
+              fb->pitches[0] / fb->format->cpp[0]);<br>
         /* update the scanout addresses */<br>
         WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset,<br>
                upper_32_bits(crtc_base));<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c<br>
index 13da915991dd..7037e016493c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c<br>
@@ -181,10 +181,14 @@ static void dce_v8_0_page_flip(struct amdgpu_device *adev,<br>
                                int crtc_id, u64 crtc_base, bool async)<br>
 {<br>
         struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id];<br>
+       struct drm_framebuffer *fb = amdgpu_crtc->base.primary->fb;<br>
 <br>
         /* flip at hsync for async, default is vsync */<br>
         WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ?<br>
                GRPH_FLIP_CONTROL__GRPH_SURFACE_UPDATE_H_RETRACE_EN_MASK : 0);<br>
+       /* update pitch */<br>
+       WREG32(mmGRPH_PITCH + amdgpu_crtc->crtc_offset,<br>
+              fb->pitches[0] / fb->format->cpp[0]);<br>
         /* update the primary scanout addresses */<br>
         WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset,<br>
                upper_32_bits(crtc_base));<br>
-- <br>
2.22.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>