All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
@ 2021-05-26 10:13 Li, Xin (Justin)
  2021-05-26 10:49 ` Christian König
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Li, Xin (Justin) @ 2021-05-26 10:13 UTC (permalink / raw)
  To: amd-gfx; +Cc: Li, Xin (Justin), Alex . Deucher, Frank . Min, Christian . Konig

since vcn decoding ring is not required, so just disable it.

Cc: Alex.Deucher <alexander.deucher@amd.com>
Cc: Christian.Konig <christian.koenig@amd.com>
Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
Signed-off-by: Frank.Min <Frank.Min@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 524e4fe5efe8..614e6b06e94e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 			if (adev->uvd.harvest_config & (1 << i))
 				continue;
 
-			if (adev->vcn.inst[i].ring_dec.sched.ready)
+			if (adev->vcn.inst[i].ring_dec.sched.ready ||
+				(adev->asic_type == CHIP_NAVI12 &&
+				amdgpu_sriov_vf(adev)))
 				++num_rings;
 		}
 		ib_start_alignment = 16;
@@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
 		if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
 			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
-		if (amdgpu_is_tmz(adev))
-			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
 
 		vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
 		vm_size -= AMDGPU_VA_RESERVED_SIZE;
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 8af567c546db..dc8a36766c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
-	int i, r;
+	int i, r = -1;
 
 	adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
 					     ring->doorbell_index, 0);
 
-	if (amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev)) {
 		vcn_v2_0_start_sriov(adev);
-
-	r = amdgpu_ring_test_helper(ring);
-	if (r)
-		goto done;
+		if (adev->asic_type == CHIP_NAVI12)
+			ring->sched.ready = false;
+	} else {
+		r = amdgpu_ring_test_helper(ring);
+		if (r)
+			goto done;
+	}
 
 	//Disable vcn decode for sriov
 	if (amdgpu_sriov_vf(adev))
@@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
 
 done:
 	if (!r)
-		DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
-			(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
+		DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
+			(adev->asic_type == CHIP_NAVI12 &&
+				amdgpu_sriov_vf(adev))?"":"decode and",
+			(adev->pg_flags &
+				AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
 
 	return r;
 }
@@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
 	unsigned i;
 	int r;
 
-	if (amdgpu_sriov_vf(adev))
-		return 0;
-
 	WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
 	r = amdgpu_ring_alloc(ring, 4);
 	if (r)
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 10:13 [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing Li, Xin (Justin)
@ 2021-05-26 10:49 ` Christian König
  2021-05-27 14:22   ` Leo Liu
  2021-05-27 14:27   ` Liu, Leo
  2021-05-26 19:08 ` Alex Deucher
  2021-05-26 23:57 ` Liu, Monk
  2 siblings, 2 replies; 8+ messages in thread
From: Christian König @ 2021-05-26 10:49 UTC (permalink / raw)
  To: Li, Xin (Justin), amd-gfx, Liu, Leo; +Cc: Alex . Deucher, Frank . Min

Am 26.05.21 um 12:13 schrieb Li, Xin (Justin):
> since vcn decoding ring is not required, so just disable it.
>
> Cc: Alex.Deucher <alexander.deucher@amd.com>
> Cc: Christian.Konig <christian.koenig@amd.com>
> Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
> Signed-off-by: Frank.Min <Frank.Min@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
>   drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
>   2 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 524e4fe5efe8..614e6b06e94e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
>   			if (adev->uvd.harvest_config & (1 << i))
>   				continue;
>   
> -			if (adev->vcn.inst[i].ring_dec.sched.ready)
> +			if (adev->vcn.inst[i].ring_dec.sched.ready ||
> +				(adev->asic_type == CHIP_NAVI12 &&
> +				amdgpu_sriov_vf(adev)))

Leo needs to take a closer look, but that looks fishy to me.

Why should the ring be available if it is disabled? That doesn't make sense.

Christian.

