aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/2447-amdgpu-dc-inline-dal-grph-object-id-functions.patch
blob: 78052a1ace6193c2cabaabf84e59fb02331d31f8 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
From 2aca9b292e3146948893b17d852201e477bf668e Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Tue, 3 Oct 2017 12:36:54 +1000
Subject: [PATCH 2447/4131] amdgpu/dc: inline dal grph object id functions.

This is worth 400 bytes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 .../gpu/drm/amd/display/dc/basics/grph_object_id.c | 61 +-----------------
 .../gpu/drm/amd/display/include/grph_object_id.h   | 72 +++++++++++++++++-----
 2 files changed, 56 insertions(+), 77 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c b/drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c
index 9c80847..1478225 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/grph_object_id.c
@@ -26,7 +26,7 @@
 #include "dm_services.h"
 #include "include/grph_object_id.h"
 
-bool dal_graphics_object_id_is_valid(struct graphics_object_id id)
+static bool dal_graphics_object_id_is_valid(struct graphics_object_id id)
 {
 	bool rc = true;
 
@@ -72,63 +72,4 @@ bool dal_graphics_object_id_is_equal(
 	return false;
 }
 
-/* Based on internal data members memory layout */
-uint32_t dal_graphics_object_id_to_uint(struct graphics_object_id id)
-{
-	uint32_t object_id = 0;
-
-	object_id = id.id + (id.enum_id << 0x8) + (id.type << 0xc);
-	return object_id;
-}
-
-/*
- * ******* get specific ID - internal safe cast into specific type *******
- */
-
-enum controller_id dal_graphics_object_id_get_controller_id(
-	struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_CONTROLLER)
-		return id.id;
-	return CONTROLLER_ID_UNDEFINED;
-}
-
-enum clock_source_id dal_graphics_object_id_get_clock_source_id(
-	struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_CLOCK_SOURCE)
-		return id.id;
-	return CLOCK_SOURCE_ID_UNDEFINED;
-}
-
-enum encoder_id dal_graphics_object_id_get_encoder_id(
-	struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_ENCODER)
-		return id.id;
-	return ENCODER_ID_UNKNOWN;
-}
-
-enum connector_id dal_graphics_object_id_get_connector_id(
-	struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_CONNECTOR)
-		return id.id;
-	return CONNECTOR_ID_UNKNOWN;
-}
-
-enum audio_id dal_graphics_object_id_get_audio_id(struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_AUDIO)
-		return id.id;
-	return AUDIO_ID_UNKNOWN;
-}
-
-enum engine_id dal_graphics_object_id_get_engine_id(
-	struct graphics_object_id id)
-{
-	if (id.type == OBJECT_TYPE_ENGINE)
-		return id.id;
-	return ENGINE_ID_UNKNOWN;
-}
 
diff --git a/drivers/gpu/drm/amd/display/include/grph_object_id.h b/drivers/gpu/drm/amd/display/include/grph_object_id.h
index e4aa4dd..5eb2b4d 100644
--- a/drivers/gpu/drm/amd/display/include/grph_object_id.h
+++ b/drivers/gpu/drm/amd/display/include/grph_object_id.h
@@ -233,24 +233,62 @@ static inline struct graphics_object_id dal_graphics_object_id_init(
 	return result;
 }
 
-bool dal_graphics_object_id_is_valid(
-	struct graphics_object_id id);
 bool dal_graphics_object_id_is_equal(
 	struct graphics_object_id id1,
 	struct graphics_object_id id2);
-uint32_t dal_graphics_object_id_to_uint(
-	struct graphics_object_id id);
-
-enum controller_id dal_graphics_object_id_get_controller_id(
-	struct graphics_object_id id);
-enum clock_source_id dal_graphics_object_id_get_clock_source_id(
-	struct graphics_object_id id);
-enum encoder_id dal_graphics_object_id_get_encoder_id(
-	struct graphics_object_id id);
-enum connector_id dal_graphics_object_id_get_connector_id(
-	struct graphics_object_id id);
-enum audio_id dal_graphics_object_id_get_audio_id(
-	struct graphics_object_id id);
-enum engine_id dal_graphics_object_id_get_engine_id(
-	struct graphics_object_id id);
+
+/* Based on internal data members memory layout */
+static inline uint32_t dal_graphics_object_id_to_uint(
+	struct graphics_object_id id)
+{
+	return id.id + (id.enum_id << 0x8) + (id.type << 0xc);
+}
+
+static inline enum controller_id dal_graphics_object_id_get_controller_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_CONTROLLER)
+		return id.id;
+	return CONTROLLER_ID_UNDEFINED;
+}
+
+static inline enum clock_source_id dal_graphics_object_id_get_clock_source_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_CLOCK_SOURCE)
+		return id.id;
+	return CLOCK_SOURCE_ID_UNDEFINED;
+}
+
+static inline enum encoder_id dal_graphics_object_id_get_encoder_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_ENCODER)
+		return id.id;
+	return ENCODER_ID_UNKNOWN;
+}
+
+static inline enum connector_id dal_graphics_object_id_get_connector_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_CONNECTOR)
+		return id.id;
+	return CONNECTOR_ID_UNKNOWN;
+}
+
+static inline enum audio_id dal_graphics_object_id_get_audio_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_AUDIO)
+		return id.id;
+	return AUDIO_ID_UNKNOWN;
+}
+
+static inline enum engine_id dal_graphics_object_id_get_engine_id(
+	struct graphics_object_id id)
+{
+	if (id.type == OBJECT_TYPE_ENGINE)
+		return id.id;
+	return ENGINE_ID_UNKNOWN;
+}
 #endif
-- 
2.7.4