Commit 72efa7eb authored by Jammy Zhou's avatar Jammy Zhou Committed by Alex Deucher

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: default avatarJammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
parent 66b3cf2a
...@@ -945,6 +945,7 @@ struct amdgpu_ring { ...@@ -945,6 +945,7 @@ struct amdgpu_ring {
unsigned next_rptr_offs; unsigned next_rptr_offs;
unsigned fence_offs; unsigned fence_offs;
struct drm_file *current_filp; struct drm_file *current_filp;
unsigned current_ctx;
bool need_ctx_switch; bool need_ctx_switch;
enum amdgpu_ring_type type; enum amdgpu_ring_type type;
char name[16]; char name[16];
......
...@@ -642,8 +642,10 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, ...@@ -642,8 +642,10 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
ib->is_const_ib = true; ib->is_const_ib = true;
if (chunk_ib->flags & AMDGPU_IB_FLAG_GDS) if (chunk_ib->flags & AMDGPU_IB_FLAG_GDS)
ib->gds_needed = true; ib->gds_needed = true;
if (ib->ring->current_filp != parser->filp) { if ((ib->ring->current_filp != parser->filp) ||
(ib->ring->current_ctx != parser->ctx_id)) {
ib->ring->need_ctx_switch = true; ib->ring->need_ctx_switch = true;
ib->ring->current_ctx = parser->ctx_id;
ib->ring->current_filp = parser->filp; ib->ring->current_filp = parser->filp;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment