[PATCH i-g-t v2 1/2] lib/amdgpu: Generalize command submission NOP function

Jesse.Zhang Jesse.Zhang at amd.com
Tue Jun 24 08:05:29 UTC 2025


Rename and refactor amdgpu_command_submission_compute_nop() to be more
generic:
- Renamed to amdgpu_command_submission_nop()
- Added type parameter to specify IP block type (COMPUTE/DMA/etc)
- Updated all related queue create/submit/destroy calls to use the type
- Added include for amd_ip_blocks.h in header
- Updated function prototype in header file

This change makes the NOP submission function reusable across different
IP blocks rather than being compute-specific. The function now takes
the IP block type as a parameter and uses it for queue operations.

Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
---
 lib/amdgpu/amd_compute.c | 8 ++++----
 lib/amdgpu/amd_compute.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/amdgpu/amd_compute.c b/lib/amdgpu/amd_compute.c
index 95bfa53aa..29159af4c 100644
--- a/lib/amdgpu/amd_compute.c
+++ b/lib/amdgpu/amd_compute.c
@@ -32,7 +32,7 @@
  * @param device
  * @param user_queue
  */
-void amdgpu_command_submission_compute_nop(amdgpu_device_handle device, bool user_queue)
+void amdgpu_command_submission_nop(amdgpu_device_handle device, enum amd_ip_block_type type, bool user_queue)
 {
 	amdgpu_context_handle context_handle;
 	amdgpu_bo_handle ib_result_handle;
@@ -57,7 +57,7 @@ void amdgpu_command_submission_compute_nop(amdgpu_device_handle device, bool use
 	igt_assert_eq(r, 0);
 
 	if (user_queue) {
-		amdgpu_user_queue_create(device, ring_context, AMD_IP_COMPUTE);
+		amdgpu_user_queue_create(device, ring_context, type);
 	} else {
 		r = amdgpu_cs_ctx_create(device, &context_handle);
 		igt_assert_eq(r, 0);
@@ -90,7 +90,7 @@ void amdgpu_command_submission_compute_nop(amdgpu_device_handle device, bool use
 		ring_context->pm4_dw = 16;
 
 		if (user_queue) {
-			amdgpu_user_queue_submit(device, ring_context, AMD_IP_COMPUTE,
+			amdgpu_user_queue_submit(device, ring_context, type,
 						 ib_result_mc_address);
 		} else {
 			memset(&ib_info, 0, sizeof(struct amdgpu_cs_ib_info));
@@ -128,7 +128,7 @@ void amdgpu_command_submission_compute_nop(amdgpu_device_handle device, bool use
 	}
 
 	if (user_queue) {
-		amdgpu_user_queue_destroy(device, ring_context, AMD_IP_COMPUTE);
+		amdgpu_user_queue_destroy(device, ring_context, type);
 	} else {
 		r = amdgpu_cs_ctx_free(context_handle);
 		igt_assert_eq(r, 0);
diff --git a/lib/amdgpu/amd_compute.h b/lib/amdgpu/amd_compute.h
index 41ed225b8..d998e9251 100644
--- a/lib/amdgpu/amd_compute.h
+++ b/lib/amdgpu/amd_compute.h
@@ -24,8 +24,8 @@
  */
 #ifndef AMD_COMPUTE_H
 #define AMD_COMPUTE_H
+#include "amd_ip_blocks.h"
 
-
-void amdgpu_command_submission_compute_nop(amdgpu_device_handle device, bool user_queue);
+void amdgpu_command_submission_nop(amdgpu_device_handle device, enum amd_ip_block_type type,  bool user_queue);
 
 #endif
-- 
2.49.0



More information about the igt-dev mailing list