aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0729-drm-amd-dal-Make-use-of-amdgpu_crtc-cursor_addr.patch
blob: 8e88181a8003f8ef8d626ff965b02e9919fa1eb6 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 299511579bbef4d7e67360cb382ac58f4d37a828 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
Date: Tue, 19 Jan 2016 16:37:18 +0900
Subject: [PATCH 0729/1110] drm/amd/dal: Make use of amdgpu_crtc->cursor_addr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 .../gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c    | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index f2b25cd..c472530 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -139,8 +139,7 @@ static int dm_crtc_pin_cursor_bo_new(
 	struct drm_crtc *crtc,
 	struct drm_file *file_priv,
 	uint32_t handle,
-	struct amdgpu_bo **ret_obj,
-	uint64_t *gpu_addr)
+	struct amdgpu_bo **ret_obj)
 {
 	struct amdgpu_crtc *amdgpu_crtc;
 	struct amdgpu_bo *robj;
@@ -148,6 +147,10 @@ static int dm_crtc_pin_cursor_bo_new(
 	int ret = EINVAL;
 
 	if (NULL != crtc) {
+		struct drm_device *dev = crtc->dev;
+		struct amdgpu_device *adev = dev->dev_private;
+		uint64_t gpu_addr;
+
 		amdgpu_crtc = to_amdgpu_crtc(crtc);
 
 		obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
@@ -170,10 +173,12 @@ static int dm_crtc_pin_cursor_bo_new(
 			goto release;
 		}
 
-		ret = amdgpu_bo_pin(robj, AMDGPU_GEM_DOMAIN_VRAM, NULL);
+		ret = amdgpu_bo_pin_restricted(robj, AMDGPU_GEM_DOMAIN_VRAM, 0,
+						adev->mc.visible_vram_size,
+						&gpu_addr);
 
 		if (ret == 0) {
-			*gpu_addr = amdgpu_bo_gpu_offset(robj);
+			amdgpu_crtc->cursor_addr = gpu_addr;
 			*ret_obj  = robj;
 		}
 		amdgpu_bo_unreserve(robj);
@@ -194,7 +199,6 @@ static int dm_crtc_cursor_set(
 	uint32_t height)
 {
 	struct amdgpu_bo *new_cursor_bo;
-	uint64_t gpu_addr;
 	struct dc_cursor_position position;
 
 	int ret;
@@ -203,7 +207,6 @@ static int dm_crtc_cursor_set(
 
 	ret		= EINVAL;
 	new_cursor_bo	= NULL;
-	gpu_addr	= 0;
 
 	DRM_DEBUG_KMS(
 	"%s: crtc_id=%d with handle %d and size %d to %d, bo_object %p\n",
@@ -243,14 +246,13 @@ static int dm_crtc_cursor_set(
 		goto release;
 	}
 	/*try to pin new cursor bo*/
-	ret = dm_crtc_pin_cursor_bo_new(crtc, file_priv, handle,
-			&new_cursor_bo, &gpu_addr);
+	ret = dm_crtc_pin_cursor_bo_new(crtc, file_priv, handle, &new_cursor_bo);
 	/*if map not successful then return an error*/
 	if (ret)
 		goto release;
 
 	/*program new cursor bo to hardware*/
-	dm_set_cursor(amdgpu_crtc, gpu_addr, width, height);
+	dm_set_cursor(amdgpu_crtc, amdgpu_crtc->cursor_addr, width, height);
 
 	/*un map old, not used anymore cursor bo ,
 	 * return memory and mapping back */
@@ -336,7 +338,7 @@ static void dm_crtc_cursor_reset(struct drm_crtc *crtc)
 	if (amdgpu_crtc->cursor_bo && amdgpu_crtc->target) {
 		dm_set_cursor(
 		amdgpu_crtc,
-		amdgpu_bo_gpu_offset(gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo)),
+		amdgpu_crtc->cursor_addr,
 		amdgpu_crtc->cursor_width,
 		amdgpu_crtc->cursor_height);
 	}
-- 
2.7.4