diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2015-11-05 02:23:09 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-12-02 15:54:33 -0500 |
commit | d033a6de80054139b4358db12cf6bb8d6cf58853 (patch) | |
tree | 10a1d10028b74702abea494cb5e029747696dbd5 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
parent | ccba7691a580a0967f60a512473ce699b9edac0d (diff) |
drm/amd: abstract kernel rq and normal rq to priority of run queue
Allows us to set priorities in the scheduler.
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index fec65f01c031..c1f2308b4115 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include "amdgpu.h" | 26 | #include "amdgpu.h" |
27 | 27 | ||
28 | int amdgpu_ctx_init(struct amdgpu_device *adev, bool kernel, | 28 | int amdgpu_ctx_init(struct amdgpu_device *adev, enum amd_sched_priority pri, |
29 | struct amdgpu_ctx *ctx) | 29 | struct amdgpu_ctx *ctx) |
30 | { | 30 | { |
31 | unsigned i, j; | 31 | unsigned i, j; |
@@ -42,10 +42,9 @@ int amdgpu_ctx_init(struct amdgpu_device *adev, bool kernel, | |||
42 | /* create context entity for each ring */ | 42 | /* create context entity for each ring */ |
43 | for (i = 0; i < adev->num_rings; i++) { | 43 | for (i = 0; i < adev->num_rings; i++) { |
44 | struct amd_sched_rq *rq; | 44 | struct amd_sched_rq *rq; |
45 | if (kernel) | 45 | if (pri >= AMD_SCHED_MAX_PRIORITY) |
46 | rq = &adev->rings[i]->sched.kernel_rq; | 46 | return -EINVAL; |
47 | else | 47 | rq = &adev->rings[i]->sched.sched_rq[pri]; |
48 | rq = &adev->rings[i]->sched.sched_rq; | ||
49 | r = amd_sched_entity_init(&adev->rings[i]->sched, | 48 | r = amd_sched_entity_init(&adev->rings[i]->sched, |
50 | &ctx->rings[i].entity, | 49 | &ctx->rings[i].entity, |
51 | rq, amdgpu_sched_jobs); | 50 | rq, amdgpu_sched_jobs); |
@@ -103,7 +102,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, | |||
103 | return r; | 102 | return r; |
104 | } | 103 | } |
105 | *id = (uint32_t)r; | 104 | *id = (uint32_t)r; |
106 | r = amdgpu_ctx_init(adev, false, ctx); | 105 | r = amdgpu_ctx_init(adev, AMD_SCHED_PRIORITY_NORMAL, ctx); |
107 | mutex_unlock(&mgr->lock); | 106 | mutex_unlock(&mgr->lock); |
108 | 107 | ||
109 | return r; | 108 | return r; |