[2/8] drm/amdgpu: cleanup VM dw estimation a bit

Submitted by Christian König on Feb. 4, 2019, 12:42 p.m.

Details

Message ID 20190204124256.1765-2-christian.koenig@amd.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Christian König Feb. 4, 2019, 12:42 p.m.
No functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 44950f3b8801..69b0bee0661e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1804,13 +1804,12 @@  static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 	/*
 	 * reserve space for two commands every (1 << BLOCK_SIZE)
 	 *  entries or 2k dwords (whatever is smaller)
-         *
-         * The second command is for the shadow pagetables.
 	 */
+	ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);
+
+         /* The second command is for the shadow pagetables. */
 	if (vm->root.base.bo->shadow)
-		ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1) * 2;
-	else
-		ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);
+		ncmds *= 2;
 
 	/* padding, etc. */
 	ndw = 64;
@@ -1829,10 +1828,11 @@  static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 		ndw += ncmds * 10;
 
 		/* extra commands for begin/end fragments */
+		ncmds = 2 * adev->vm_manager.fragment_size;
 		if (vm->root.base.bo->shadow)
-		        ndw += 2 * 10 * adev->vm_manager.fragment_size * 2;
-		else
-		        ndw += 2 * 10 * adev->vm_manager.fragment_size;
+			ncmds *= 2;
+
+		ndw += 10 * ncmds;
 
 		params.func = amdgpu_vm_do_set_ptes;
 	}

Comments

Kuehling, Felix Feb. 4, 2019, 8:20 p.m.
On 2019-02-04 7:42 a.m., Christian König wrote:
> No functional change.

>

> Signed-off-by: Christian König <christian.koenig@amd.com>


Minor indentation issue inline. With that fixed, this patch is 
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>



> ---

>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 ++++++++--------

>   1 file changed, 8 insertions(+), 8 deletions(-)

>

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> index 44950f3b8801..69b0bee0661e 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

> @@ -1804,13 +1804,12 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,

>   	/*

>   	 * reserve space for two commands every (1 << BLOCK_SIZE)

>   	 *  entries or 2k dwords (whatever is smaller)

> -         *

> -         * The second command is for the shadow pagetables.

>   	 */

> +	ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);

> +

> +         /* The second command is for the shadow pagetables. */


Using space instead of TABs.


>   	if (vm->root.base.bo->shadow)

> -		ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1) * 2;

> -	else

> -		ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);

> +		ncmds *= 2;

>   

>   	/* padding, etc. */

>   	ndw = 64;

> @@ -1829,10 +1828,11 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,

>   		ndw += ncmds * 10;

>   

>   		/* extra commands for begin/end fragments */

> +		ncmds = 2 * adev->vm_manager.fragment_size;

>   		if (vm->root.base.bo->shadow)

> -		        ndw += 2 * 10 * adev->vm_manager.fragment_size * 2;

> -		else

> -		        ndw += 2 * 10 * adev->vm_manager.fragment_size;

> +			ncmds *= 2;

> +

> +		ndw += 10 * ncmds;

>   

>   		params.func = amdgpu_vm_do_set_ptes;

>   	}