Skip to contentSkip to conversation

drm/sched:add new priority level

PATCH In review Satyajit Sahu 5 participants 17 messages Aug 24, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 drm/sched:add new priority level

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
 include/drm/gpu_scheduler.h | 1 +
 1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
 	DRM_SCHED_PRIORITY_MIN,
 	DRM_SCHED_PRIORITY_NORMAL,
 	DRM_SCHED_PRIORITY_HIGH,
+	DRM_SCHED_PRIORITY_VERY_HIGH,
 	DRM_SCHED_PRIORITY_KERNEL,
 
 	DRM_SCHED_PRIORITY_COUNT,
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/5 drm/amdgpu: map user set priority to drm sched priority

Map UMD priority level to properly to drm sched priorrity.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +1 -1
index b7d861ed5284..6ae0b723ffd7 100644
@@ -37,7 +37,7 @@ int amdgpu_to_sched_priority(int amdgpu_priority,
 {
 	switch (amdgpu_priority) {
 	case AMDGPU_CTX_PRIORITY_VERY_HIGH:
-		*prio = DRM_SCHED_PRIORITY_HIGH;
+		*prio = DRM_SCHED_PRIORITY_VERY_HIGH;
 		break;
 	case AMDGPU_CTX_PRIORITY_HIGH:
 		*prio = DRM_SCHED_PRIORITY_HIGH;
Signature · 1 line
2.25.1
maintainer
#2 lore raw
In reply to Satyajit Sahu

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 19 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +
  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
  	DRM_SCHED_PRIORITY_MIN,
  	DRM_SCHED_PRIORITY_NORMAL,
  	DRM_SCHED_PRIORITY_HIGH,
+	DRM_SCHED_PRIORITY_VERY_HIGH,
  	DRM_SCHED_PRIORITY_KERNEL,
 
  	DRM_SCHED_PRIORITY_COUNT,
#3 lore raw

Hi Christian,
I am a bit curious here.

I thought it would be a good idea to add a new SW priority level, so that any other driver can also utilize this SW infrastructure.

So it could be like, if you have a HW which matches with SW priority levels, directly map your HW queue to the SW priority level, like:

DRM_SCHED_PRIORITY_VERY_HIGH: mapped to a queue in HW reserved for real time or very high priority tasks, which can't be missed

DRM_SCHED_PRIORITY_HIGH : mapped to a queue of High priority tasks, for better experience, like encode/decode operations.

DRM_SCHED_PRIORITY_NORMAL: default, mapped to a queue of tasks without a priority context specified

DRM_SCHED_PRIORITY_MIN: queue for specifically mentioned low priority tasks

Depending on the HW we are running on, we can map these SW queues to corresponding HW queues, isn't it ?

Regards
Shashank

Quoted 29 lines · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
       DRM_SCHED_PRIORITY_COUNT,
maintainer
#4 lore raw

Nope that are two completely different things.

The DRM_SCHED_PRIORITY_* exposes a functionality of the software scheduler. E.g. we try to serve kernel queues first and if those are empty we use high priority etc....

But that functionality is completely independent from the hardware priority handling. In other words you can different hardware queues with priorities as well and each of them is served by a software scheduler.

In other words imagine the following setup: Two hardware queues, one normal and one low latency. Each hardware queue is then feed by a software scheduler with the priorities low,normal,high,kernel.

This configuration then gives you 8 different priorities to use.

Regards,
Christian.

Am 24.08.21 um 10:32 schrieb Sharma, Shashank:

Quoted 50 lines

Hi Christian,
I am a bit curious here.

I thought it would be a good idea to add a new SW priority level, so that any other driver can also utilize this SW infrastructure.

So it could be like, if you have a HW which matches with SW priority levels, directly map your HW queue to the SW priority level, like:

DRM_SCHED_PRIORITY_VERY_HIGH: mapped to a queue in HW reserved for real time or very high priority tasks, which can't be missed

DRM_SCHED_PRIORITY_HIGH : mapped to a queue of High priority tasks, for better experience, like encode/decode operations.

DRM_SCHED_PRIORITY_NORMAL: default, mapped to a queue of tasks without a priority context specified

DRM_SCHED_PRIORITY_MIN: queue for specifically mentioned low priority tasks

Depending on the HW we are running on, we can map these SW queues to corresponding HW queues, isn't it ?

Regards
Shashank

Quoted 29 lines · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
       DRM_SCHED_PRIORITY_COUNT,
#5 lore raw
Quoted 10 lines · Christian König

Nope that are two completely different things.

The DRM_SCHED_PRIORITY_* exposes a functionality of the software scheduler. E.g. we try to serve kernel queues first and if those are empty we use high priority etc....

But that functionality is completely independent from the hardware priority handling. In other words you can different hardware queues with priorities as well and each of them is served by a software scheduler.

In other words imagine the following setup: Two hardware queues, one normal and one low latency. Each hardware queue is then feed by a software scheduler with the priorities low,normal,high,kernel.

This configuration then gives you 8 different priorities to use.

Thanks for the details, I was under quite a different impression, this explanation helps.

I guess this also means that the HW queues are completely left to be managed by the core driver (Like AMDGPU or I915 etc) as of now, and the DRM framework only provides SW schedulers ?

Does this suggest a scope of a common framework or abstraction layer for HW queues in DRM ? Most of the architectures/HW will atleast have a NORMAL and a higher priority work queue, and their drivers might be handling them in very similar ways.

- Shashank

Quoted 55 lines

Regards,
Christian.

Am 24.08.21 um 10:32 schrieb Sharma, Shashank:

Quoted 50 lines

Hi Christian,
I am a bit curious here.

I thought it would be a good idea to add a new SW priority level, so that any other driver can also utilize this SW infrastructure.

So it could be like, if you have a HW which matches with SW priority levels, directly map your HW queue to the SW priority level, like:

DRM_SCHED_PRIORITY_VERY_HIGH: mapped to a queue in HW reserved for real time or very high priority tasks, which can't be missed

DRM_SCHED_PRIORITY_HIGH : mapped to a queue of High priority tasks, for better experience, like encode/decode operations.

DRM_SCHED_PRIORITY_NORMAL: default, mapped to a queue of tasks without a priority context specified

DRM_SCHED_PRIORITY_MIN: queue for specifically mentioned low priority tasks

Depending on the HW we are running on, we can map these SW queues to corresponding HW queues, isn't it ?

Regards
Shashank

Quoted 29 lines · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
       DRM_SCHED_PRIORITY_COUNT,
maintainer
#6 lore raw

Am 24.08.21 um 11:45 schrieb Sharma, Shashank:

Quoted 5 lines · Christian König
Quoted 4 lines

Nope that are two completely different things.

The DRM_SCHED_PRIORITY_* exposes a functionality of the software scheduler. E.g. we try to serve kernel queues first and if those are empty we use high priority etc....

Quoted 8 lines
Quoted 6 lines

But that functionality is completely independent from the hardware priority handling. In other words you can different hardware queues with priorities as well and each of them is served by a software scheduler.

In other words imagine the following setup: Two hardware queues, one normal and one low latency. Each hardware queue is then feed by a software scheduler with the priorities low,normal,high,kernel.

This configuration then gives you 8 different priorities to use.

Thanks for the details, I was under quite a different impression, this explanation helps.

The problem is that we used the SW scheduler enum for the init_priority and override_priority. Which is most likely a bad idea.

Quoted 1 line

I guess this also means that the HW queues are completely left to be managed by the core driver (Like AMDGPU or I915 etc) as of now, and the DRM framework only provides SW schedulers ?

Yes, exactly.

Quoted 1 line

Does this suggest a scope of a common framework or abstraction layer for HW queues in DRM ? Most of the architectures/HW will atleast have a NORMAL and a higher priority work queue, and their drivers might be handling them in very similar ways.

I don't think so. IIRC we even have generalized ring buffer functions in the linux kernel which barely anybody uses because nearly every hw ring buffer is different in one way or another.

Christian.

Quoted 58 lines

- Shashank

Quoted 55 lines

Regards,
Christian.

Am 24.08.21 um 10:32 schrieb Sharma, Shashank:

Quoted 50 lines

Hi Christian,
I am a bit curious here.

I thought it would be a good idea to add a new SW priority level, so that any other driver can also utilize this SW infrastructure.

So it could be like, if you have a HW which matches with SW priority levels, directly map your HW queue to the SW priority level, like:

DRM_SCHED_PRIORITY_VERY_HIGH: mapped to a queue in HW reserved for real time or very high priority tasks, which can't be missed

DRM_SCHED_PRIORITY_HIGH : mapped to a queue of High priority tasks, for better experience, like encode/decode operations.

DRM_SCHED_PRIORITY_NORMAL: default, mapped to a queue of tasks without a priority context specified

DRM_SCHED_PRIORITY_MIN: queue for specifically mentioned low priority tasks

Depending on the HW we are running on, we can map these SW queues to corresponding HW queues, isn't it ?

Regards
Shashank

Quoted 29 lines · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
       DRM_SCHED_PRIORITY_COUNT,
#7 lore raw
In reply to Christian König

Hi Christian,

Quoted 1 line · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

In previous discussion I sort of suggested to have new DRM prio as I didn't see any other way to map priority provided by the userspace to this new 3rd hw priority.

Do you think we should use other information from userspace like queue id to determine hardware priority ?

Regards,

Nirmoy

Quoted 28 lines

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
         DRM_SCHED_PRIORITY_COUNT,
maintainer
#8 lore raw

Am 24.08.21 um 13:57 schrieb Das, Nirmoy:

Quoted 9 lines

Hi Christian,

Quoted 1 line · Christian König

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

In previous discussion I sort of suggested to have new DRM prio as I didn't see any other way to map priority provided by the userspace to this new 3rd hw priority.

Do you think we should use other information from userspace like queue id to determine hardware priority ?

If I'm not completely mistaken we have dropped the concept of exposing multiple queues/instances completely.

What we should probably do is to use the (cleaned up) UAPI enum for init_priority and override_priority instead of the drm scheduler enums.

Regards,
Christian.

Quoted 34 lines

Regards,

Nirmoy

Quoted 28 lines

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
         DRM_SCHED_PRIORITY_COUNT,
#9 lore raw
Quoted 4 lines · Christian König

Am 24.08.21 um 13:57 schrieb Das, Nirmoy:

Quoted 3 lines

Hi Christian,

On 8/24/2021 8:10 AM, Christian König wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

In previous discussion I sort of suggested to have new DRM prio as I didn't see any other way to map priority provided by the userspace to this new 3rd hw priority.

Do you think we should use other information from userspace like queue id to determine hardware priority ?

If I'm not completely mistaken we have dropped the concept of exposing multiple queues/instances completely.

Yes, that is my understanding too.

Quoted 2 lines

What we should probably do is to use the (cleaned up) UAPI enum for init_priority and override_priority instead of the drm scheduler enums.

I went through the drm code, now I see what you mean. So what we are now doing is:  mapping  AMDGPU_CTX_PRIORITY_*  to DRM_SCHED_PRIORITY_*  and then to hw priority which is not nice.

We should rather map AMDGPU_CTX_PRIORITY_* to hw priority directly.

Regards,

Nirmoy

Quoted 39 lines

Regards,
Christian.

Quoted 34 lines

Regards,

Nirmoy

Quoted 28 lines

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
         DRM_SCHED_PRIORITY_COUNT,
#10 lore raw

Am 24.08.21 um 14:39 schrieb Das, Nirmoy:

Quoted 19 lines · Christian König
Quoted 4 lines

Am 24.08.21 um 13:57 schrieb Das, Nirmoy:

Quoted 3 lines

Hi Christian,

On 8/24/2021 8:10 AM, Christian König wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

In previous discussion I sort of suggested to have new DRM prio as I didn't see any other way to map priority provided by the userspace to this new 3rd hw priority.

Do you think we should use other information from userspace like queue id to determine hardware priority ?

If I'm not completely mistaken we have dropped the concept of exposing multiple queues/instances completely.

Yes, that is my understanding too.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

What we should probably do is to use the (cleaned up) UAPI enum for init_priority and override_priority instead of the drm scheduler enums.

I went through the drm code, now I see what you mean. So what we are now doing is:  mapping  AMDGPU_CTX_PRIORITY_*  to DRM_SCHED_PRIORITY_*  and then to hw priority which is not nice.

We should rather map AMDGPU_CTX_PRIORITY_* to hw priority directly.

Exactly that's my idea, yes.

If you want feel free to put this on your TODO for a potential cleanup.

Christian.

Quoted 46 lines

Regards,

Nirmoy

Quoted 39 lines

Regards,
Christian.

Quoted 34 lines

Regards,

Nirmoy

Quoted 28 lines

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
         DRM_SCHED_PRIORITY_COUNT,
#11 lore raw
Quoted 23 lines · Christian König

Am 24.08.21 um 14:39 schrieb Das, Nirmoy:

Quoted 22 lines · Christian König
Quoted 4 lines

Am 24.08.21 um 13:57 schrieb Das, Nirmoy:

Quoted 3 lines

Hi Christian,

On 8/24/2021 8:10 AM, Christian König wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I haven't followed the previous discussion, but that looks like this change is based on a misunderstanding.

In previous discussion I sort of suggested to have new DRM prio as I didn't see any other way to map priority provided by the userspace to this new 3rd hw priority.

Do you think we should use other information from userspace like queue id to determine hardware priority ?

If I'm not completely mistaken we have dropped the concept of exposing multiple queues/instances completely.

Yes, that is my understanding too.

Quoted 2 lines

What we should probably do is to use the (cleaned up) UAPI enum for init_priority and override_priority instead of the drm scheduler enums.

Quoted 7 lines
Quoted 3 lines

I went through the drm code, now I see what you mean. So what we are now doing is:  mapping  AMDGPU_CTX_PRIORITY_*  to DRM_SCHED_PRIORITY_*  and then to hw priority which is not nice.

We should rather map AMDGPU_CTX_PRIORITY_* to hw priority directly.

Exactly that's my idea, yes.

If you want feel free to put this on your TODO for a potential cleanup.

Yes Sure, I will try have a patch ready asap so that Satyajit can work on top of that.

Regards,

Nirmoy

Quoted 50 lines

Christian.

Quoted 46 lines

Regards,

Nirmoy

Quoted 39 lines

Regards,
Christian.

Quoted 34 lines

Regards,

Nirmoy

Quoted 28 lines

Those here are the software priorities used in the scheduler, but what you are working on are the hardware priorities.

That are two completely different things which we shouldn't mix up.

Regards,
Christian.

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 18 lines

Adding a new priority level DRM_SCHED_PRIORITY_VERY_HIGH

---
  include/drm/gpu_scheduler.h | 1 +

  1 file changed, 1 insertion(+)
include/drm/gpu_scheduler.h +1 -0
index d18af49fd009..d0e5e234da5f 100644
@@ -40,6 +40,7 @@ enum drm_sched_priority {
       DRM_SCHED_PRIORITY_MIN,
       DRM_SCHED_PRIORITY_NORMAL,
       DRM_SCHED_PRIORITY_HIGH,
+    DRM_SCHED_PRIORITY_VERY_HIGH,
       DRM_SCHED_PRIORITY_KERNEL,
         DRM_SCHED_PRIORITY_COUNT,
#12 lore raw

PATCH 3/5 drm/amdgpu/vce:set vce ring priority level

In reply to Satyajit Sahu

There are multiple rings available in VCE. Map each ring to different priority.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 14 ++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | 15 +++++++++++++++
 2 files changed, 29 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +14 -0
index 1ae7f824adc7..379f27f14b39 100644
@@ -1168,3 +1168,17 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 	amdgpu_bo_free_kernel(&bo, NULL, NULL);
 	return r;
 }
+
+enum vce_enc_ring_priority get_vce_ring_prio(int index)
+{
+	switch(index) {
+	case AMDGPU_VCE_GENERAL_PURPOSE:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	case AMDGPU_VCE_LOW_LATENCY:
+		return AMDGPU_VCE_ENC_PRIO_HIGH;
+	case AMDGPU_VCE_REALTIME:
+		return AMDGPU_VCE_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	}
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +15 -0
index d6d83a3ec803..3cb34ee3e4b6 100644
@@ -32,6 +32,19 @@
 
 #define AMDGPU_VCE_FW_53_45	((53 << 24) | (45 << 16))
 
+enum vce_enc_ring_priority {
+	AMDGPU_VCE_ENC_PRIO_NORMAL = 1,
+	AMDGPU_VCE_ENC_PRIO_HIGH,
+	AMDGPU_VCE_ENC_PRIO_VERY_HIGH,
+	AMDGPU_VCE_ENC_PRIO_MAX
+};
+
+enum vce_enc_ring_type {
+	AMDGPU_VCE_GENERAL_PURPOSE,
+	AMDGPU_VCE_LOW_LATENCY,
+	AMDGPU_VCE_REALTIME
+};
+
 struct amdgpu_vce {
 	struct amdgpu_bo	*vcpu_bo;
 	uint64_t		gpu_addr;
@@ -72,4 +85,6 @@ void amdgpu_vce_ring_end_use(struct amdgpu_ring *ring);
 unsigned amdgpu_vce_ring_get_emit_ib_size(struct amdgpu_ring *ring);
 unsigned amdgpu_vce_ring_get_dma_frame_size(struct amdgpu_ring *ring);
 
+enum vce_enc_ring_priority get_vce_ring_prio(int index);
+
 #endif
Signature · 1 line
2.25.1
maintainer
#13 lore raw

Re: [PATCH 3/5] drm/amdgpu/vce:set vce ring priority level

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 14 lines

There are multiple rings available in VCE. Map each ring to different priority.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 14 ++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | 15 +++++++++++++++
  2 files changed, 29 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 -0
index 1ae7f824adc7..379f27f14b39 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) · line 1172

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -0
@@ -1168,3 +1168,17 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
  	amdgpu_bo_free_kernel(&bo, NULL, NULL);
  	return r;
  }
+
+enum vce_enc_ring_priority get_vce_ring_prio(int index)

Please name the function amdgpu_vce_...

Same for VCN as well.

Regards,
Christian.

Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +12 -0
+{
+	switch(index) {
+	case AMDGPU_VCE_GENERAL_PURPOSE:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	case AMDGPU_VCE_LOW_LATENCY:
+		return AMDGPU_VCE_ENC_PRIO_HIGH;
+	case AMDGPU_VCE_REALTIME:
+		return AMDGPU_VCE_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	}
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +15 -0
index d6d83a3ec803..3cb34ee3e4b6 100644
@@ -32,6 +32,19 @@
 
  #define AMDGPU_VCE_FW_53_45	((53 << 24) | (45 << 16))
 
+enum vce_enc_ring_priority {
+	AMDGPU_VCE_ENC_PRIO_NORMAL = 1,
+	AMDGPU_VCE_ENC_PRIO_HIGH,
+	AMDGPU_VCE_ENC_PRIO_VERY_HIGH,
+	AMDGPU_VCE_ENC_PRIO_MAX
+};
+
+enum vce_enc_ring_type {
+	AMDGPU_VCE_GENERAL_PURPOSE,
+	AMDGPU_VCE_LOW_LATENCY,
+	AMDGPU_VCE_REALTIME
+};
+
  struct amdgpu_vce {
  	struct amdgpu_bo	*vcpu_bo;
  	uint64_t		gpu_addr;
@@ -72,4 +85,6 @@ void amdgpu_vce_ring_end_use(struct amdgpu_ring *ring);
  unsigned amdgpu_vce_ring_get_emit_ib_size(struct amdgpu_ring *ring);
  unsigned amdgpu_vce_ring_get_dma_frame_size(struct amdgpu_ring *ring);
 
+enum vce_enc_ring_priority get_vce_ring_prio(int index);
+
  #endif
#14 lore raw

PATCH 4/5 drm/amdgpu/vcn:set vcn encode ring priority level

In reply to Satyajit Sahu

There are multiple rings available in VCN encode. Map each ring to different priority.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 14 ++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +14 -0
index 6780df0fb265..14075f2c33f0 100644
@@ -951,3 +951,17 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 
 	return r;
 }
+
+enum vcn_enc_ring_priority get_vcn_enc_ring_prio(int index)
+{
+	switch(index) {
+	case AMDGPU_VCN_ENC_GENERAL_PURPOSE:
+		return AMDGPU_VCN_ENC_PRIO_NORMAL;
+	case AMDGPU_VCN_ENC_LOW_LATENCY:
+		return AMDGPU_VCN_ENC_PRIO_HIGH;
+	case AMDGPU_VCN_ENC_REALTIME:
+		return AMDGPU_VCN_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCN_ENC_PRIO_NORMAL;
+	}
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +14 -0
index d74c62b49795..14dcf23fcf0a 100644
@@ -290,6 +290,19 @@ enum vcn_ring_type {
 	VCN_UNIFIED_RING,
 };
 
+enum vcn_enc_ring_priority {
+	AMDGPU_VCN_ENC_PRIO_NORMAL = 1,
+	AMDGPU_VCN_ENC_PRIO_HIGH,
+	AMDGPU_VCN_ENC_PRIO_VERY_HIGH,
+	AMDGPU_VCN_ENC_PRIO_MAX
+};
+
+enum vcn_enc_ring_type {
+	AMDGPU_VCN_ENC_GENERAL_PURPOSE,
+	AMDGPU_VCN_ENC_LOW_LATENCY,
+	AMDGPU_VCN_ENC_REALTIME
+};
+
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
 int amdgpu_vcn_sw_fini(struct amdgpu_device *adev);
 int amdgpu_vcn_suspend(struct amdgpu_device *adev);
@@ -307,5 +320,6 @@ int amdgpu_vcn_dec_sw_ring_test_ib(struct amdgpu_ring *ring, long timeout);
 
 int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring);
 int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout);
+enum vcn_enc_ring_priority get_vcn_enc_ring_prio(int index);
 
 #endif
Signature · 1 line
2.25.1
#15 lore raw

PATCH 5/5 drm/amdgpu/vcn/vce:schedule encode job based on priorrity

In reply to Satyajit Sahu

Schedule the encode job properly in the VCE/VCN encode rings based on the priority set by UMD.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 40 +++++++++++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c   |  4 ++-
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   |  5 ++--
 8 files changed, 58 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +37 -3
index e7a010b7ca1f..adc11bb81787 100644
@@ -73,15 +73,49 @@ static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_compute_prio(enum drm_sch
 	}
 }
 
+static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_vcn_prio(enum drm_sched_priority prio)
+{
+	switch (prio) {
+	case DRM_SCHED_PRIORITY_HIGH:
+		return AMDGPU_VCN_ENC_PRIO_HIGH;
+	case DRM_SCHED_PRIORITY_VERY_HIGH:
+		return AMDGPU_VCN_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCN_ENC_PRIO_NORMAL;
+	}
+}
+
+static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_vce_prio(enum drm_sched_priority prio)
+{
+	switch (prio) {
+	case DRM_SCHED_PRIORITY_HIGH:
+		return AMDGPU_VCE_ENC_PRIO_HIGH;
+	case DRM_SCHED_PRIORITY_VERY_HIGH:
+		return AMDGPU_VCE_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	}
+}
+
 static unsigned int amdgpu_ctx_prio_sched_to_hw(struct amdgpu_device *adev,
 						 enum drm_sched_priority prio,
 						 u32 hw_ip)
 {
 	unsigned int hw_prio;
 
-	hw_prio = (hw_ip == AMDGPU_HW_IP_COMPUTE) ?
-			amdgpu_ctx_sched_prio_to_compute_prio(prio) :
-			AMDGPU_RING_PRIO_DEFAULT;
+	switch(hw_ip) {
+	case AMDGPU_HW_IP_COMPUTE:
+		hw_prio = amdgpu_ctx_sched_prio_to_compute_prio(prio);
+		break;
+	case AMDGPU_HW_IP_VCN_ENC:
+		hw_prio = amdgpu_ctx_sched_prio_to_vcn_prio(prio);
+		break;
+	case AMDGPU_HW_IP_VCE:
+		hw_prio = amdgpu_ctx_sched_prio_to_vce_prio(prio);
+		break;
+	default:
+		hw_prio = AMDGPU_RING_PRIO_DEFAULT;
+	}
 	hw_ip = array_index_nospec(hw_ip, AMDGPU_HW_IP_NUM);
 	if (adev->gpu_sched[hw_ip][hw_prio].num_scheds == 0)
 		hw_prio = AMDGPU_RING_PRIO_DEFAULT;
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index c7d28c169be5..2b6b7f1a77b9 100644
@@ -431,10 +431,12 @@ static int vce_v2_0_sw_init(void *handle)
 		return r;
 
 	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
 		if (r)
 			return r;
 	}
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -1
index 3b82fb289ef6..5ce182a837f3 100644
@@ -440,10 +440,12 @@ static int vce_v3_0_sw_init(void *handle)
 		return r;
 
 	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
 		if (r)
 			return r;
 	}
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +3 -1
index 90910d19db12..c085defaabfe 100644
@@ -463,6 +463,8 @@ static int vce_v4_0_sw_init(void *handle)
 	}
 
 	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
 		if (amdgpu_sriov_vf(adev)) {
@@ -478,7 +480,7 @@ static int vce_v4_0_sw_init(void *handle)
 				ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring2_3 * 2 + 1;
 		}
 		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
 		if (r)
 			return r;
 	}
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -1
index 284bb42d6c86..a41b2c40487e 100644
@@ -145,10 +145,12 @@ static int vcn_v1_0_sw_init(void *handle)
 		SOC15_REG_OFFSET(UVD, 0, mmUVD_NO_OP);
 
 	for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+		unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
 		ring = &adev->vcn.inst->ring_enc[i];
 		sprintf(ring->name, "vcn_enc%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
 		if (r)
 			return r;
 	}
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +3 -1
index 8af567c546db..9729a383786b 100644
@@ -159,6 +159,8 @@ static int vcn_v2_0_sw_init(void *handle)
 	adev->vcn.inst->external.nop = SOC15_REG_OFFSET(UVD, 0, mmUVD_NO_OP);
 
 	for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+		unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
 		ring = &adev->vcn.inst->ring_enc[i];
 		ring->use_doorbell = true;
 		if (!amdgpu_sriov_vf(adev))