>   				++num_rings;
>   		}
>   		ib_start_alignment = 16;
> @@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>   			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
>   		if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
>   			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
> -		if (amdgpu_is_tmz(adev))
> -			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>   
>   		vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
>   		vm_size -= AMDGPU_VA_RESERVED_SIZE;
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> index 8af567c546db..dc8a36766c4a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> @@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
>   {
>   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>   	struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
> -	int i, r;
> +	int i, r = -1;
>   
>   	adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
>   					     ring->doorbell_index, 0);
>   
> -	if (amdgpu_sriov_vf(adev))
> +	if (amdgpu_sriov_vf(adev)) {
>   		vcn_v2_0_start_sriov(adev);
> -
> -	r = amdgpu_ring_test_helper(ring);
> -	if (r)
> -		goto done;
> +		if (adev->asic_type == CHIP_NAVI12)
> +			ring->sched.ready = false;
> +	} else {
> +		r = amdgpu_ring_test_helper(ring);
> +		if (r)
> +			goto done;
> +	}
>   
>   	//Disable vcn decode for sriov
>   	if (amdgpu_sriov_vf(adev))
> @@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
>   
>   done:
>   	if (!r)
> -		DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
> -			(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
> +		DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
> +			(adev->asic_type == CHIP_NAVI12 &&
> +				amdgpu_sriov_vf(adev))?"":"decode and",
> +			(adev->pg_flags &
> +				AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
>   
>   	return r;
>   }
> @@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
>   	unsigned i;
>   	int r;
>   
> -	if (amdgpu_sriov_vf(adev))
> -		return 0;
> -
>   	WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
>   	r = amdgpu_ring_alloc(ring, 4);
>   	if (r)

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 10:13 [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing Li, Xin (Justin)
  2021-05-26 10:49 ` Christian König
@ 2021-05-26 19:08 ` Alex Deucher
  2021-05-26 23:57 ` Liu, Monk
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Deucher @ 2021-05-26 19:08 UTC (permalink / raw)
  To: Li, Xin (Justin)
  Cc: Alex . Deucher, Frank . Min, Christian . Konig, amd-gfx list

On Wed, May 26, 2021 at 6:13 AM Li, Xin (Justin) <xin2.li@amd.com> wrote:
>
> since vcn decoding ring is not required, so just disable it.
>
> Cc: Alex.Deucher <alexander.deucher@amd.com>
> Cc: Christian.Konig <christian.koenig@amd.com>
> Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
> Signed-off-by: Frank.Min <Frank.Min@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
>  2 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 524e4fe5efe8..614e6b06e94e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
>                         if (adev->uvd.harvest_config & (1 << i))
>                                 continue;
>
> -                       if (adev->vcn.inst[i].ring_dec.sched.ready)
> +                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
> +                               (adev->asic_type == CHIP_NAVI12 &&
> +                               amdgpu_sriov_vf(adev)))
>                                 ++num_rings;
>                 }
>                 ib_start_alignment = 16;
> @@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
>                 if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
>                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
> -               if (amdgpu_is_tmz(adev))
> -                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>

This looks unrelated and should be dropped.

>                 vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
>                 vm_size -= AMDGPU_VA_RESERVED_SIZE;
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> index 8af567c546db..dc8a36766c4a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
> @@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>         struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
> -       int i, r;
> +       int i, r = -1;
>
>         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
>                                              ring->doorbell_index, 0);
>
> -       if (amdgpu_sriov_vf(adev))
> +       if (amdgpu_sriov_vf(adev)) {
>                 vcn_v2_0_start_sriov(adev);
> -
> -       r = amdgpu_ring_test_helper(ring);
> -       if (r)
> -               goto done;
> +               if (adev->asic_type == CHIP_NAVI12)
> +                       ring->sched.ready = false;
> +       } else {
> +               r = amdgpu_ring_test_helper(ring);
> +               if (r)
> +                       goto done;
> +       }
>
>         //Disable vcn decode for sriov
>         if (amdgpu_sriov_vf(adev))
> @@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
>
>  done:
>         if (!r)
> -               DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
> -                       (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
> +               DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
> +                       (adev->asic_type == CHIP_NAVI12 &&
> +                               amdgpu_sriov_vf(adev))?"":"decode and",
> +                       (adev->pg_flags &
> +                               AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
>
>         return r;
>  }
> @@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
>         unsigned i;
>         int r;
>
> -       if (amdgpu_sriov_vf(adev))
> -               return 0;
> -
>         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
>         r = amdgpu_ring_alloc(ring, 4);
>         if (r)
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 10:13 [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing Li, Xin (Justin)
  2021-05-26 10:49 ` Christian König
  2021-05-26 19:08 ` Alex Deucher
@ 2021-05-26 23:57 ` Liu, Monk
  2021-05-27  7:17   ` Li, Xin (Justin)
  2 siblings, 1 reply; 8+ messages in thread
From: Liu, Monk @ 2021-05-26 23:57 UTC (permalink / raw)
  To: Li, Xin (Justin), amd-gfx
  Cc: Li, Xin (Justin), Deucher, Alexander, Min, Frank, Koenig, Christian

[AMD Official Use Only]

Looks it lack enough background for people to review:


-			if (adev->vcn.inst[i].ring_dec.sched.ready)
+			if (adev->vcn.inst[i].ring_dec.sched.ready ||
+				(adev->asic_type == CHIP_NAVI12 &&
+				amdgpu_sriov_vf(adev)))
 				++num_rings;

[ml] why for SRIOV navi12 is forced to have those DEC rings ? since  SRIOV navi12 have no decode capability , any explain here ?


-		if (amdgpu_is_tmz(adev))
-			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
[ML] why this is removed ? is it related to your issue ?


Thanks 

------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Li, Xin (Justin)
Sent: Wednesday, May 26, 2021 6:13 PM
To: amd-gfx@lists.freedesktop.org
Cc: Li, Xin (Justin) <Xin2.Li@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Min, Frank <Frank.Min@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing

since vcn decoding ring is not required, so just disable it.

Cc: Alex.Deucher <alexander.deucher@amd.com>
Cc: Christian.Konig <christian.koenig@amd.com>
Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
Signed-off-by: Frank.Min <Frank.Min@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 524e4fe5efe8..614e6b06e94e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 			if (adev->uvd.harvest_config & (1 << i))
 				continue;
 
-			if (adev->vcn.inst[i].ring_dec.sched.ready)
+			if (adev->vcn.inst[i].ring_dec.sched.ready ||
+				(adev->asic_type == CHIP_NAVI12 &&
+				amdgpu_sriov_vf(adev)))
 				++num_rings;
 		}
 		ib_start_alignment = 16;
@@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
 		if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
 			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
-		if (amdgpu_is_tmz(adev))
-			dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
 
 		vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
 		vm_size -= AMDGPU_VA_RESERVED_SIZE;
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 8af567c546db..dc8a36766c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
-	int i, r;
+	int i, r = -1;
 
 	adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
 					     ring->doorbell_index, 0);
 
-	if (amdgpu_sriov_vf(adev))
+	if (amdgpu_sriov_vf(adev)) {
 		vcn_v2_0_start_sriov(adev);
-
-	r = amdgpu_ring_test_helper(ring);
-	if (r)
-		goto done;
+		if (adev->asic_type == CHIP_NAVI12)
+			ring->sched.ready = false;
+	} else {
+		r = amdgpu_ring_test_helper(ring);
+		if (r)
+			goto done;
+	}
 
 	//Disable vcn decode for sriov
 	if (amdgpu_sriov_vf(adev))
@@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
 
 done:
 	if (!r)
-		DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
-			(adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
+		DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
+			(adev->asic_type == CHIP_NAVI12 &&
+				amdgpu_sriov_vf(adev))?"":"decode and",
+			(adev->pg_flags &
+				AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
 
 	return r;
 }
@@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
 	unsigned i;
 	int r;
 
-	if (amdgpu_sriov_vf(adev))
-		return 0;
-
 	WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
 	r = amdgpu_ring_alloc(ring, 4);
 	if (r)
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cmonk.liu%40amd.com%7Cb86e27d9b55f429b352308d9202ee408%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576208056272141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=cMllN28FN56voTpWwdnMmBB3CGXezs%2FaEwflSZD6qr4%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 23:57 ` Liu, Monk
@ 2021-05-27  7:17   ` Li, Xin (Justin)
  2021-05-31  5:57     ` Deng, Emily
  0 siblings, 1 reply; 8+ messages in thread
From: Li, Xin (Justin) @ 2021-05-27  7:17 UTC (permalink / raw)
  To: Liu, Monk, amd-gfx; +Cc: Deucher, Alexander, Min, Frank, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 6550 bytes --]

Hi, friends.

My apologize for this patch.

I’ve ported this patch from another branch to fix gstreamer’s lack of “vaapi264enc”, currently this ported patch did fix that issue. However, since this patch is ported from another branch, I might need to do some alternations and audits mainly in its commit messages. I will file another review right after my fixes.

Thank you all for you time.

BR,
Justin

From: Liu, Monk <Monk.Liu@amd.com>
Date: Thursday, May 27, 2021 at 07:57
To: Li, Xin (Justin) <Xin2.Li@amd.com>, amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Li, Xin (Justin) <Xin2.Li@amd.com>, Deucher, Alexander <Alexander.Deucher@amd.com>, Min, Frank <Frank.Min@amd.com>, Koenig, Christian <Christian.Koenig@amd.com>
Subject: RE: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
[AMD Official Use Only]

Looks it lack enough background for people to review:


-                       if (adev->vcn.inst[i].ring_dec.sched.ready)
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
+                               (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev)))
                                 ++num_rings;

