drm/arm/malidp: plane: use drm managed resources
Use drm managed resource allocation (drmm_universal_plane_alloc()) in order to get rid of the explicit destroy hook in struct drm_plane_funcs. Signed-off-by: Danilo Krummrich <dakr@redhat.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221026155934.125294-5-dakr@redhat.com
This commit is contained in:
parent
905ff163cf
commit
3ad5103438
|
@ -68,14 +68,6 @@
|
|||
/* readahead for partial-frame prefetch */
|
||||
#define MALIDP_MMU_PREFETCH_READAHEAD 8
|
||||
|
||||
static void malidp_de_plane_destroy(struct drm_plane *plane)
|
||||
{
|
||||
struct malidp_plane *mp = to_malidp_plane(plane);
|
||||
|
||||
drm_plane_cleanup(plane);
|
||||
kfree(mp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Replicate what the default ->reset hook does: free the state pointer and
|
||||
* allocate a new empty object. We just need enough space to store
|
||||
|
@ -260,7 +252,6 @@ static bool malidp_format_mod_supported_per_plane(struct drm_plane *plane,
|
|||
static const struct drm_plane_funcs malidp_de_plane_funcs = {
|
||||
.update_plane = drm_atomic_helper_update_plane,
|
||||
.disable_plane = drm_atomic_helper_disable_plane,
|
||||
.destroy = malidp_de_plane_destroy,
|
||||
.reset = malidp_plane_reset,
|
||||
.atomic_duplicate_state = malidp_duplicate_plane_state,
|
||||
.atomic_destroy_state = malidp_destroy_plane_state,
|
||||
|
@ -972,12 +963,6 @@ int malidp_de_planes_init(struct drm_device *drm)
|
|||
for (i = 0; i < map->n_layers; i++) {
|
||||
u8 id = map->layers[i].id;
|
||||
|
||||
plane = kzalloc(sizeof(*plane), GFP_KERNEL);
|
||||
if (!plane) {
|
||||
ret = -ENOMEM;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* build the list of DRM supported formats based on the map */
|
||||
for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
|
||||
if ((map->pixel_formats[j].layer & id) == id)
|
||||
|
@ -990,13 +975,14 @@ int malidp_de_planes_init(struct drm_device *drm)
|
|||
/*
|
||||
* All the layers except smart layer supports AFBC modifiers.
|
||||
*/
|
||||
ret = drm_universal_plane_init(drm, &plane->base, crtcs,
|
||||
&malidp_de_plane_funcs, formats, n,
|
||||
(id == DE_SMART) ? linear_only_modifiers : modifiers,
|
||||
plane_type, NULL);
|
||||
|
||||
if (ret < 0)
|
||||
plane = drmm_universal_plane_alloc(drm, struct malidp_plane, base,
|
||||
crtcs, &malidp_de_plane_funcs, formats, n,
|
||||
(id == DE_SMART) ? linear_only_modifiers :
|
||||
modifiers, plane_type, NULL);
|
||||
if (IS_ERR(plane)) {
|
||||
ret = PTR_ERR(plane);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
drm_plane_helper_add(&plane->base,
|
||||
&malidp_de_plane_helper_funcs);
|
||||
|
|
Loading…
Reference in New Issue