@@ -111,37 +111,18 @@ nvkm_outp_acquire_ior(struct nvkm_outp *outp, u8 user, struct nvkm_ior *ior)
111
111
return 0 ;
112
112
}
113
113
114
- int
115
- nvkm_outp_acquire (struct nvkm_outp * outp , u8 user , bool hda )
114
+ static inline int
115
+ nvkm_outp_acquire_hda (struct nvkm_outp * outp , enum nvkm_ior_type type ,
116
+ u8 user , bool hda )
116
117
{
117
- struct nvkm_ior * ior = outp -> ior ;
118
- enum nvkm_ior_proto proto ;
119
- enum nvkm_ior_type type ;
120
-
121
- OUTP_TRACE (outp , "acquire %02x |= %02x %p" , outp -> acquired , user , ior );
122
- if (ior ) {
123
- outp -> acquired |= user ;
124
- return 0 ;
125
- }
126
-
127
- /* Lookup a compatible, and unused, OR to assign to the device. */
128
- proto = nvkm_outp_xlat (outp , & type );
129
- if (proto == UNKNOWN )
130
- return - ENOSYS ;
131
-
132
- /* Deal with panels requiring identity-mapped SOR assignment. */
133
- if (outp -> identity ) {
134
- ior = nvkm_ior_find (outp -> disp , SOR , ffs (outp -> info .or ) - 1 );
135
- if (WARN_ON (!ior ))
136
- return - ENOSPC ;
137
- return nvkm_outp_acquire_ior (outp , user , ior );
138
- }
118
+ struct nvkm_ior * ior ;
139
119
140
120
/* First preference is to reuse the OR that is currently armed
141
121
* on HW, if any, in order to prevent unnecessary switching.
142
122
*/
143
123
list_for_each_entry (ior , & outp -> disp -> ior , head ) {
144
- if (!ior -> identity && !ior -> asy .outp && ior -> arm .outp == outp )
124
+ if (!ior -> identity &&
125
+ !ior -> asy .outp && ior -> arm .outp == outp )
145
126
return nvkm_outp_acquire_ior (outp , user , ior );
146
127
}
147
128
@@ -157,14 +138,44 @@ nvkm_outp_acquire(struct nvkm_outp *outp, u8 user, bool hda)
157
138
* but will be released during the next modeset.
158
139
*/
159
140
list_for_each_entry (ior , & outp -> disp -> ior , head ) {
160
- if (!ior -> identity && !ior -> asy .outp && ior -> type == type &&
141
+ if (!ior -> identity &&
142
+ !ior -> asy .outp && ior -> type == type &&
161
143
(ior -> func -> route .set || ior -> id == __ffs (outp -> info .or )))
162
144
return nvkm_outp_acquire_ior (outp , user , ior );
163
145
}
164
146
165
147
return - ENOSPC ;
166
148
}
167
149
150
+ int
151
+ nvkm_outp_acquire (struct nvkm_outp * outp , u8 user , bool hda )
152
+ {
153
+ struct nvkm_ior * ior = outp -> ior ;
154
+ enum nvkm_ior_proto proto ;
155
+ enum nvkm_ior_type type ;
156
+
157
+ OUTP_TRACE (outp , "acquire %02x |= %02x %p" , outp -> acquired , user , ior );
158
+ if (ior ) {
159
+ outp -> acquired |= user ;
160
+ return 0 ;
161
+ }
162
+
163
+ /* Lookup a compatible, and unused, OR to assign to the device. */
164
+ proto = nvkm_outp_xlat (outp , & type );
165
+ if (proto == UNKNOWN )
166
+ return - ENOSYS ;
167
+
168
+ /* Deal with panels requiring identity-mapped SOR assignment. */
169
+ if (outp -> identity ) {
170
+ ior = nvkm_ior_find (outp -> disp , SOR , ffs (outp -> info .or ) - 1 );
171
+ if (WARN_ON (!ior ))
172
+ return - ENOSPC ;
173
+ return nvkm_outp_acquire_ior (outp , user , ior );
174
+ }
175
+
176
+ return nvkm_outp_acquire_hda (outp , type , user , true);
177
+ }
178
+
168
179
void
169
180
nvkm_outp_fini (struct nvkm_outp * outp )
170
181
{
0 commit comments