Commit 3ad51034 authored by Danilo Krummrich's avatar Danilo Krummrich Committed by Liviu Dudau

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: default avatarDanilo Krummrich <dakr@redhat.com>
Signed-off-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026155934.125294-5-dakr@redhat.com
parent 905ff163
...@@ -68,14 +68,6 @@ ...@@ -68,14 +68,6 @@
/* readahead for partial-frame prefetch */ /* readahead for partial-frame prefetch */
#define MALIDP_MMU_PREFETCH_READAHEAD 8 #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 * Replicate what the default ->reset hook does: free the state pointer and
* allocate a new empty object. We just need enough space to store * 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, ...@@ -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 = { static const struct drm_plane_funcs malidp_de_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane, .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane, .disable_plane = drm_atomic_helper_disable_plane,
.destroy = malidp_de_plane_destroy,
.reset = malidp_plane_reset, .reset = malidp_plane_reset,
.atomic_duplicate_state = malidp_duplicate_plane_state, .atomic_duplicate_state = malidp_duplicate_plane_state,
.atomic_destroy_state = malidp_destroy_plane_state, .atomic_destroy_state = malidp_destroy_plane_state,
...@@ -972,12 +963,6 @@ int malidp_de_planes_init(struct drm_device *drm) ...@@ -972,12 +963,6 @@ int malidp_de_planes_init(struct drm_device *drm)
for (i = 0; i < map->n_layers; i++) { for (i = 0; i < map->n_layers; i++) {
u8 id = map->layers[i].id; 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 */ /* build the list of DRM supported formats based on the map */
for (n = 0, j = 0; j < map->n_pixel_formats; j++) { for (n = 0, j = 0; j < map->n_pixel_formats; j++) {
if ((map->pixel_formats[j].layer & id) == id) if ((map->pixel_formats[j].layer & id) == id)
...@@ -990,13 +975,14 @@ int malidp_de_planes_init(struct drm_device *drm) ...@@ -990,13 +975,14 @@ int malidp_de_planes_init(struct drm_device *drm)
/* /*
* All the layers except smart layer supports AFBC modifiers. * All the layers except smart layer supports AFBC modifiers.
*/ */
ret = drm_universal_plane_init(drm, &plane->base, crtcs, plane = drmm_universal_plane_alloc(drm, struct malidp_plane, base,
&malidp_de_plane_funcs, formats, n, crtcs, &malidp_de_plane_funcs, formats, n,
(id == DE_SMART) ? linear_only_modifiers : modifiers, (id == DE_SMART) ? linear_only_modifiers :
plane_type, NULL); modifiers, plane_type, NULL);
if (IS_ERR(plane)) {
if (ret < 0) ret = PTR_ERR(plane);
goto cleanup; goto cleanup;
}
drm_plane_helper_add(&plane->base, drm_plane_helper_add(&plane->base,
&malidp_de_plane_helper_funcs); &malidp_de_plane_helper_funcs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment