amdgpu: check the user fence only if the IP supports user fences

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
main
Marek Olšák 2015-07-08 11:12:31 +02:00 committed by Alex Deucher
parent 67c994f057
commit 8097d08ee4
1 changed files with 18 additions and 13 deletions

View File

@ -383,7 +383,6 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
uint32_t *expired)
{
amdgpu_context_handle context;
uint64_t *signaled_fence;
uint64_t *expired_fence;
unsigned ip_type, ip_instance;
uint32_t ring;
@ -405,8 +404,6 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
ip_type = fence->ip_type;
ip_instance = fence->ip_instance;
ring = fence->ring;
signaled_fence = context->fence_cpu;
signaled_fence += amdgpu_cs_fence_index(ip_type, ring);
expired_fence = &context->expired_fences[ip_type][ip_instance][ring];
*expired = false;
@ -418,6 +415,12 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
return 0;
}
/* Check the user fence only if the IP supports user fences. */
if (fence->ip_type != AMDGPU_HW_IP_UVD &&
fence->ip_type != AMDGPU_HW_IP_VCE) {
uint64_t *signaled_fence = context->fence_cpu;
signaled_fence += amdgpu_cs_fence_index(ip_type, ring);
if (fence->fence <= *signaled_fence) {
/* This fence value is signaled already. */
*expired_fence = *signaled_fence;
@ -426,10 +429,12 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
return 0;
}
/* Checking the user fence is enough. */
if (fence->timeout_ns == 0) {
pthread_mutex_unlock(&context->sequence_mutex);
return 0;
}
}
pthread_mutex_unlock(&context->sequence_mutex);