diff options
author | Jammy Zhou <Jammy.Zhou@amd.com> | 2015-05-08 10:18:47 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-06-03 21:03:29 -0400 |
commit | 72efa7ebdea084b96f25021d0ba9c29074c2906f (patch) | |
tree | a209c2b373636fb047f4b0b8cbdbf0214f7d3998 /drivers/gpu/drm/amd | |
parent | 66b3cf2ab38f47db2d07fe24a00972fbf822cd74 (diff) |
drm/amdgpu: check context id for context switching (v2)
check the filp is not robust, and sometimes different contexts may
have same filp value.
v2: check both filp and ctx_id
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index bf0c607de195..a88302c0c93a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -945,6 +945,7 @@ struct amdgpu_ring { | |||
945 | unsigned next_rptr_offs; | 945 | unsigned next_rptr_offs; |
946 | unsigned fence_offs; | 946 | unsigned fence_offs; |
947 | struct drm_file *current_filp; | 947 | struct drm_file *current_filp; |
948 | unsigned current_ctx; | ||
948 | bool need_ctx_switch; | 949 | bool need_ctx_switch; |
949 | enum amdgpu_ring_type type; | 950 | enum amdgpu_ring_type type; |
950 | char name[16]; | 951 | char name[16]; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 86b93245bf9d..1035e443700f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -642,8 +642,10 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, | |||
642 | ib->is_const_ib = true; | 642 | ib->is_const_ib = true; |
643 | if (chunk_ib->flags & AMDGPU_IB_FLAG_GDS) | 643 | if (chunk_ib->flags & AMDGPU_IB_FLAG_GDS) |
644 | ib->gds_needed = true; | 644 | ib->gds_needed = true; |
645 | if (ib->ring->current_filp != parser->filp) { | 645 | if ((ib->ring->current_filp != parser->filp) || |
646 | (ib->ring->current_ctx != parser->ctx_id)) { | ||
646 | ib->ring->need_ctx_switch = true; | 647 | ib->ring->need_ctx_switch = true; |
648 | ib->ring->current_ctx = parser->ctx_id; | ||
647 | ib->ring->current_filp = parser->filp; | 649 | ib->ring->current_filp = parser->filp; |
648 | } | 650 | } |
649 | 651 | ||