summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2015-07-15 11:18:41 +0900
committerMichel Dänzer <michel@daenzer.net>2015-07-15 11:18:41 +0900
commitffa311b797b517111ee49e9b6b1027463649d5f6 (patch)
treedfaaa04d135aad4c22959943bd1e32b8ba99cd28
parent8d0f83967344b1bdcd849c2b996d9e84b398a219 (diff)
parent70d4170339894adf446e1a6629514e3349b643f6 (diff)
Merge branch 'amd-mainline-cherrypick' into amd-mainline
-rw-r--r--amdgpu/amdgpu_cs.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index b3f51700..67212289 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -367,12 +367,8 @@ static int amdgpu_ioctl_wait_cs(amdgpu_context_handle context,
else
args.in.timeout = amdgpu_cs_calculate_timeout(timeout_ns);
- /* Handle errors manually here because of timeout */
- r = ioctl(dev->fd, DRM_IOCTL_AMDGPU_WAIT_CS, &args);
- if (r == -1 && (errno == EINTR || errno == EAGAIN)) {
- *busy = true;
- return 0;
- } else if (r)
+ r = drmIoctl(dev->fd, DRM_IOCTL_AMDGPU_WAIT_CS, &args);
+ if (r)
return -errno;
*busy = args.out.status;
@@ -383,7 +379,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 +400,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,17 +411,25 @@ int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
return 0;
}
- if (fence->fence <= *signaled_fence) {
- /* This fence value is signaled already. */
- *expired_fence = *signaled_fence;
- pthread_mutex_unlock(&context->sequence_mutex);
- *expired = true;
- 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;
+ pthread_mutex_unlock(&context->sequence_mutex);
+ *expired = true;
+ return 0;
+ }
- if (fence->timeout_ns == 0) {
- pthread_mutex_unlock(&context->sequence_mutex);
- 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);