summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-05-20 04:58:58 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-05-20 04:58:58 +0000
commit084a9e22f3ad6a1dcbf2b255b27ed2e30cd47707 (patch)
tree1d538476b2ad9d3bcf35a858b90935fcbff11466
parentf7c8a8a90d4dc29498601a62f68dd50bd6ebb381 (diff)
drm/amdgpu: Fix VCN allocation in CPX partition
From Lijo Lazar a624829bba2752a2b726f227574d6ca1d2e39671 in linux-6.6.y/6.6.31 f7e232de51bb1b45646e5b7dc4ebcf13510f2630 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c b/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c
index d0fc62784e8..0284c9198a0 100644
--- a/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c
+++ b/sys/dev/pci/drm/amd/amdgpu/aqua_vanjaram.c
@@ -61,6 +61,11 @@ void aqua_vanjaram_doorbell_index_init(struct amdgpu_device *adev)
adev->doorbell_index.max_assignment = AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT << 1;
}
+static bool aqua_vanjaram_xcp_vcn_shared(struct amdgpu_device *adev)
+{
+ return (adev->xcp_mgr->num_xcps > adev->vcn.num_vcn_inst);
+}
+
static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev,
uint32_t inst_idx, struct amdgpu_ring *ring)
{
@@ -86,7 +91,7 @@ static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev,
case AMDGPU_RING_TYPE_VCN_ENC:
case AMDGPU_RING_TYPE_VCN_JPEG:
ip_blk = AMDGPU_XCP_VCN;
- if (adev->xcp_mgr->mode == AMDGPU_CPX_PARTITION_MODE)
+ if (aqua_vanjaram_xcp_vcn_shared(adev))
inst_mask = 1 << (inst_idx * 2);
break;
default:
@@ -139,10 +144,12 @@ static int aqua_vanjaram_xcp_sched_list_update(
aqua_vanjaram_xcp_gpu_sched_update(adev, ring, ring->xcp_id);
- /* VCN is shared by two partitions under CPX MODE */
+ /* VCN may be shared by two partitions under CPX MODE in certain
+ * configs.
+ */
if ((ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC ||
- ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) &&
- adev->xcp_mgr->mode == AMDGPU_CPX_PARTITION_MODE)
+ ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) &&
+ aqua_vanjaram_xcp_vcn_shared(adev))
aqua_vanjaram_xcp_gpu_sched_update(adev, ring, ring->xcp_id + 1);
}