@@ -167,7 +169,7 @@ static int vcn_v2_0_sw_init(void *handle)
 			ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1 + i;
 		sprintf(ring->name, "vcn_enc%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
 		if (r)
 			return r;
 	}
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +3 -1
index 888b17d84691..9eca70d3ff30 100644
@@ -194,6 +194,8 @@ static int vcn_v2_5_sw_init(void *handle)
 			return r;
 
 		for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+			unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
 			ring = &adev->vcn.inst[j].ring_enc[i];
 			ring->use_doorbell = true;
 
@@ -203,7 +205,7 @@ static int vcn_v2_5_sw_init(void *handle)
 			sprintf(ring->name, "vcn_enc_%d.%d", j, i);
 			r = amdgpu_ring_init(adev, ring, 512,
 					     &adev->vcn.inst[j].irq, 0,
-					     AMDGPU_RING_PRIO_DEFAULT, NULL);
+					     hw_prio, NULL);
 			if (r)
 				return r;
 		}
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -2
index 47d4f04cbd69..926c9f4bfc21 100644
@@ -227,6 +227,8 @@ static int vcn_v3_0_sw_init(void *handle)
 			return r;
 
 		for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
+			unsigned int hw_prio = get_vcn_enc_ring_prio(j);
+
 			/* VCN ENC TRAP */
 			r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_vcns[i],
 				j + VCN_2_0__SRCID__UVD_ENC_GENERAL_PURPOSE, &adev->vcn.inst[i].irq);
