[PATCH 20/31] drm/amdgpu: add amdgpu.sched_hw_submission option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jammy Zhou <Jammy.Zhou@xxxxxxx>

This option can be used to specify the max number of submissions in the
active HW queue. The default value is 2 now.

Signed-off-by: Jammy Zhou <Jammy.Zhou@xxxxxxx>
Reviewed-by: Chunming Zhou <david1.zhou@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c     | 3 ++-
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 5 +++--
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 5 ++---
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index e4311ac..ee55099 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -82,6 +82,7 @@ extern int amdgpu_vm_size;
 extern int amdgpu_vm_block_size;
 extern int amdgpu_enable_scheduler;
 extern int amdgpu_sched_jobs;
+extern int amdgpu_sched_hw_submission;
 
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
 #define AMDGPU_MAX_USEC_TIMEOUT			100000	/* 100 ms */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0e7e0c3..6578258 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -77,6 +77,7 @@ int amdgpu_vm_block_size = -1;
 int amdgpu_exp_hw_support = 0;
 int amdgpu_enable_scheduler = 0;
 int amdgpu_sched_jobs = 16;
+int amdgpu_sched_hw_submission = 2;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -147,6 +148,9 @@ module_param_named(enable_scheduler, amdgpu_enable_scheduler, int, 0444);
 MODULE_PARM_DESC(sched_jobs, "the max number of jobs supported in the sw queue (default 16)");
 module_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444);
 
+MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default 2)");
+module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
+
 static struct pci_device_id pciidlist[] = {
 #ifdef CONFIG_DRM_AMDGPU_CIK
 	/* Kaveri */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index faee350..c4ad6bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -926,7 +926,8 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
 	if (amdgpu_enable_scheduler) {
 		ring->scheduler = amd_sched_create((void *)ring->adev,
 						   &amdgpu_sched_ops,
-						   ring->idx, 5, 0);
+						   ring->idx, 5, 0,
+						   amdgpu_sched_hw_submission);
 		if (!ring->scheduler)
 			DRM_ERROR("Failed to create scheduler on ring %d.\n",
 				  ring->idx);
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 87993e0..042da7d 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -468,7 +468,8 @@ struct amd_gpu_scheduler *amd_sched_create(void *device,
 					   struct amd_sched_backend_ops *ops,
 					   unsigned ring,
 					   unsigned granularity,
-					   unsigned preemption)
+					   unsigned preemption,
+					   unsigned hw_submission)
 {
 	struct amd_gpu_scheduler *sched;
 	char name[20] = "gpu_sched[0]";
@@ -495,7 +496,7 @@ struct amd_gpu_scheduler *amd_sched_create(void *device,
 
 	init_waitqueue_head(&sched->wait_queue);
 	if(kfifo_alloc(&sched->active_hw_rq,
-		       AMD_MAX_ACTIVE_HW_SUBMISSION * sizeof(void *),
+		       hw_submission * sizeof(void *),
 		       GFP_KERNEL)) {
 		kfree(sched);
 		return NULL;
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
index 52577a88..7f6bc26 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
@@ -26,8 +26,6 @@
 
 #include <linux/kfifo.h>
 
-#define AMD_MAX_ACTIVE_HW_SUBMISSION		2
-
 #define AMD_KERNEL_CONTEXT_ID			0
 #define AMD_KERNEL_PROCESS_ID			0
 
@@ -127,7 +125,8 @@ struct amd_gpu_scheduler *amd_sched_create(void *device,
 				struct amd_sched_backend_ops *ops,
 				uint32_t ring,
 				uint32_t granularity,
-				uint32_t preemption);
+				uint32_t preemption,
+				uint32_t hw_submission);
 
 int amd_sched_destroy(struct amd_gpu_scheduler *sched);
 
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux