]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdgpu/VCN: add buffer for indirect SRAM usage
authorLeo Liu <leo.liu@amd.com>
Fri, 24 May 2019 18:07:41 +0000 (14:07 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 21 Jun 2019 23:59:33 +0000 (18:59 -0500)
This will be used later for indirect SRAM mode

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h

index d0b95e58959a79947cbff9aedecca7a2ee67390a..7621077378dd6024d879334dfbf3958c2005c566 100644 (file)
@@ -137,6 +137,16 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
                return r;
        }
 
+       if (adev->vcn.indirect_sram) {
+               r = amdgpu_bo_create_kernel(adev, 64 * 2 * 4, PAGE_SIZE,
+                           AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.dpg_sram_bo,
+                           &adev->vcn.dpg_sram_gpu_addr, &adev->vcn.dpg_sram_cpu_addr);
+               if (r) {
+                       dev_err(adev->dev, "(%d) failed to allocate DPG bo\n", r);
+                       return r;
+               }
+       }
+
        return 0;
 }
 
@@ -146,6 +156,12 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
 
        kvfree(adev->vcn.saved_bo);
 
+       if (adev->vcn.indirect_sram) {
+               amdgpu_bo_free_kernel(&adev->vcn.dpg_sram_bo,
+                             &adev->vcn.dpg_sram_gpu_addr,
+                             (void **)&adev->vcn.dpg_sram_cpu_addr);
+       }
+
        amdgpu_bo_free_kernel(&adev->vcn.vcpu_bo,
                              &adev->vcn.gpu_addr,
                              (void **)&adev->vcn.cpu_addr);
index 5b38798f8bc3c6cf636ac71a79be8b43880b0106..762cffeaf30118154d5378ed48c30c2020f7dc41 100644 (file)
@@ -164,6 +164,12 @@ struct amdgpu_vcn {
        struct amdgpu_vcn_reg   internal, external;
        int (*pause_dpg_mode)(struct amdgpu_device *adev,
                struct dpg_pause_state *new_state);
+
+       bool                    indirect_sram;
+       struct amdgpu_bo        *dpg_sram_bo;
+       void                    *dpg_sram_cpu_addr;
+       uint64_t                dpg_sram_gpu_addr;
+       uint32_t                *dpg_sram_curr_addr;
 };
 
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);