[ml] why for SRIOV navi12 is forced to have those DEC rings ? since  SRIOV navi12 have no decode capability , any explain here ?


-               if (amdgpu_is_tmz(adev))
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
[ML] why this is removed ? is it related to your issue ?


Thanks

------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Li, Xin (Justin)
Sent: Wednesday, May 26, 2021 6:13 PM
To: amd-gfx@lists.freedesktop.org
Cc: Li, Xin (Justin) <Xin2.Li@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Min, Frank <Frank.Min@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing

since vcn decoding ring is not required, so just disable it.

Cc: Alex.Deucher <alexander.deucher@amd.com>
Cc: Christian.Konig <christian.koenig@amd.com>
Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
Signed-off-by: Frank.Min <Frank.Min@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 524e4fe5efe8..614e6b06e94e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
                         if (adev->uvd.harvest_config & (1 << i))
                                 continue;

-                       if (adev->vcn.inst[i].ring_dec.sched.ready)
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
+                               (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev)))
                                 ++num_rings;
                 }
                 ib_start_alignment = 16;
@@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
                 if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
-               if (amdgpu_is_tmz(adev))
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;

                 vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
                 vm_size -= AMDGPU_VA_RESERVED_SIZE;
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 8af567c546db..dc8a36766c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
-       int i, r;
+       int i, r = -1;

         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
                                              ring->doorbell_index, 0);

