aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
diff options
context:
space:
mode:
authorChunming Zhou <[email protected]>2015-12-10 09:34:33 +0000
committerAlex Deucher <[email protected]>2015-12-18 22:29:44 +0000
commit5b0112356cf9a735632b26ff5f3450e1716c8598 (patch)
tree12bc09ab704fa9a8e6118f8f83fbab14cf4dc436 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
parentdrm/amdgpu: limit visible vram if it's smaller than the BAR (diff)
downloadkernel-5b0112356cf9a735632b26ff5f3450e1716c8598.tar.gz
kernel-5b0112356cf9a735632b26ff5f3450e1716c8598.zip
drm/amdgpu: restrict the sched jobs number to power of two
Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> CC: [email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index ee121ec2917b..17d1fb12128a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -252,7 +252,7 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring,
unsigned idx = 0;
struct fence *other = NULL;
- idx = seq % amdgpu_sched_jobs;
+ idx = seq & (amdgpu_sched_jobs - 1);
other = cring->fences[idx];
if (other) {
signed long r;
@@ -292,7 +292,7 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
return NULL;
}
- fence = fence_get(cring->fences[seq % amdgpu_sched_jobs]);
+ fence = fence_get(cring->fences[seq & (amdgpu_sched_jobs - 1)]);
spin_unlock(&ctx->ring_lock);
return fence;