[15/15] drm/amdgpu: use the new ring ib and dma frame size callbacks

Submitted by Alex Deucher on Sept. 16, 2016, 4:05 p.m.

Details

Message ID 1474041952-2378-15-git-send-email-alexander.deucher@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Alex Deucher Sept. 16, 2016, 4:05 p.m.
Use them to more accurately determine the ring size required
for ib submission.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 2aa741c..ac08ae7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -125,7 +125,7 @@  int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	unsigned patch_offset = ~0;
 	struct amdgpu_vm *vm;
 	uint64_t fence_ctx;
-	uint32_t status = 0;
+	uint32_t status = 0, alloc_size;
 
 	unsigned i;
 	int r = 0;
@@ -152,7 +152,11 @@  int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		return -EINVAL;
 	}
 
-	r = amdgpu_ring_alloc(ring, 256 * num_ibs);
+	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
+		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
+	alloc_size = (alloc_size + ring->align_mask) & ~ring->align_mask;
+
+	r = amdgpu_ring_alloc(ring, alloc_size);
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
 		return r;

Comments

Am 16.09.2016 um 18:05 schrieb Alex Deucher:
> Use them to more accurately determine the ring size required
> for ib submission.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index 2aa741c..ac08ae7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -125,7 +125,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
>   	unsigned patch_offset = ~0;
>   	struct amdgpu_vm *vm;
>   	uint64_t fence_ctx;
> -	uint32_t status = 0;
> +	uint32_t status = 0, alloc_size;
>   
>   	unsigned i;
>   	int r = 0;
> @@ -152,7 +152,11 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
>   		return -EINVAL;
>   	}
>   
> -	r = amdgpu_ring_alloc(ring, 256 * num_ibs);
> +	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
> +		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
> +	alloc_size = (alloc_size + ring->align_mask) & ~ring->align_mask;
amdgpu_ring_alloc() is doing this anyway, so this is superfluous here.

With that fixed the whole series is Reviewed-by: Christian König 
<christian.koenig@amd.com>.

Regards,
Christian.

> +
> +	r = amdgpu_ring_alloc(ring, alloc_size);
>   	if (r) {
>   		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
>   		return r;