drm/amdgpu: add vcn enc irq support
authorLeo Liu <leo.liu@amd.com>
Tue, 21 Feb 2017 20:19:18 +0000 (15:19 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 24 May 2017 21:41:42 +0000 (17:41 -0400)
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c

index e15a81ffa2cae4f4618a424d2ce7c132755e18dd..f09d2aea9886ce3d3ce9b50dc4de6ad34d9a29c5 100644 (file)
@@ -74,11 +74,19 @@ static int vcn_v1_0_sw_init(void *handle)
        int i, r;
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       /* VCN TRAP */
+       /* VCN DEC TRAP */
        r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VCN, 124, &adev->vcn.irq);
        if (r)
                return r;
 
+       /* VCN ENC TRAP */
+       for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
+               r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_VCN, i + 119,
+                                       &adev->vcn.irq);
+               if (r)
+                       return r;
+       }
+
        r = amdgpu_vcn_sw_init(adev);
        if (r)
                return r;
@@ -839,7 +847,21 @@ static int vcn_v1_0_process_interrupt(struct amdgpu_device *adev,
 {
        DRM_DEBUG("IH: VCN TRAP\n");
 
-       amdgpu_fence_process(&adev->vcn.ring_dec);
+       switch (entry->src_id) {
+       case 124:
+               amdgpu_fence_process(&adev->vcn.ring_dec);
+               break;
+       case 119:
+               amdgpu_fence_process(&adev->vcn.ring_enc[0]);
+               break;
+       case 120:
+               amdgpu_fence_process(&adev->vcn.ring_enc[1]);
+               break;
+       default:
+               DRM_ERROR("Unhandled interrupt: %d %d\n",
+                         entry->src_id, entry->src_data[0]);
+               break;
+       }
 
        return 0;
 }
@@ -938,7 +960,7 @@ static const struct amdgpu_irq_src_funcs vcn_v1_0_irq_funcs = {
 
 static void vcn_v1_0_set_irq_funcs(struct amdgpu_device *adev)
 {
-       adev->vcn.irq.num_types = 1;
+       adev->uvd.irq.num_types = adev->vcn.num_enc_rings + 1;
        adev->vcn.irq.funcs = &vcn_v1_0_irq_funcs;
 }