[PATCH 47/48] drm/amdgpu: use new helper to get num instances for JPEG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the helper for all non-JPEG code which queries the number
of SDMA instances.

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c        | 6 ++++--
 drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c     | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 4f6f617066955..330f5cfb79218 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -495,8 +495,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 	case AMDGPU_HW_IP_VCN_JPEG:
 		type = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
 			AMD_IP_BLOCK_TYPE_JPEG : AMD_IP_BLOCK_TYPE_VCN;
+		num_inst = amdgpu_device_ip_get_num_inst(adev, type);
 
-		for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) {
+		for (i = 0; i < num_inst; i++) {
 			if (adev->jpeg.harvest_config & (1 << i))
 				continue;
 
@@ -688,7 +689,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			count = adev->sdma.num_instances;
 			break;
 		case AMD_IP_BLOCK_TYPE_JPEG:
-			count = adev->jpeg.num_jpeg_inst * adev->jpeg.num_jpeg_rings;
+			count = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_JPEG) *
+				adev->jpeg.num_jpeg_rings;
 			break;
 		case AMD_IP_BLOCK_TYPE_VCN:
 			count = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_VCN);
diff --git a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
index ab7a2ba59a1bd..6d020e81ff945 100644
--- a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
+++ b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
@@ -465,7 +465,7 @@ static int aqua_vanjaram_get_xcp_res_info(struct amdgpu_xcp_mgr *xcp_mgr,
 	max_res[AMDGPU_XCP_RES_XCC] = NUM_XCC(adev->gfx.xcc_mask);
 	max_res[AMDGPU_XCP_RES_DMA] = adev->sdma.num_instances;
 	max_res[AMDGPU_XCP_RES_DEC] = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_VCN);
-	max_res[AMDGPU_XCP_RES_JPEG] = adev->jpeg.num_jpeg_inst;
+	max_res[AMDGPU_XCP_RES_JPEG] = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_JPEG);
 
 	switch (mode) {
 	case AMDGPU_SPX_PARTITION_MODE:
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index e660f4a663781..921cad5ef5f4a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -1541,8 +1541,10 @@ int smu_v14_0_set_jpeg_enable(struct smu_context *smu,
 {
 	struct amdgpu_device *adev = smu->adev;
 	int i, ret = 0;
+	int num_jpeg_inst = amdgpu_device_ip_get_num_inst(adev,
+							  AMD_IP_BLOCK_TYPE_JPEG);
 
-	for (i = 0; i < adev->jpeg.num_jpeg_inst; i++) {
+	for (i = 0; i < num_jpeg_inst; i++) {
 		if (adev->jpeg.harvest_config & (1 << i))
 			continue;
 
-- 
2.47.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux