amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
cover amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
So far, the amdgpu_cs_submit_raw2 is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify the amdgpu_cs_submit_raw2 API.
Thanks,
Ray
Huang Rui (4):
amdgpu: use alloca for dependencies and sem_dependencies
amdgpu: use amdgpu_cs_submit_raw2 in amdgpu_cs_submit
amdgpu: remove the un-used chunk_array
amdgpu: clean up the cs structure variable
amdgpu/amdgpu_cs.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/4 amdgpu: use alloca for dependencies and sem_dependencies
Use alloca instead of malloc, then we don't need free them at the end of this function.
--- amdgpu/amdgpu_cs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
amdgpu/amdgpu_cs.c +2 -4
@@ -295,7 +295,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, }if (ibs_request->number_of_dependencies) { - dependencies =malloc (sizeof (struct drm_amdgpu_cs_chunk_dep ) * + dependencies =alloca (sizeof (struct drm_amdgpu_cs_chunk_dep ) * ibs_request->number_of_dependencies);if (!dependencies) { r = -ENOMEM ;
@@ -326,7 +326,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,LIST_FOR_EACH_ENTRY (sem, sem_list, list) sem_count++;if (sem_count) { - sem_dependencies =malloc (sizeof (struct drm_amdgpu_cs_chunk_dep ) * sem_count); + sem_dependencies =alloca (sizeof (struct drm_amdgpu_cs_chunk_dep ) * sem_count);if (!sem_dependencies) { r = -ENOMEM ; goto error_unlock;
@@ -363,8 +363,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, context->last_seq[ibs_request->ip_type][ibs_request->ip_instance][ibs_request->ring] = ibs_request->seq_no; error_unlock:pthread_mutex_unlock (&context->sequence_mutex); -free (dependencies); -free (sem_dependencies);return r; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 amdgpu: use amdgpu_cs_submit_raw2 in amdgpu_cs_submit
In reply to Huang RuiSo far, amdgpu_cs_submit_raw2 is mainly used for upper layer (Mesa), however, amdgpu_cs_submit is used for current all unit tests. Our intention is that the unit tests can actually verify the API which is really used.
--- amdgpu/amdgpu_cs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
amdgpu/amdgpu_cs.c +5 -3
@@ -226,9 +226,11 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,struct drm_amdgpu_cs_chunk_data *chunk_data;struct drm_amdgpu_cs_chunk_dep *dependencies =NULL ;struct drm_amdgpu_cs_chunk_dep *sem_dependencies =NULL ; +amdgpu_device_handle dev = context->dev;struct list_head *sem_list;amdgpu_semaphore_handle sem, tmp;uint32_t i, size, sem_count =0 ; +uint64_t seq_no;bool user_fence;int r =0 ;
@@ -354,12 +356,12 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, chunks[i].chunk_data = (uint64_t )(uintptr_t )sem_dependencies; } - r =drmCommandWriteRead (context->dev->fd,DRM_AMDGPU_CS , - &cs,sizeof (cs)); + r =amdgpu_cs_submit_raw2 (dev, context, cs.in.bo_list_handle, cs.in.num_chunks, + chunks, &seq_no);if (r) goto error_unlock; - ibs_request->seq_no = cs.out.handle; + ibs_request->seq_no = seq_no; context->last_seq[ibs_request->ip_type][ibs_request->ip_instance][ibs_request->ring] = ibs_request->seq_no; error_unlock:pthread_mutex_unlock (&context->sequence_mutex);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 amdgpu: remove the un-used chunk_array
In reply to Huang RuiThis array won't be used.
--- amdgpu/amdgpu_cs.c | 7 ------- 1 file changed, 7 deletions(-)
amdgpu/amdgpu_cs.c +0 -7
@@ -221,7 +221,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, struct amdgpu_cs_request *ibs_request) {union drm_amdgpu_cs cs; -uint64_t *chunk_array;struct drm_amdgpu_cs_chunk *chunks;struct drm_amdgpu_cs_chunk_data *chunk_data;struct drm_amdgpu_cs_chunk_dep *dependencies =NULL ;
@@ -246,7 +245,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, size = ibs_request->number_of_ibs + (user_fence ?2 :1 ) +1 ; - chunk_array =alloca (sizeof (uint64_t ) * size); chunks =alloca (sizeof (struct drm_amdgpu_cs_chunk ) * size); size = ibs_request->number_of_ibs + (user_fence ?1 :0 );
@@ -254,7 +252,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, chunk_data =alloca (sizeof (struct drm_amdgpu_cs_chunk_data ) * size);memset (&cs,0 ,sizeof (cs)); - cs.in.chunks = (uint64_t )(uintptr_t )chunk_array; cs.in.ctx_id = context->id;if (ibs_request->resources) cs.in.bo_list_handle = ibs_request->resources->handle;
@@ -262,7 +259,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,/* IB chunks */ for (i =0 ; i < ibs_request->number_of_ibs; i++) {struct amdgpu_cs_ib_info *ib; - chunk_array[i] = (uint64_t )(uintptr_t )&chunks[i]; chunks[i].chunk_id =AMDGPU_CHUNK_ID_IB ; chunks[i].length_dw =sizeof (struct drm_amdgpu_cs_chunk_ib ) /4 ; chunks[i].chunk_data = (uint64_t )(uintptr_t )&chunk_data[i];
@@ -284,7 +280,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, i = cs.in.num_chunks++;/* fence chunk */ - chunk_array[i] = (uint64_t )(uintptr_t )&chunks[i]; chunks[i].chunk_id =AMDGPU_CHUNK_ID_FENCE ; chunks[i].length_dw =sizeof (struct drm_amdgpu_cs_chunk_fence ) /4 ; chunks[i].chunk_data = (uint64_t )(uintptr_t )&chunk_data[i];
@@ -317,7 +312,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, i = cs.in.num_chunks++;/* dependencies chunk */ - chunk_array[i] = (uint64_t )(uintptr_t )&chunks[i]; chunks[i].chunk_id =AMDGPU_CHUNK_ID_DEPENDENCIES ; chunks[i].length_dw =sizeof (struct drm_amdgpu_cs_chunk_dep ) /4 * ibs_request->number_of_dependencies;
@@ -350,7 +344,6 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, i = cs.in.num_chunks++;/* dependencies chunk */ - chunk_array[i] = (uint64_t )(uintptr_t )&chunks[i]; chunks[i].chunk_id =AMDGPU_CHUNK_ID_DEPENDENCIES ; chunks[i].length_dw =sizeof (struct drm_amdgpu_cs_chunk_dep ) /4 * sem_count; chunks[i].chunk_data = (uint64_t )(uintptr_t )sem_dependencies;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 amdgpu: clean up the cs structure variable
In reply to Huang RuiThis patch is to use generic variables as the input of amdgpu_cs_submit_raw2. Because amdgpu_cs_submit_one won't handle IOCTL directly.
--- amdgpu/amdgpu_cs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
amdgpu/amdgpu_cs.c +7 -10
@@ -220,7 +220,6 @@ drm_public int amdgpu_cs_query_reset_state2(amdgpu_context_handle context,static int amdgpu_cs_submit_one (amdgpu_context_handle context,struct amdgpu_cs_request *ibs_request) { -union drm_amdgpu_cs cs;struct drm_amdgpu_cs_chunk *chunks;struct drm_amdgpu_cs_chunk_data *chunk_data;struct drm_amdgpu_cs_chunk_dep *dependencies =NULL ;
@@ -228,7 +227,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,amdgpu_device_handle dev = context->dev;struct list_head *sem_list;amdgpu_semaphore_handle sem, tmp; -uint32_t i, size, sem_count =0 ; +uint32_t i, size, num_chunks, bo_list_handle =0 , sem_count =0 ;uint64_t seq_no;bool user_fence;int r =0 ;
@@ -251,11 +250,9 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, chunk_data =alloca (sizeof (struct drm_amdgpu_cs_chunk_data ) * size); -memset (&cs,0 ,sizeof (cs)); - cs.in.ctx_id = context->id;if (ibs_request->resources) - cs.in.bo_list_handle = ibs_request->resources->handle; - cs.in.num_chunks = ibs_request->number_of_ibs; + bo_list_handle = ibs_request->resources->handle; + num_chunks = ibs_request->number_of_ibs;/* IB chunks */ for (i =0 ; i < ibs_request->number_of_ibs; i++) {struct amdgpu_cs_ib_info *ib;
@@ -277,7 +274,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,pthread_mutex_lock (&context->sequence_mutex);if (user_fence) { - i = cs.in.num_chunks++; + i = num_chunks++;/* fence chunk */ chunks[i].chunk_id =AMDGPU_CHUNK_ID_FENCE ;
@@ -309,7 +306,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, dep->handle = info->fence; } - i = cs.in.num_chunks++; + i = num_chunks++;/* dependencies chunk */ chunks[i].chunk_id =AMDGPU_CHUNK_ID_DEPENDENCIES ;
@@ -341,7 +338,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,amdgpu_cs_reset_sem (sem);amdgpu_cs_unreference_sem (sem); } - i = cs.in.num_chunks++; + i = num_chunks++;/* dependencies chunk */ chunks[i].chunk_id =AMDGPU_CHUNK_ID_DEPENDENCIES ;
@@ -349,7 +346,7 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context, chunks[i].chunk_data = (uint64_t )(uintptr_t )sem_dependencies; } - r =amdgpu_cs_submit_raw2 (dev, context, cs.in.bo_list_handle, cs.in.num_chunks, + r =amdgpu_cs_submit_raw2 (dev, context, bo_list_handle, num_chunks, chunks, &seq_no);if (r) goto error_unlock;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Looks good on first glance, but Marek and/or Pierre can probably better judge than me.
Christian.
Am 11.02.20 um 12:22 schrieb Huang Rui:
Quoted 7 lines
So far, the
amdgpu_cs_submit_raw2is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify theamdgpu_cs_submit_raw2API.Thanks,
Ray
Quoted 9 lines
Huang Rui (4):
amdgpu: use alloca for dependencies andsem_dependencies
amdgpu: useamdgpu_cs_submit_raw2inamdgpu_cs_submit
amdgpu: remove the un-usedchunk_array
amdgpu: clean up the cs structure variableamdgpu/amdgpu_cs.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Also, libdrm changes should go through a gitlab MR now.
Alex
________________________________
From: Christian König <[email protected]>
Sent: Tuesday, February 11, 2020 6:39 AM
To: Huang, Ray <[email protected]>; [email protected] <[email protected]>
Cc: Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
Looks good on first glance, but Marek and/or Pierre can probably better judge than me.
Christian.
Am 11.02.20 um 12:22 schrieb Huang Rui:
Quoted 7 lines
So far, the
amdgpu_cs_submit_raw2is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify theamdgpu_cs_submit_raw2API.Thanks,
Ray
Quoted 9 lines
Huang Rui (4):
amdgpu: use alloca for dependencies andsem_dependencies
amdgpu: useamdgpu_cs_submit_raw2inamdgpu_cs_submit
amdgpu: remove the un-usedchunk_array
amdgpu: clean up the cs structure variableamdgpu/amdgpu_cs.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Hi Alex,
MR = merge request? Should I create account to send merge request in the freedesktop gitlab?
Thanks,
Ray
From: Deucher, Alexander <[email protected]>
Sent: Tuesday, February 11, 2020 10:30 PM
To: Christian König <[email protected]>; Huang, Ray <[email protected]>; [email protected]
Cc: Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
[AMD Public Use]
Also, libdrm changes should go through a gitlab MR now.
Alex
________________________________
From: Christian König <[email protected]<mailto:[email protected]>>
Sent: Tuesday, February 11, 2020 6:39 AM
To: Huang, Ray <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Pelloux-prayer, Pierre-eric <[email protected]<mailto:[email protected]>>; Olsak, Marek <[email protected]<mailto:[email protected]>>; Liu, Aaron <[email protected]<mailto:[email protected]>>; Tuikov, Luben <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
Looks good on first glance, but Marek and/or Pierre can probably better judge than me.
Christian.
Am 11.02.20 um 12:22 schrieb Huang Rui:
Quoted 7 lines
So far, the
amdgpu_cs_submit_raw2is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify theamdgpu_cs_submit_raw2API.Thanks,
Ray
Quoted 9 lines
Huang Rui (4):
amdgpu: use alloca for dependencies andsem_dependencies
amdgpu: useamdgpu_cs_submit_raw2inamdgpu_cs_submit
amdgpu: remove the un-usedchunk_array
amdgpu: clean up the cs structure variableamdgpu/amdgpu_cs.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Yes, correct.
Alex
________________________________
From: Huang, Ray <[email protected]>
Sent: Tuesday, February 11, 2020 9:35 AM
To: Deucher, Alexander <[email protected]>; Christian König <[email protected]>; [email protected] <[email protected]>
Cc: Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
[AMD Public Use]
Hi Alex,
MR = merge request? Should I create account to send merge request in the freedesktop gitlab?
Thanks,
Ray
From: Deucher, Alexander <[email protected]>
Sent: Tuesday, February 11, 2020 10:30 PM
To: Christian König <[email protected]>; Huang, Ray <[email protected]>; [email protected]
Cc: Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
[AMD Public Use]
Also, libdrm changes should go through a gitlab MR now.
Alex
________________________________
From: Christian König <[email protected]<mailto:[email protected]>>
Sent: Tuesday, February 11, 2020 6:39 AM
To: Huang, Ray <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Pelloux-prayer, Pierre-eric <[email protected]<mailto:[email protected]>>; Olsak, Marek <[email protected]<mailto:[email protected]>>; Liu, Aaron <[email protected]<mailto:[email protected]>>; Tuikov, Luben <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH libdrm 0/4] amdgpu: use amdgpu_cs_submit_raw2 for amdgpu tests
Looks good on first glance, but Marek and/or Pierre can probably better judge than me.
Christian.
Am 11.02.20 um 12:22 schrieb Huang Rui:
Quoted 7 lines
So far, the
amdgpu_cs_submit_raw2is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify theamdgpu_cs_submit_raw2API.Thanks,
Ray
Quoted 9 lines
Huang Rui (4):
amdgpu: use alloca for dependencies andsem_dependencies
amdgpu: useamdgpu_cs_submit_raw2inamdgpu_cs_submit
amdgpu: remove the un-usedchunk_array
amdgpu: clean up the cs structure variableamdgpu/amdgpu_cs.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Looks fine to me as well. Just as Christian said, would have to be approved by Marek.
Regards,
Luben
Quoted 57 lines · Alexander
Yes, correct.
Alex
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Huang, Ray <[email protected]>
*Sent:* Tuesday, February 11, 2020 9:35 AM
*To:* Deucher, Alexander <[email protected]>; Christian König <[email protected]>; [email protected] <[email protected]>
*Cc:* Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]> *Subject:* RE: [PATCH libdrm 0/4] amdgpu: useamdgpu_cs_submit_raw2for amdgpu tests[AMD Public Use]
Hi Alex,
MR = merge request? Should I create account to send merge request in the freedesktop gitlab?
Thanks,
Ray
*From:* Deucher, Alexander <[email protected]>
*Sent:* Tuesday, February 11, 2020 10:30 PM
*To:* Christian König <[email protected]>; Huang, Ray <[email protected]>; [email protected]
*Cc:* Pelloux-prayer, Pierre-eric <[email protected]>; Olsak, Marek <[email protected]>; Liu, Aaron <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]> *Subject:* Re: [PATCH libdrm 0/4] amdgpu: useamdgpu_cs_submit_raw2for amdgpu tests[AMD Public Use]
Also, libdrm changes should go through a gitlab MR now.
Alex
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:*Christian König <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, February 11, 2020 6:39 AM
*To:* Huang, Ray <[email protected] <mailto:[email protected]>>; [email protected] <mailto:[email protected]><[email protected] <mailto:[email protected]>>
*Cc:* Pelloux-prayer, Pierre-eric <[email protected] <mailto:[email protected]>>; Olsak, Marek <[email protected] <mailto:[email protected]>>; Liu, Aaron <[email protected] <mailto:[email protected]>>; Tuikov, Luben <[email protected] <mailto:[email protected]>>; Deucher, Alexander <[email protected] <mailto:[email protected]>>; Koenig, Christian <[email protected] <mailto:[email protected]>> *Subject:* Re: [PATCH libdrm 0/4] amdgpu: useamdgpu_cs_submit_raw2for amdgpu tests
Quoted 25 lines
Looks good on first glance, but Marek and/or Pierre can probably better judge than me.
Christian.
Am 11.02.20 um 12:22 schrieb Huang Rui:
Quoted 16 lines
So far, the
amdgpu_cs_submit_raw2is used for MesaGL, however the amdgpu tests still use the legacy interface. So we would like to make amdgpu tests verify theamdgpu_cs_submit_raw2API.Thanks,
RayHuang Rui (4):
amdgpu: use alloca for dependencies andsem_dependencies
amdgpu: useamdgpu_cs_submit_raw2inamdgpu_cs_submit
amdgpu: remove the un-usedchunk_array
amdgpu: clean up the cs structure variable
amdgpu/amdgpu_cs.c| 36 +++++++++++++-----------------------1 file changed, 13 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx