Skip to contentSkip to conversation

drm/amdgpu: IB test encode test package change for VCN5

PATCH Superseded Sonny Jiang 2 participants 2 messages Apr 22, 2024 – Apr 23, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: IB test encode test package change for VCN5

From: Sonny Jiang <[email protected]>

VCN5 session info package interface changed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +10 -2
index bb85772b1374..2bebdaaff533 100644
@@ -851,6 +851,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
 					 struct amdgpu_ib *ib_msg,
 					 struct dma_fence **fence)
 {
+	struct amdgpu_device *adev = ring->adev;
 	unsigned int ib_size_dw = 16;
 	struct amdgpu_job *job;
 	struct amdgpu_ib *ib;
@@ -882,7 +883,10 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
 	ib->ptr[ib->length_dw++] = handle;
 	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
 	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	if (amdgpu_ip_version(adev, UVD_HWIP, 0) < IP_VERSION(5, 0, 0))
+		ib->ptr[ib->length_dw++] = 0x0000000b;
+	else
+		ib->ptr[ib->length_dw++] = 0x00000000;
 
 	ib->ptr[ib->length_dw++] = 0x00000014;
 	ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -918,6 +922,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
 					  struct amdgpu_ib *ib_msg,
 					  struct dma_fence **fence)
 {
+	struct amdgpu_device *adev = ring->adev;
 	unsigned int ib_size_dw = 16;
 	struct amdgpu_job *job;
 	struct amdgpu_ib *ib;
@@ -949,7 +954,10 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
 	ib->ptr[ib->length_dw++] = handle;
 	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
 	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	if (amdgpu_ip_version(adev, UVD_HWIP, 0) < IP_VERSION(5, 0, 0))
+		ib->ptr[ib->length_dw++] = 0x0000000b;
+	else
+		ib->ptr[ib->length_dw++] = 0x00000000;
 
 	ib->ptr[ib->length_dw++] = 0x00000014;
 	ib->ptr[ib->length_dw++] = 0x00000002;
Signature · 1 line
2.43.2
#1 lore raw

Am 22.04.24 um 21:59 schrieb Sonny Jiang:

Quoted 5 lines

From: Sonny Jiang <[email protected]>

VCN5 session info package interface changed

Mhm, in general we should push back on FW changes which makes stuff like that necessary. So what is the justification?

If the FW has a good justification for it then in theory we should create new hw generation specific functions. But copying the whole function for vcn_v5_0.c is overkill as well.

Regards,
Christian.

Quoted 48 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +10 -2
index bb85772b1374..2bebdaaff533 100644
@@ -851,6 +851,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
  					 struct amdgpu_ib *ib_msg,
  					 struct dma_fence **fence)
  {
+	struct amdgpu_device *adev = ring->adev;
  	unsigned int ib_size_dw = 16;
  	struct amdgpu_job *job;
  	struct amdgpu_ib *ib;
@@ -882,7 +883,10 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
  	ib->ptr[ib->length_dw++] = handle;
  	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
  	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	if (amdgpu_ip_version(adev, UVD_HWIP, 0) < IP_VERSION(5, 0, 0))
+		ib->ptr[ib->length_dw++] = 0x0000000b;
+	else
+		ib->ptr[ib->length_dw++] = 0x00000000;
 
  	ib->ptr[ib->length_dw++] = 0x00000014;
  	ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -918,6 +922,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
  					  struct amdgpu_ib *ib_msg,
  					  struct dma_fence **fence)
  {
+	struct amdgpu_device *adev = ring->adev;
  	unsigned int ib_size_dw = 16;
  	struct amdgpu_job *job;
  	struct amdgpu_ib *ib;
@@ -949,7 +954,10 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
  	ib->ptr[ib->length_dw++] = handle;
  	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
  	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	if (amdgpu_ip_version(adev, UVD_HWIP, 0) < IP_VERSION(5, 0, 0))
+		ib->ptr[ib->length_dw++] = 0x0000000b;
+	else
+		ib->ptr[ib->length_dw++] = 0x00000000;
 
  	ib->ptr[ib->length_dw++] = 0x00000014;
  	ib->ptr[ib->length_dw++] = 0x00000002;