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) | |
download | blackbird-op-linux-dd684d313e280c3bad2ebb7b33e7688ab5409bc9.tar.gz blackbird-op-linux-dd684d313e280c3bad2ebb7b33e7688ab5409bc9.zip |
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) } /** + * amdgpu_ring_check_compute_vm_bug - check whether this ring has compute vm bug + * + * @adev: amdgpu_device pointer + * @ring: amdgpu_ring structure holding ring information + */ +static void amdgpu_ring_check_compute_vm_bug(struct amdgpu_device *adev, + struct amdgpu_ring *ring) +{ + const struct amdgpu_ip_block *ip_block; + + ring->has_compute_vm_bug = false; + + if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE) + /* only compute rings */ + return; + + ip_block = amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX); + if (!ip_block) + return; + + /* Compute ring has a VM bug for GFX version < 7. + And compute ring has a VM bug for GFX 8 MEC firmware version < 673.*/ + if (ip_block->version->major <= 7) { + ring->has_compute_vm_bug = true; + } else if (ip_block->version->major == 8) + if (adev->gfx.mec_fw_version < 673) + ring->has_compute_vm_bug = true; +} + +/** * amdgpu_ring_init - init driver ring struct. * * @adev: amdgpu_device pointer @@ -257,6 +287,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, if (amdgpu_debugfs_ring_init(adev, ring)) { DRM_ERROR("Failed to register debugfs file for rings !\n"); } + + amdgpu_ring_check_compute_vm_bug(adev, ring); + return 0; } |