* [PATCH] drm/amdgpu: Use the ALIGN() macro
@ 2019-10-03 23:39 Tuikov, Luben
[not found] ` <20191003233902.1982-1-luben.tuikov-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tuikov, Luben @ 2019-10-03 23:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Deucher, Alexander, Tuikov, Luben, Koenig, Christian
Use the ALIGN() macro to set "num_dw" to a
multiple of 8, i.e. lower 3 bits cleared.
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 68c541e11189..73c628bc6a5b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1923,10 +1923,7 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
*addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE *
AMDGPU_GPU_PAGE_SIZE;
- num_dw = adev->mman.buffer_funcs->copy_num_dw;
- while (num_dw & 0x7)
- num_dw++;
-
+ num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
num_bytes = num_pages * 8;
r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job);
@@ -1986,11 +1983,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
max_bytes = adev->mman.buffer_funcs->copy_max_bytes;
num_loops = DIV_ROUND_UP(byte_count, max_bytes);
- num_dw = num_loops * adev->mman.buffer_funcs->copy_num_dw;
-
- /* for IB padding */
- while (num_dw & 0x7)
- num_dw++;
+ num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
if (r)
--
2.23.0.169.g8a3a6817e2
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Use the ALIGN() macro
[not found] ` <20191003233902.1982-1-luben.tuikov-5C7GfCeVMHo@public.gmane.org>
@ 2019-10-04 7:16 ` Christian König
[not found] ` <f4f4bdef-577a-7402-e467-7003be73687a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2019-10-04 7:16 UTC (permalink / raw)
To: Tuikov, Luben, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Deucher, Alexander, Koenig, Christian
Am 04.10.19 um 01:39 schrieb Tuikov, Luben:
> Use the ALIGN() macro to set "num_dw" to a
> multiple of 8, i.e. lower 3 bits cleared.
>
> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 68c541e11189..73c628bc6a5b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1923,10 +1923,7 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
> *addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE *
> AMDGPU_GPU_PAGE_SIZE;
>
> - num_dw = adev->mman.buffer_funcs->copy_num_dw;
> - while (num_dw & 0x7)
> - num_dw++;
> -
> + num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
> num_bytes = num_pages * 8;
>
> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job);
> @@ -1986,11 +1983,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
>
> max_bytes = adev->mman.buffer_funcs->copy_max_bytes;
> num_loops = DIV_ROUND_UP(byte_count, max_bytes);
> - num_dw = num_loops * adev->mman.buffer_funcs->copy_num_dw;
> -
> - /* for IB padding */
> - while (num_dw & 0x7)
> - num_dw++;
> + num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
>
> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
> if (r)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Use the ALIGN() macro
[not found] ` <f4f4bdef-577a-7402-e467-7003be73687a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-10-04 23:29 ` Tuikov, Luben
[not found] ` <911f3f03-3484-f03f-ee89-c6ad6e9ff68f-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tuikov, Luben @ 2019-10-04 23:29 UTC (permalink / raw)
To: Koenig, Christian, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Deucher, Alexander
On 2019-10-04 3:16 a.m., Christian König wrote:
> Am 04.10.19 um 01:39 schrieb Tuikov, Luben:
>> Use the ALIGN() macro to set "num_dw" to a
>> multiple of 8, i.e. lower 3 bits cleared.
>>
>> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
Hi Christian,
No ACK?
I've been running this version of the driver and no problems.
Regards,
Luben
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++---------
>> 1 file changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 68c541e11189..73c628bc6a5b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -1923,10 +1923,7 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
>> *addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE *
>> AMDGPU_GPU_PAGE_SIZE;
>>
>> - num_dw = adev->mman.buffer_funcs->copy_num_dw;
>> - while (num_dw & 0x7)
>> - num_dw++;
>> -
>> + num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
>> num_bytes = num_pages * 8;
>>
>> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job);
>> @@ -1986,11 +1983,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
>>
>> max_bytes = adev->mman.buffer_funcs->copy_max_bytes;
>> num_loops = DIV_ROUND_UP(byte_count, max_bytes);
>> - num_dw = num_loops * adev->mman.buffer_funcs->copy_num_dw;
>> -
>> - /* for IB padding */
>> - while (num_dw & 0x7)
>> - num_dw++;
>> + num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
>>
>> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
>> if (r)
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu: Use the ALIGN() macro
[not found] ` <911f3f03-3484-f03f-ee89-c6ad6e9ff68f-5C7GfCeVMHo@public.gmane.org>
@ 2019-10-05 5:04 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2019-10-05 5:04 UTC (permalink / raw)
To: Tuikov, Luben
Cc: Deucher, Alexander, Koenig, Christian,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On Fri, Oct 4, 2019 at 7:29 PM Tuikov, Luben <Luben.Tuikov@amd.com> wrote:
>
> On 2019-10-04 3:16 a.m., Christian König wrote:
> > Am 04.10.19 um 01:39 schrieb Tuikov, Luben:
> >> Use the ALIGN() macro to set "num_dw" to a
> >> multiple of 8, i.e. lower 3 bits cleared.
> >>
> >> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> >
> > Reviewed-by: Christian König <christian.koenig@amd.com>
>
> Hi Christian,
>
> No ACK?
>
> I've been running this version of the driver and no problems.
>
You can go ahead and commit. You have a reviewed-by.
Alex
> Regards,
> Luben
>
> >
> >> ---
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++---------
> >> 1 file changed, 2 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> >> index 68c541e11189..73c628bc6a5b 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> >> @@ -1923,10 +1923,7 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
> >> *addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE *
> >> AMDGPU_GPU_PAGE_SIZE;
> >>
> >> - num_dw = adev->mman.buffer_funcs->copy_num_dw;
> >> - while (num_dw & 0x7)
> >> - num_dw++;
> >> -
> >> + num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
> >> num_bytes = num_pages * 8;
> >>
> >> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job);
> >> @@ -1986,11 +1983,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
> >>
> >> max_bytes = adev->mman.buffer_funcs->copy_max_bytes;
> >> num_loops = DIV_ROUND_UP(byte_count, max_bytes);
> >> - num_dw = num_loops * adev->mman.buffer_funcs->copy_num_dw;
> >> -
> >> - /* for IB padding */
> >> - while (num_dw & 0x7)
> >> - num_dw++;
> >> + num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
> >>
> >> r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
> >> if (r)
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-05 5:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-03 23:39 [PATCH] drm/amdgpu: Use the ALIGN() macro Tuikov, Luben
[not found] ` <20191003233902.1982-1-luben.tuikov-5C7GfCeVMHo@public.gmane.org>
2019-10-04 7:16 ` Christian König
[not found] ` <f4f4bdef-577a-7402-e467-7003be73687a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-04 23:29 ` Tuikov, Luben
[not found] ` <911f3f03-3484-f03f-ee89-c6ad6e9ff68f-5C7GfCeVMHo@public.gmane.org>
2019-10-05 5:04 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.