@@ -242,8 +244,7 @@ static int vcn_v3_0_sw_init(void *handle)
 			}
 			sprintf(ring->name, "vcn_enc_%d.%d", i, j);
 			r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
-					     AMDGPU_RING_PRIO_DEFAULT,
-					     &adev->vcn.inst[i].sched_score);
+					     hw_prio, &adev->vcn.inst[i].sched_score);
 			if (r)
 				return r;
 		}
Signature · 1 line
2.25.1
maintainer
#16 lore raw

Re: [PATCH 5/5] drm/amdgpu/vcn/vce:schedule encode job based on priorrity

Am 24.08.21 um 07:55 schrieb Satyajit Sahu:

Quoted 59 lines

Schedule the encode job properly in the VCE/VCN encode rings based on the priority set by UMD.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 40 +++++++++++++++++++++++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c   |  4 ++-
  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   |  5 ++--
  8 files changed, 58 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +27 -3
index e7a010b7ca1f..adc11bb81787 100644
@@ -73,15 +73,49 @@ static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_compute_prio(enum drm_sch
  	}
  }
 
+static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_vcn_prio(enum drm_sched_priority prio)
+{
+	switch (prio) {
+	case DRM_SCHED_PRIORITY_HIGH:
+		return AMDGPU_VCN_ENC_PRIO_HIGH;
+	case DRM_SCHED_PRIORITY_VERY_HIGH:
+		return AMDGPU_VCN_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCN_ENC_PRIO_NORMAL;
+	}
+}
+
+static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_vce_prio(enum drm_sched_priority prio)
+{
+	switch (prio) {
+	case DRM_SCHED_PRIORITY_HIGH:
+		return AMDGPU_VCE_ENC_PRIO_HIGH;
+	case DRM_SCHED_PRIORITY_VERY_HIGH:
+		return AMDGPU_VCE_ENC_PRIO_VERY_HIGH;
+	default:
+		return AMDGPU_VCE_ENC_PRIO_NORMAL;
+	}
+}
+
  static unsigned int amdgpu_ctx_prio_sched_to_hw(struct amdgpu_device *adev,
  						 enum drm_sched_priority prio,
  						 u32 hw_ip)
  {
  	unsigned int hw_prio;
 
-	hw_prio = (hw_ip == AMDGPU_HW_IP_COMPUTE) ?
-			amdgpu_ctx_sched_prio_to_compute_prio(prio) :
-			AMDGPU_RING_PRIO_DEFAULT;
+	switch(hw_ip) {
+	case AMDGPU_HW_IP_COMPUTE:
+		hw_prio = amdgpu_ctx_sched_prio_to_compute_prio(prio);

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_compute_prio(enum drm_sch · line 118

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +10 -0
+		break;
+	case AMDGPU_HW_IP_VCN_ENC:
+		hw_prio = amdgpu_ctx_sched_prio_to_vcn_prio(prio);
+		break;
+	case AMDGPU_HW_IP_VCE:
+		hw_prio = amdgpu_ctx_sched_prio_to_vce_prio(prio);
+		break;
+	default:
+		hw_prio = AMDGPU_RING_PRIO_DEFAULT;
+	}

Ok now I see where your confusion is coming from. Those functions here should not work with the scheduler priority to begin with.

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c static enum gfx_pipe_priority amdgpu_ctx_sched_prio_to_compute_prio(enum drm_sch · line 121

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
  	hw_ip = array_index_nospec(hw_ip, AMDGPU_HW_IP_NUM);
  	if (adev->gpu_sched[hw_ip][hw_prio].num_scheds == 0)
  		hw_prio = AMDGPU_RING_PRIO_DEFAULT;

The rest of the changes starting from here should not be part of this patch, but rather of the respectively VCN/VCE changes.

Regards,
Christian.

Quoted 143 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index c7d28c169be5..2b6b7f1a77b9 100644
@@ -431,10 +431,12 @@ static int vce_v2_0_sw_init(void *handle)
  		return r;
 
  	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
  		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -1
index 3b82fb289ef6..5ce182a837f3 100644
@@ -440,10 +440,12 @@ static int vce_v3_0_sw_init(void *handle)
  		return r;
 
  	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
  		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +3 -1
index 90910d19db12..c085defaabfe 100644
@@ -463,6 +463,8 @@ static int vce_v4_0_sw_init(void *handle)
  	}
 
  	for (i = 0; i < adev->vce.num_rings; i++) {
+		unsigned int hw_prio = get_vce_ring_prio(i);
+
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
  		if (amdgpu_sriov_vf(adev)) {
@@ -478,7 +480,7 @@ static int vce_v4_0_sw_init(void *handle)
  				ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring2_3 * 2 + 1;
  		}
  		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -1
index 284bb42d6c86..a41b2c40487e 100644
@@ -145,10 +145,12 @@ static int vcn_v1_0_sw_init(void *handle)
  		SOC15_REG_OFFSET(UVD, 0, mmUVD_NO_OP);
 
  	for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+		unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
  		ring = &adev->vcn.inst->ring_enc[i];
  		sprintf(ring->name, "vcn_enc%d", i);
  		r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +3 -1
index 8af567c546db..9729a383786b 100644
@@ -159,6 +159,8 @@ static int vcn_v2_0_sw_init(void *handle)
  	adev->vcn.inst->external.nop = SOC15_REG_OFFSET(UVD, 0, mmUVD_NO_OP);
 
  	for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+		unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
  		ring = &adev->vcn.inst->ring_enc[i];
  		ring->use_doorbell = true;
  		if (!amdgpu_sriov_vf(adev))
@@ -167,7 +169,7 @@ static int vcn_v2_0_sw_init(void *handle)
  			ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 1 + i;
  		sprintf(ring->name, "vcn_enc%d", i);
  		r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
-				     AMDGPU_RING_PRIO_DEFAULT, NULL);
+				     hw_prio, NULL);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +3 -1
index 888b17d84691..9eca70d3ff30 100644
@@ -194,6 +194,8 @@ static int vcn_v2_5_sw_init(void *handle)
  			return r;
 
  		for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+			unsigned int hw_prio = get_vcn_enc_ring_prio(i);
+
  			ring = &adev->vcn.inst[j].ring_enc[i];
  			ring->use_doorbell = true;
 
@@ -203,7 +205,7 @@ static int vcn_v2_5_sw_init(void *handle)
  			sprintf(ring->name, "vcn_enc_%d.%d", j, i);
  			r = amdgpu_ring_init(adev, ring, 512,
  					     &adev->vcn.inst[j].irq, 0,
-					     AMDGPU_RING_PRIO_DEFAULT, NULL);
+					     hw_prio, NULL);
  			if (r)
  				return r;
  		}
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -2
index 47d4f04cbd69..926c9f4bfc21 100644
@@ -227,6 +227,8 @@ static int vcn_v3_0_sw_init(void *handle)
  			return r;
 
  		for (j = 0; j < adev->vcn.num_enc_rings; ++j) {
+			unsigned int hw_prio = get_vcn_enc_ring_prio(j);
+
  			/* VCN ENC TRAP */
  			r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_vcns[i],
  				j + VCN_2_0__SRCID__UVD_ENC_GENERAL_PURPOSE, &adev->vcn.inst[i].irq);
@@ -242,8 +244,7 @@ static int vcn_v3_0_sw_init(void *handle)
  			}
  			sprintf(ring->name, "vcn_enc_%d.%d", i, j);
  			r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
-					     AMDGPU_RING_PRIO_DEFAULT,
-					     &adev->vcn.inst[i].sched_score);
+					     hw_prio, &adev->vcn.inst[i].sched_score);
  			if (r)
  				return r;
  		}