-       if (amdgpu_sriov_vf(adev))
+       if (amdgpu_sriov_vf(adev)) {
                 vcn_v2_0_start_sriov(adev);
-
-       r = amdgpu_ring_test_helper(ring);
-       if (r)
-               goto done;
+               if (adev->asic_type == CHIP_NAVI12)
+                       ring->sched.ready = false;
+       } else {
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
+                       goto done;
+       }

         //Disable vcn decode for sriov
         if (amdgpu_sriov_vf(adev))
@@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)

 done:
         if (!r)
-               DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
-                       (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
+               DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
+                       (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev))?"":"decode and",
+                       (adev->pg_flags &
+                               AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");

         return r;
 }
@@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
         unsigned i;
         int r;

-       if (amdgpu_sriov_vf(adev))
-               return 0;
-
         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
         r = amdgpu_ring_alloc(ring, 4);
         if (r)
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cmonk.liu%40amd.com%7Cb86e27d9b55f429b352308d9202ee408%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576208056272141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=cMllN28FN56voTpWwdnMmBB3CGXezs%2FaEwflSZD6qr4%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 15121 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 10:49 ` Christian König
@ 2021-05-27 14:22   ` Leo Liu
  2021-05-27 14:27   ` Liu, Leo
  1 sibling, 0 replies; 8+ messages in thread
From: Leo Liu @ 2021-05-27 14:22 UTC (permalink / raw)
  To: Christian König, Li, Xin (Justin), amd-gfx
  Cc: Alex . Deucher, Frank . Min


On 2021-05-26 6:49 a.m., Christian König wrote:
> Am 26.05.21 um 12:13 schrieb Li, Xin (Justin):
>> since vcn decoding ring is not required, so just disable it.
>>
>> Cc: Alex.Deucher <alexander.deucher@amd.com>
>> Cc: Christian.Konig <christian.koenig@amd.com>
>> Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
>> Signed-off-by: Frank.Min <Frank.Min@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
>>   2 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index 524e4fe5efe8..614e6b06e94e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device 
>> *adev,
>>               if (adev->uvd.harvest_config & (1 << i))
>>                   continue;
>>   -            if (adev->vcn.inst[i].ring_dec.sched.ready)
>> +            if (adev->vcn.inst[i].ring_dec.sched.ready ||
>> +                (adev->asic_type == CHIP_NAVI12 &&
>> +                amdgpu_sriov_vf(adev)))
>
> Leo needs to take a closer look, but that looks fishy to me.

The decode is explicitly disabled with sriov case with vcn2

+            ring->sched.ready = false;

and I don't understand either why to add the ring number here if already 
have it disabled. If you are trying to workaround some issues, the 
changes from here is very bad hack and you probably need to find the 
real root cause.

Regards,

Leo


>
> Why should the ring be available if it is disabled? That doesn't make 
> sense.
>
> Christian.
>
>>                   ++num_rings;
>>           }
>>           ib_start_alignment = 16;
>> @@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, 
>> void *data, struct drm_file *filp)
>>               dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
>>           if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
>>               dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
>> -        if (amdgpu_is_tmz(adev))
>> -            dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>>             vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
>>           vm_size -= AMDGPU_VA_RESERVED_SIZE;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c 
>> b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> index 8af567c546db..dc8a36766c4a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> @@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
>>   {
>>       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>>       struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
>> -    int i, r;
>> +    int i, r = -1;
>>         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
>>                            ring->doorbell_index, 0);
>>   -    if (amdgpu_sriov_vf(adev))
>> +    if (amdgpu_sriov_vf(adev)) {
>>           vcn_v2_0_start_sriov(adev);
>> -
>> -    r = amdgpu_ring_test_helper(ring);
>> -    if (r)
>> -        goto done;
>> +        if (adev->asic_type == CHIP_NAVI12)
>> +            ring->sched.ready = false;
>> +    } else {
>> +        r = amdgpu_ring_test_helper(ring);
>> +        if (r)
>> +            goto done;
>> +    }
>>         //Disable vcn decode for sriov
>>       if (amdgpu_sriov_vf(adev))
>> @@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
>>     done:
>>       if (!r)
>> -        DRM_INFO("VCN decode and encode initialized 
>> successfully(under %s).\n",
>> -            (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG 
>> Mode":"SPG Mode");
>> +        DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
>> +            (adev->asic_type == CHIP_NAVI12 &&
>> +                amdgpu_sriov_vf(adev))?"":"decode and",
>> +            (adev->pg_flags &
>> +                AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
>>         return r;
>>   }
>> @@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct 
>> amdgpu_ring *ring)
>>       unsigned i;
>>       int r;
>>   -    if (amdgpu_sriov_vf(adev))
>> -        return 0;
>> -
>>       WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
>>       r = amdgpu_ring_alloc(ring, 4);
>>       if (r)
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-26 10:49 ` Christian König
  2021-05-27 14:22   ` Leo Liu
@ 2021-05-27 14:27   ` Liu, Leo
  1 sibling, 0 replies; 8+ messages in thread
From: Liu, Leo @ 2021-05-27 14:27 UTC (permalink / raw)
  To: Koenig, Christian, Li, Xin (Justin), amd-gfx
  Cc: Deucher, Alexander, Min, Frank

[Public]

On 2021-05-26 6:49 a.m., Christian König wrote:
> Am 26.05.21 um 12:13 schrieb Li, Xin (Justin):
>> since vcn decoding ring is not required, so just disable it.
>>
>> Cc: Alex.Deucher <alexander.deucher@amd.com>
>> Cc: Christian.Konig <christian.koenig@amd.com>
>> Signed-off-by: Li.Xin.Justin <xin2.li@amd.com>
>> Signed-off-by: Frank.Min <Frank.Min@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
>>   drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
>>   2 files changed, 17 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index 524e4fe5efe8..614e6b06e94e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device
>> *adev,
>>               if (adev->uvd.harvest_config & (1 << i))
>>                   continue;
>>   -            if (adev->vcn.inst[i].ring_dec.sched.ready)
>> +            if (adev->vcn.inst[i].ring_dec.sched.ready ||
>> +                (adev->asic_type == CHIP_NAVI12 &&
>> +                amdgpu_sriov_vf(adev)))
>
> Leo needs to take a closer look, but that looks fishy to me.

The decode is explicitly disabled with sriov case with vcn2

+            ring->sched.ready = false;

and I don't understand either why to add the ring number here if already
have it disabled. If you are trying to workaround some issues, the
changes from here is very bad hack and you probably need to find the
real root cause.

Regards,

Leo


>
> Why should the ring be available if it is disabled? That doesn't make
> sense.
>
> Christian.
>
>>                   ++num_rings;
>>           }
>>           ib_start_alignment = 16;
>> @@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev,
>> void *data, struct drm_file *filp)
>>               dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
>>           if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
>>               dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
>> -        if (amdgpu_is_tmz(adev))
>> -            dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>>             vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
>>           vm_size -= AMDGPU_VA_RESERVED_SIZE;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> index 8af567c546db..dc8a36766c4a 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
>> @@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
>>   {
>>       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>>       struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
>> -    int i, r;
>> +    int i, r = -1;
>>         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
>>                            ring->doorbell_index, 0);
>>   -    if (amdgpu_sriov_vf(adev))
>> +    if (amdgpu_sriov_vf(adev)) {
>>           vcn_v2_0_start_sriov(adev);
>> -
>> -    r = amdgpu_ring_test_helper(ring);
>> -    if (r)
>> -        goto done;
>> +        if (adev->asic_type == CHIP_NAVI12)
>> +            ring->sched.ready = false;
>> +    } else {
>> +        r = amdgpu_ring_test_helper(ring);
>> +        if (r)
>> +            goto done;
>> +    }
>>         //Disable vcn decode for sriov
>>       if (amdgpu_sriov_vf(adev))
>> @@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)
>>     done:
>>       if (!r)
>> -        DRM_INFO("VCN decode and encode initialized
>> successfully(under %s).\n",
>> -            (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG
>> Mode":"SPG Mode");
>> +        DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
>> +            (adev->asic_type == CHIP_NAVI12 &&
>> +                amdgpu_sriov_vf(adev))?"":"decode and",
>> +            (adev->pg_flags &
>> +                AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
>>         return r;
>>   }
>> @@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct
>> amdgpu_ring *ring)
>>       unsigned i;
>>       int r;
>>   -    if (amdgpu_sriov_vf(adev))
>> -        return 0;
>> -
>>       WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
>>       r = amdgpu_ring_alloc(ring, 4);
>>       if (r)
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
  2021-05-27  7:17   ` Li, Xin (Justin)
@ 2021-05-31  5:57     ` Deng, Emily
  0 siblings, 0 replies; 8+ messages in thread
From: Deng, Emily @ 2021-05-31  5:57 UTC (permalink / raw)
  To: Li, Xin (Justin), Liu, Monk, amd-gfx
  Cc: Deucher, Alexander, Min, Frank, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 8617 bytes --]

Hi Monk,
     Yes, actually this patch is to disable decode ring, and also want to let gstreamer could continue running. As gstreamer will check both encode and decode capability, if any of this is missing, then it couldn't run.
     As for navi12 sriov it disables decode ring, so adev->vcn.inst[i].ring_dec.sched.ready will be false, so add extra follow code here to report decode.

+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
+                               (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev)))
                                 ++num_rings;

Best wishes
Emily Deng
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Li, Xin (Justin)
Sent: Thursday, May 27, 2021 3:18 PM
To: Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Min, Frank <Frank.Min@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing

Hi, friends.

My apologize for this patch.

I've ported this patch from another branch to fix gstreamer's lack of "vaapi264enc", currently this ported patch did fix that issue. However, since this patch is ported from another branch, I might need to do some alternations and audits mainly in its commit messages. I will file another review right after my fixes.

Thank you all for you time.

BR,
Justin

From: Liu, Monk <Monk.Liu@amd.com<mailto:Monk.Liu@amd.com>>
Date: Thursday, May 27, 2021 at 07:57
To: Li, Xin (Justin) <Xin2.Li@amd.com<mailto:Xin2.Li@amd.com>>, amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> <amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>>
Cc: Li, Xin (Justin) <Xin2.Li@amd.com<mailto:Xin2.Li@amd.com>>, Deucher, Alexander <Alexander.Deucher@amd.com<mailto:Alexander.Deucher@amd.com>>, Min, Frank <Frank.Min@amd.com<mailto:Frank.Min@amd.com>>, Koenig, Christian <Christian.Koenig@amd.com<mailto:Christian.Koenig@amd.com>>
Subject: RE: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing
[AMD Official Use Only]

Looks it lack enough background for people to review:


-                       if (adev->vcn.inst[i].ring_dec.sched.ready)
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
+                               (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev)))
                                 ++num_rings;

[ml] why for SRIOV navi12 is forced to have those DEC rings ? since  SRIOV navi12 have no decode capability , any explain here ?


-               if (amdgpu_is_tmz(adev))
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
[ML] why this is removed ? is it related to your issue ?


Thanks

------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Li, Xin (Justin)
Sent: Wednesday, May 26, 2021 6:13 PM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>
Cc: Li, Xin (Justin) <Xin2.Li@amd.com<mailto:Xin2.Li@amd.com>>; Deucher, Alexander <Alexander.Deucher@amd.com<mailto:Alexander.Deucher@amd.com>>; Min, Frank <Frank.Min@amd.com<mailto:Frank.Min@amd.com>>; Koenig, Christian <Christian.Koenig@amd.com<mailto:Christian.Koenig@amd.com>>
Subject: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing

since vcn decoding ring is not required, so just disable it.

Cc: Alex.Deucher <alexander.deucher@amd.com<mailto:alexander.deucher@amd.com>>
Cc: Christian.Konig <christian.koenig@amd.com<mailto:christian.koenig@amd.com>>
Signed-off-by: Li.Xin.Justin <xin2.li@amd.com<mailto:xin2.li@amd.com>>
Signed-off-by: Frank.Min <Frank.Min@amd.com<mailto:Frank.Min@amd.com>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 524e4fe5efe8..614e6b06e94e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
                         if (adev->uvd.harvest_config & (1 << i))
                                 continue;

-                       if (adev->vcn.inst[i].ring_dec.sched.ready)
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||
+                               (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev)))
                                 ++num_rings;
                 }
                 ib_start_alignment = 16;
@@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
                 if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
-               if (amdgpu_is_tmz(adev))
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;

                 vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
                 vm_size -= AMDGPU_VA_RESERVED_SIZE;
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
index 8af567c546db..dc8a36766c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
@@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
-       int i, r;
+       int i, r = -1;

         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
                                              ring->doorbell_index, 0);

-       if (amdgpu_sriov_vf(adev))
+       if (amdgpu_sriov_vf(adev)) {
                 vcn_v2_0_start_sriov(adev);
-
-       r = amdgpu_ring_test_helper(ring);
-       if (r)
-               goto done;
+               if (adev->asic_type == CHIP_NAVI12)
+                       ring->sched.ready = false;
+       } else {
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
+                       goto done;
+       }

         //Disable vcn decode for sriov
         if (amdgpu_sriov_vf(adev))
@@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)

 done:
         if (!r)
-               DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",
-                       (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");
+               DRM_INFO("VCN %s encode initialized successfully(under %s).\n",
+                       (adev->asic_type == CHIP_NAVI12 &&
+                               amdgpu_sriov_vf(adev))?"":"decode and",
+                       (adev->pg_flags &
+                               AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");

         return r;
 }
@@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
         unsigned i;
         int r;

-       if (amdgpu_sriov_vf(adev))
-               return 0;
-
         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);
         r = amdgpu_ring_alloc(ring, 4);
         if (r)
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cmonk.liu%40amd.com%7Cb86e27d9b55f429b352308d9202ee408%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576208056272141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=cMllN28FN56voTpWwdnMmBB3CGXezs%2FaEwflSZD6qr4%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CEmily.Deng%40amd.com%7Cd5443c0408834299dba308d920df8dcc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576966819274495%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=URmI6iI7DC5tlOH2ujCKAQ70oxJQUWX6VcAhzjlkrWM%3D&reserved=0>

[-- Attachment #1.2: Type: text/html, Size: 18598 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-05-31  5:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 10:13 [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing Li, Xin (Justin)
2021-05-26 10:49 ` Christian König
2021-05-27 14:22   ` Leo Liu
2021-05-27 14:27   ` Liu, Leo
2021-05-26 19:08 ` Alex Deucher
2021-05-26 23:57 ` Liu, Monk
2021-05-27  7:17   ` Li, Xin (Justin)
2021-05-31  5:57     ` Deng, Emily

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.