[PATCH] drm/amdgpu/vcn: port mmsch ctx table size fix from jpeg v4

Jane Jian Jane.Jian at amd.com
Wed Jun 12 03:41:53 UTC 2024


add jpeg table size to ctx table size rather than override it

v2:
save jpeg header info otherwise it will lose debug info
Signed-off-by: Jane Jian <Jane.Jian at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c
index 04d8966423de..ba052b104668 100644
--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c
@@ -200,9 +200,12 @@ static int jpeg_v4_0_3_start_sriov(struct amdgpu_device *adev)
 	for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) {
 		jpeg_inst = GET_INST(JPEG, i);
 
-		memset(&header, 0, sizeof(struct mmsch_v4_0_3_init_header));
+		size = sizeof(struct mmsch_v4_0_3_init_header);
+		table_loc = (uint32_t *)table->cpu_addr;
+		memcpy(&header, (void *)table_loc, size);
+
 		header.version = MMSCH_VERSION;
-		header.total_size = sizeof(struct mmsch_v4_0_3_init_header) >> 2;
+		header.total_size = RREG32_SOC15(VCN, 0, regMMSCH_VF_CTX_SIZE);
 
 		table_loc = (uint32_t *)table->cpu_addr;
 		table_loc += header.total_size;
-- 
2.34.1



More information about the amd-gfx mailing list