drm/amdgpu: detach ring priority from gfx priority
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: detach ring priority from gfx priority
Currently AMDGPU_RING_PRIO_MAX is redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.
Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -3
@@ -43,9 +43,8 @@#define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUESenum gfx_pipe_priority { -AMDGPU_GFX_PIPE_PRIO_NORMAL =1 , -AMDGPU_GFX_PIPE_PRIO_HIGH , -AMDGPU_GFX_PIPE_PRIO_MAX +AMDGPU_GFX_PIPE_PRIO_NORMAL =AMDGPU_RING_PRIO_1 , +AMDGPU_GFX_PIPE_PRIO_HIGH =AMDGPU_RING_PRIO_2 };/* Argument for PPSMC_MSG_GpuChangeState */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7 -2
@@ -36,8 +36,13 @@#define AMDGPU_MAX_VCE_RINGS 3#define AMDGPU_MAX_UVD_ENC_RINGS 2 -#define AMDGPU_RING_PRIO_DEFAULT 1 -#define AMDGPU_RING_PRIO_MAX AMDGPU_GFX_PIPE_PRIO_MAX +enum amdgpu_ring_priority_level { +AMDGPU_RING_PRIO_0 , +AMDGPU_RING_PRIO_1 , +AMDGPU_RING_PRIO_DEFAULT =1 , +AMDGPU_RING_PRIO_2 , +AMDGPU_RING_PRIO_MAX +};/* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED ((void *)0ul)
--
2.32.0
Christian König
maintainerAm 26.08.21 um 12:08 schrieb Nirmoy Das:
Quoted 20 lines
Currently
AMDGPU_RING_PRIO_MAXis redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.
Signed-off-by Nirmoy Das <[email protected]>Reviewed-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 45
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0@@ -43,9 +43,8 @@#define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUESenum gfx_pipe_priority {
While at it can you add an amdgpu_ prefix before the enum name?
And if the enum isn't really used maybe even replace the enum with defines?
Thanks,
Christian.
Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2
-3-AMDGPU_GFX_PIPE_PRIO_NORMAL =1 , -AMDGPU_GFX_PIPE_PRIO_HIGH , - AMDGPU_GFX_PIPE_PRIO_MAX +AMDGPU_GFX_PIPE_PRIO_NORMAL =AMDGPU_RING_PRIO_1 , + AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2 };/* Argument for PPSMC_MSG_GpuChangeState */ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7
-3@@ -36,8 +36,13 @@#define AMDGPU_MAX_VCE_RINGS 3#define AMDGPU_MAX_UVD_ENC_RINGS 2 -#define AMDGPU_RING_PRIO_DEFAULT 1 -#define AMDGPU_RING_PRIO_MAX AMDGPU_GFX_PIPE_PRIO_MAX +enum amdgpu_ring_priority_level { +AMDGPU_RING_PRIO_0 , +AMDGPU_RING_PRIO_1 , +AMDGPU_RING_PRIO_DEFAULT =1 , +AMDGPU_RING_PRIO_2 , +AMDGPU_RING_PRIO_MAX +};/* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED ((void *)0ul) --2.32.0
Quoted 25 lines · Christian König
Am 26.08.21 um 12:08 schrieb Nirmoy Das:
Quoted 22 lines
Currently
AMDGPU_RING_PRIO_MAXis redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.
Signed-off-by Nirmoy Das <[email protected]>Reviewed-by Lijo Lazar <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ++---drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h| 9 +++++++--2 files changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0@@ -43,9 +43,8 @@ #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 45
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0enum gfx_pipe_priority {While at it can you add an
amdgpu_prefix before the enum name?And if the enum isn't really used maybe even replace the enum with defines?
Yes makes sense, I will resend with defines.
Quoted 36 lines
Thanks,
Christian.Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2
-3- AMDGPU_GFX_PIPE_PRIO_NORMAL = 1, - AMDGPU_GFX_PIPE_PRIO_HIGH, - AMDGPU_GFX_PIPE_PRIO_MAX + AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1, + AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2 }; /* Argument for PPSMC_MSG_GpuChangeState */drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7
-2@@ -36,8 +36,13 @@ #define AMDGPU_MAX_VCE_RINGS 3 #define AMDGPU_MAX_UVD_ENC_RINGS 2 -#define AMDGPU_RING_PRIO_DEFAULT 1 -#define AMDGPU_RING_PRIO_MAX AMDGPU_GFX_PIPE_PRIO_MAX +enum amdgpu_ring_priority_level { + AMDGPU_RING_PRIO_0, + AMDGPU_RING_PRIO_1, + AMDGPU_RING_PRIO_DEFAULT = 1, + AMDGPU_RING_PRIO_2, + AMDGPU_RING_PRIO_MAX +}; /* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED ((void *)0ul)Signature · 1 line
2.32.0
Quoted 27 lines · Nirmoy
Quoted 25 lines · Christian König
Am 26.08.21 um 12:08 schrieb Nirmoy Das:
Quoted 22 lines
Currently
AMDGPU_RING_PRIO_MAXis redefinition of a max gfx hwip priority, this won't work well when we will have a hwip with different set of priorities than gfx. Also, HW ring priorities are different from ring priorities.Create a global enum for ring priority levels which each HWIP can use to define its own priority levels.
Signed-off-by Nirmoy Das <[email protected]>Reviewed-by Lijo Lazar <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 ++---drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h| 9 +++++++--2 files changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0@@ -43,9 +43,8 @@ #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h line 45
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0enum gfx_pipe_priority {While at it can you add an
amdgpu_prefix before the enum name?And if the enum isn't really used maybe even replace the enum with defines?
Yes makes sense, I will resend with defines.
Recommend against that so that ctx_to_ip priority returns a typed enum for that IP instead of something mapped randomly.
Thanks,
Lijo
Quoted 36 lines
Quoted 36 lines
Thanks,
Christian.Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2
-3- AMDGPU_GFX_PIPE_PRIO_NORMAL = 1, - AMDGPU_GFX_PIPE_PRIO_HIGH, - AMDGPU_GFX_PIPE_PRIO_MAX + AMDGPU_GFX_PIPE_PRIO_NORMAL = AMDGPU_RING_PRIO_1, + AMDGPU_GFX_PIPE_PRIO_HIGH = AMDGPU_RING_PRIO_2 }; /* Argument for PPSMC_MSG_GpuChangeState */drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7
-2@@ -36,8 +36,13 @@ #define AMDGPU_MAX_VCE_RINGS 3 #define AMDGPU_MAX_UVD_ENC_RINGS 2 -#define AMDGPU_RING_PRIO_DEFAULT 1 -#define AMDGPU_RING_PRIO_MAX AMDGPU_GFX_PIPE_PRIO_MAX +enum amdgpu_ring_priority_level { + AMDGPU_RING_PRIO_0, + AMDGPU_RING_PRIO_1, + AMDGPU_RING_PRIO_DEFAULT = 1, + AMDGPU_RING_PRIO_2, + AMDGPU_RING_PRIO_MAX +}; /* some special values for the owner field */ #define AMDGPU_FENCE_OWNER_UNDEFINED ((void *)0ul)Signature · 1 line
2.32.0