@@ -20,12 +20,6 @@ struct mdp4_plane {
2020 const char * name ;
2121
2222 enum mdp4_pipe pipe ;
23-
24- uint32_t caps ;
25- uint32_t nformats ;
26- uint32_t formats [32 ];
27-
28- bool enabled ;
2923};
3024#define to_mdp4_plane (x ) container_of(x, struct mdp4_plane, base)
3125
@@ -59,15 +53,6 @@ static struct mdp4_kms *get_kms(struct drm_plane *plane)
5953 return to_mdp4_kms (to_mdp_kms (priv -> kms ));
6054}
6155
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-
7156/* helper to install properties which are common to planes and crtcs */
7257static void mdp4_plane_install_properties (struct drm_plane * plane ,
7358 struct drm_mode_object * obj )
@@ -85,7 +70,6 @@ static int mdp4_plane_set_property(struct drm_plane *plane,
8570static const struct drm_plane_funcs mdp4_plane_funcs = {
8671 .update_plane = drm_atomic_helper_update_plane ,
8772 .disable_plane = drm_atomic_helper_disable_plane ,
88- .destroy = mdp4_plane_destroy ,
8973 .set_property = mdp4_plane_set_property ,
9074 .reset = drm_atomic_helper_plane_reset ,
9175 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state ,
@@ -419,37 +403,34 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
419403{
420404 struct drm_plane * plane = NULL ;
421405 struct mdp4_plane * mdp4_plane ;
422- int ret ;
423406 enum drm_plane_type type ;
407+ uint32_t pipe_caps ;
424408 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 ;
438410
439411 type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY ;
440412
441- if (pipe_supports_yuv (mdp4_plane -> caps )) {
413+ pipe_caps = mdp4_pipe_caps (pipe_id );
414+ if (pipe_supports_yuv (pipe_caps )) {
442415 formats = mdp4_rgb_yuv_formats ;
443416 nformats = ARRAY_SIZE (mdp4_rgb_yuv_formats );
444417 } else {
445418 formats = mdp4_rgb_formats ;
446419 nformats = ARRAY_SIZE (mdp4_rgb_formats );
447420 }
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 ];
453434
454435 drm_plane_helper_add (plane , & mdp4_plane_helper_funcs );
455436
@@ -458,10 +439,4 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
458439 drm_plane_enable_fb_damage_clips (plane );
459440
460441 return plane ;
461-
462- fail :
463- if (plane )
464- mdp4_plane_destroy (plane );
465-
466- return ERR_PTR (ret );
467442}
0 commit comments