aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0195-drm-amdgpu-check-context-id-for-context-switching-v2.patch
blob: 5914abfd720737181ee5d3f556b19b03b50e6e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 72efa7ebdea084b96f25021d0ba9c29074c2906f Mon Sep 17 00:00:00 2001
From: Jammy Zhou <Jammy.Zhou@amd.com>
Date: Fri, 8 May 2015 22:18:47 +0800
Subject: [PATCH 0195/1050] drm/amdgpu: check context id for context switching
 (v2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index bf0c607..a88302c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -945,6 +945,7 @@ struct amdgpu_ring {
 	unsigned		next_rptr_offs;
 	unsigned		fence_offs;
 	struct drm_file		*current_filp;
+	unsigned		current_ctx;
 	bool			need_ctx_switch;
 	enum amdgpu_ring_type	type;
 	char			name[16];
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 86b9324..1035e44 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,
 			ib->is_const_ib = true;
 		if (chunk_ib->flags & AMDGPU_IB_FLAG_GDS)
 			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->current_ctx = parser->ctx_id;
 			ib->ring->current_filp = parser->filp;
 		}
 
-- 
1.9.1