@@ -23,7 +23,6 @@ struct vc4_lbm_size_priv {
23
23
struct vc4_dev * vc4 ;
24
24
struct drm_file * file ;
25
25
struct drm_modeset_acquire_ctx ctx ;
26
- struct drm_atomic_state * state ;
27
26
};
28
27
29
28
struct vc4_lbm_size_param {
@@ -181,17 +180,26 @@ static void drm_vc4_test_vc4_lbm_size(struct kunit *test)
181
180
const struct vc4_lbm_size_priv * priv = test -> priv ;
182
181
const struct drm_format_info * info ;
183
182
struct drm_mode_fb_cmd2 fb_req = { };
184
- struct drm_atomic_state * state = priv -> state ;
185
183
struct vc4_plane_state * vc4_plane_state ;
186
184
struct drm_plane_state * plane_state ;
185
+ struct drm_modeset_acquire_ctx ctx ;
187
186
struct vc4_dummy_output * output ;
187
+ struct drm_atomic_state * state ;
188
188
struct drm_framebuffer * fb ;
189
189
struct drm_plane * plane ;
190
+ struct drm_device * drm ;
190
191
struct drm_crtc * crtc ;
191
192
struct vc4_dev * vc4 ;
192
193
unsigned int i ;
193
194
int ret ;
194
195
196
+ drm_modeset_acquire_init (& ctx , 0 );
197
+
198
+ vc4 = priv -> vc4 ;
199
+ drm = & vc4 -> base ;
200
+ state = drm_kunit_helper_atomic_state_alloc (test , drm , & ctx );
201
+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , state );
202
+
195
203
info = drm_format_info (params -> fourcc );
196
204
KUNIT_ASSERT_NOT_NULL (test , info );
197
205
@@ -269,6 +277,9 @@ static void drm_vc4_test_vc4_lbm_size(struct kunit *test)
269
277
270
278
for (i = 0 ; i < info -> num_planes ; i ++ )
271
279
drm_mode_destroy_dumb (state -> dev , fb_req .handles [i ], priv -> file );
280
+
281
+ drm_modeset_drop_locks (& ctx );
282
+ drm_modeset_acquire_fini (& ctx );
272
283
}
273
284
274
285
static struct kunit_case vc4_lbm_size_tests [] = {
@@ -279,9 +290,7 @@ static struct kunit_case vc4_lbm_size_tests[] = {
279
290
280
291
static int vc4_lbm_size_test_init (struct kunit * test )
281
292
{
282
- struct drm_modeset_acquire_ctx * ctx ;
283
293
struct vc4_lbm_size_priv * priv ;
284
- struct drm_device * drm ;
285
294
struct vc4_dev * vc4 ;
286
295
287
296
priv = kunit_kzalloc (test , sizeof (* priv ), GFP_KERNEL );
@@ -295,13 +304,6 @@ static int vc4_lbm_size_test_init(struct kunit *test)
295
304
priv -> file = drm_file_alloc (priv -> vc4 -> base .primary );
296
305
KUNIT_ASSERT_NOT_ERR_OR_NULL (test , priv -> file );
297
306
298
- ctx = drm_kunit_helper_acquire_ctx_alloc (test );
299
- KUNIT_ASSERT_NOT_ERR_OR_NULL (test , ctx );
300
-
301
- drm = & vc4 -> base ;
302
- priv -> state = drm_kunit_helper_atomic_state_alloc (test , drm , ctx );
303
- KUNIT_ASSERT_NOT_ERR_OR_NULL (test , priv -> state );
304
-
305
307
return 0 ;
306
308
}
307
309
0 commit comments