[PATCH 4/5] drm/amdgpu/vcn:set ring priorities
Sharma, Shashank
shashank.sharma at amd.com
Thu Aug 26 11:40:24 UTC 2021
On 8/26/2021 12:43 PM, Satyajit Sahu wrote:
> Set proper ring priority while initializing the ring.
>
> Signed-off-by: Satyajit Sahu <satyajit.sahu at amd.com>
> ---
> 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 +++--
> 4 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 284bb42d6c86..51c46c9e7e0d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> @@ -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 = amdgpu_vcn_get_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;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> index 8af567c546db..720a69322f7c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> @@ -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 = amdgpu_vcn_get_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;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> index 888b17d84691..6837f5fc729e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> @@ -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 = amdgpu_vcn_get_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;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> index 47d4f04cbd69..e6e5d476ae9e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> @@ -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 = amdgpu_vcn_get_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;
> }
>
Please feel free to use:
Reviewed-by: Shashank Sharma <shashank.sharma at amd.com>
- Shashank
More information about the amd-gfx
mailing list