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

Alex Deucher alexander.deucher at amd.com
Tue Dec 10 22:53:35 UTC 2024


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

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index e1e0f80b23606..4f6f617066955 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -432,7 +432,8 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 		break;
 	case AMDGPU_HW_IP_UVD:
 		type = AMD_IP_BLOCK_TYPE_UVD;
-		for (i = 0; i < adev->uvd.num_uvd_inst; i++) {
+		num_inst = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_UVD);
+		for (i = 0; i < num_inst; i++) {
 			if (adev->uvd.harvest_config & (1 << i))
 				continue;
 
@@ -452,7 +453,8 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 		break;
 	case AMDGPU_HW_IP_UVD_ENC:
 		type = AMD_IP_BLOCK_TYPE_UVD;
-		for (i = 0; i < adev->uvd.num_uvd_inst; i++) {
+		num_inst = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_UVD);
+		for (i = 0; i < num_inst; i++) {
 			if (adev->uvd.harvest_config & (1 << i))
 				continue;
 
@@ -692,7 +694,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			count = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_VCN);
 			break;
 		case AMD_IP_BLOCK_TYPE_UVD:
-			count = adev->uvd.num_uvd_inst;
+			count = amdgpu_device_ip_get_num_inst(adev, AMD_IP_BLOCK_TYPE_UVD);
 			break;
 		/* For all other IP block types not listed in the switch statement
 		 * the ip status is valid here and the instance count is one.
-- 
2.47.1



More information about the amd-gfx mailing list