Browse Source

amdgpu/dce11: Remove division from dce_v11_0_vblank_wait()

Mimics odd behaviour where (i++ % 100 == 0) is true in the first iteration of each loop...

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tom St Denis 9 years ago
parent
commit
9e4e1ae82f
1 changed files with 5 additions and 3 deletions
  1. 5 3
      drivers/gpu/drm/amd/amdgpu/dce_v11_0.c

+ 5 - 3
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c

@@ -211,7 +211,7 @@ static bool dce_v11_0_is_counter_moving(struct amdgpu_device *adev, int crtc)
  */
  */
 static void dce_v11_0_vblank_wait(struct amdgpu_device *adev, int crtc)
 static void dce_v11_0_vblank_wait(struct amdgpu_device *adev, int crtc)
 {
 {
-	unsigned i = 0;
+	unsigned i = 100;
 
 
 	if (crtc >= adev->mode_info.num_crtc)
 	if (crtc >= adev->mode_info.num_crtc)
 		return;
 		return;
@@ -223,14 +223,16 @@ static void dce_v11_0_vblank_wait(struct amdgpu_device *adev, int crtc)
 	 * wait for another frame.
 	 * wait for another frame.
 	 */
 	 */
 	while (dce_v11_0_is_in_vblank(adev, crtc)) {
 	while (dce_v11_0_is_in_vblank(adev, crtc)) {
-		if (i++ % 100 == 0) {
+		if (i++ == 100) {
+			i = 0;
 			if (!dce_v11_0_is_counter_moving(adev, crtc))
 			if (!dce_v11_0_is_counter_moving(adev, crtc))
 				break;
 				break;
 		}
 		}
 	}
 	}
 
 
 	while (!dce_v11_0_is_in_vblank(adev, crtc)) {
 	while (!dce_v11_0_is_in_vblank(adev, crtc)) {
-		if (i++ % 100 == 0) {
+		if (i++ == 100) {
+			i = 0;
 			if (!dce_v11_0_is_counter_moving(adev, crtc))
 			if (!dce_v11_0_is_counter_moving(adev, crtc))
 				break;
 				break;
 		}
 		}