OSDN Git Service

drm/amdgpu: Add comment to describe the purpose of one difficult if statement
authorAlex Xie <AlexBin.Xie@amd.com>
Mon, 6 Jun 2016 22:14:57 +0000 (18:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:51:26 +0000 (14:51 -0400)
Use == instead of != in the if statement to make code easier understood

Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 00cb589..8dafbd3 100644 (file)
@@ -780,8 +780,13 @@ static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
                next_pe_start = amdgpu_bo_gpu_offset(pt);
                next_pe_start += (addr & mask) * 8;
 
-               if (cur_pe_end != next_pe_start) {
-
+               if (cur_pe_end == next_pe_start) {
+                       /* The next ptb is consecutive to current ptb.
+                        * Don't call amdgpu_vm_frag_ptes now.
+                        * Will update two ptbs together in future.
+                       */
+                       cur_pe_end += 8 * nptes;
+               } else {
                        amdgpu_vm_frag_ptes(adev, vm_update_params,
                                            cur_pe_start, cur_pe_end,
                                            cur_dst, flags);
@@ -789,8 +794,6 @@ static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
                        cur_pe_start = next_pe_start;
                        cur_pe_end = next_pe_start + 8 * nptes;
                        cur_dst = dst;
-               } else {
-                       cur_pe_end += 8 * nptes;
                }
 
                addr += nptes;