diff options
| author | Alex Xie <AlexBin.Xie@amd.com> | 2017-05-30 17:10:16 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-31 14:16:38 -0400 |
| commit | dd684d313e280c3bad2ebb7b33e7688ab5409bc9 (patch) | |
| tree | 4963987a0c85ab514b9c317944ed5fc369c46ef9 /drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |
| parent | 1410f64651e35411b4bb7a10f32eb6225925110a (diff) | |
drm/amdgpu: Optimize a function called by every IB sheduling
Move several if statements and a loop statment from
run time to initialization time.
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 6a85db0c0bc3..7d95435fad16 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
| @@ -153,6 +153,36 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring) | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | /** | 155 | /** |
| 156 | * amdgpu_ring_check_compute_vm_bug - check whether this ring has compute vm bug | ||
| 157 | * | ||
| 158 | * @adev: amdgpu_device pointer | ||
| 159 | * @ring: amdgpu_ring structure holding ring information | ||
| 160 | */ | ||
| 161 | static void amdgpu_ring_check_compute_vm_bug(struct amdgpu_device *adev, | ||
| 162 | struct amdgpu_ring *ring) | ||
| 163 | { | ||
| 164 | const struct amdgpu_ip_block *ip_block; | ||
| 165 | |||
| 166 | ring->has_compute_vm_bug = false; | ||
| 167 | |||
| 168 | if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE) | ||
| 169 | /* only compute rings */ | ||
| 170 | return; | ||
| 171 | |||
| 172 | ip_block = amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX); | ||
| 173 | if (!ip_block) | ||
| 174 | return; | ||
| 175 | |||
| 176 | /* Compute ring has a VM bug for GFX version < 7. | ||
| 177 | And compute ring has a VM bug for GFX 8 MEC firmware version < 673.*/ | ||
| 178 | if (ip_block->version->major <= 7) { | ||
| 179 | ring->has_compute_vm_bug = true; | ||
| 180 | } else if (ip_block->version->major == 8) | ||
| 181 | if (adev->gfx.mec_fw_version < 673) | ||
| 182 | ring->has_compute_vm_bug = true; | ||
| 183 | } | ||
| 184 | |||
| 185 | /** | ||
| 156 | * amdgpu_ring_init - init driver ring struct. | 186 | * amdgpu_ring_init - init driver ring struct. |
| 157 | * | 187 | * |
| 158 | * @adev: amdgpu_device pointer | 188 | * @adev: amdgpu_device pointer |
| @@ -257,6 +287,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
| 257 | if (amdgpu_debugfs_ring_init(adev, ring)) { | 287 | if (amdgpu_debugfs_ring_init(adev, ring)) { |
| 258 | DRM_ERROR("Failed to register debugfs file for rings !\n"); | 288 | DRM_ERROR("Failed to register debugfs file for rings !\n"); |
| 259 | } | 289 | } |
| 290 | |||
| 291 | amdgpu_ring_check_compute_vm_bug(adev, ring); | ||
| 292 | |||
| 260 | return 0; | 293 | return 0; |
| 261 | } | 294 | } |
| 262 | 295 | ||
