@@ -20,12 +20,6 @@ struct mdp4_plane {
20
20
const char * name ;
21
21
22
22
enum mdp4_pipe pipe ;
23
-
24
- uint32_t caps ;
25
- uint32_t nformats ;
26
- uint32_t formats [32 ];
27
-
28
- bool enabled ;
29
23
};
30
24
#define to_mdp4_plane (x ) container_of(x, struct mdp4_plane, base)
31
25
@@ -59,15 +53,6 @@ static struct mdp4_kms *get_kms(struct drm_plane *plane)
59
53
return to_mdp4_kms (to_mdp_kms (priv -> kms ));
60
54
}
61
55
62
- static void mdp4_plane_destroy (struct drm_plane * plane )
63
- {
64
- struct mdp4_plane * mdp4_plane = to_mdp4_plane (plane );
65
-
66
- drm_plane_cleanup (plane );
67
-
68
- kfree (mdp4_plane );
69
- }
70
-
71
56
/* helper to install properties which are common to planes and crtcs */
72
57
static void mdp4_plane_install_properties (struct drm_plane * plane ,
73
58
struct drm_mode_object * obj )
@@ -85,7 +70,6 @@ static int mdp4_plane_set_property(struct drm_plane *plane,
85
70
static const struct drm_plane_funcs mdp4_plane_funcs = {
86
71
.update_plane = drm_atomic_helper_update_plane ,
87
72
.disable_plane = drm_atomic_helper_disable_plane ,
88
- .destroy = mdp4_plane_destroy ,
89
73
.set_property = mdp4_plane_set_property ,
90
74
.reset = drm_atomic_helper_plane_reset ,
91
75
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state ,
@@ -419,37 +403,34 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
419
403
{
420
404
struct drm_plane * plane = NULL ;
421
405
struct mdp4_plane * mdp4_plane ;
422
- int ret ;
423
406
enum drm_plane_type type ;
407
+ uint32_t pipe_caps ;
424
408
const uint32_t * formats ;
425
- unsigned int nformats ;
426
-
427
- mdp4_plane = kzalloc (sizeof (* mdp4_plane ), GFP_KERNEL );
428
- if (!mdp4_plane ) {
429
- ret = - ENOMEM ;
430
- goto fail ;
431
- }
432
-
433
- plane = & mdp4_plane -> base ;
434
-
435
- mdp4_plane -> pipe = pipe_id ;
436
- mdp4_plane -> name = pipe_names [pipe_id ];
437
- mdp4_plane -> caps = mdp4_pipe_caps (pipe_id );
409
+ size_t nformats ;
438
410
439
411
type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY ;
440
412
441
- if (pipe_supports_yuv (mdp4_plane -> caps )) {
413
+ pipe_caps = mdp4_pipe_caps (pipe_id );
414
+ if (pipe_supports_yuv (pipe_caps )) {
442
415
formats = mdp4_rgb_yuv_formats ;
443
416
nformats = ARRAY_SIZE (mdp4_rgb_yuv_formats );
444
417
} else {
445
418
formats = mdp4_rgb_formats ;
446
419
nformats = ARRAY_SIZE (mdp4_rgb_formats );
447
420
}
448
- ret = drm_universal_plane_init (dev , plane , 0xff , & mdp4_plane_funcs ,
449
- formats , nformats ,
450
- supported_format_modifiers , type , NULL );
451
- if (ret )
452
- goto fail ;
421
+
422
+ mdp4_plane = drmm_universal_plane_alloc (dev , struct mdp4_plane , base ,
423
+ 0xff , & mdp4_plane_funcs ,
424
+ formats , nformats ,
425
+ supported_format_modifiers ,
426
+ type , NULL );
427
+ if (IS_ERR (mdp4_plane ))
428
+ return ERR_CAST (mdp4_plane );
429
+
430
+ plane = & mdp4_plane -> base ;
431
+
432
+ mdp4_plane -> pipe = pipe_id ;
433
+ mdp4_plane -> name = pipe_names [pipe_id ];
453
434
454
435
drm_plane_helper_add (plane , & mdp4_plane_helper_funcs );
455
436
@@ -458,10 +439,4 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
458
439
drm_plane_enable_fb_damage_clips (plane );
459
440
460
441
return plane ;
461
-
462
- fail :
463
- if (plane )
464
- mdp4_plane_destroy (plane );
465
-
466
- return ERR_PTR (ret );
467
442
}
0 commit comments