Use drmm_plain_encoder_alloc() to allocate simple encoder and
drmm_writeback_connector_init() in order to initialize writeback
connector instance.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
index 600af5ad81b15d0c30f9f79588f40cca07437ed8..182275c0c29cd8527c85dfb3e7317561da392c46 100644
--- a/drivers/gpu/drm/arm/malidp_mw.c
+++ b/drivers/gpu/drm/arm/malidp_mw.c
@@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force)
return connector_status_connected;
}
-static void malidp_mw_connector_destroy(struct drm_connector *connector)
-{
- drm_connector_cleanup(connector);
-}
-
static struct drm_connector_state *
malidp_mw_connector_duplicate_state(struct drm_connector *connector)
{
@@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = {
.reset = malidp_mw_connector_reset,
.detect = malidp_mw_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
- .destroy = malidp_mw_connector_destroy,
.atomic_duplicate_state = malidp_mw_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
@@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
int malidp_mw_connector_init(struct drm_device *drm)
{
struct malidp_drm *malidp = drm_to_malidp(drm);
+ struct drm_encoder *encoder;
u32 *formats;
int ret, n_formats;
@@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm)
if (!formats)
return -ENOMEM;
- ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
- &malidp_mw_connector_funcs,
- &malidp_mw_encoder_helper_funcs,
- formats, n_formats,
- 1 << drm_crtc_index(&malidp->crtc));
+ encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL,
+ NULL);
+ if (IS_ERR(encoder))
+ return PTR_ERR(encoder);
+
+ drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs);
+
+ encoder->possible_crtcs = 1 << drm_crtc_index(&malidp->crtc);
+
+ ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
+ &malidp_mw_connector_funcs,
+ encoder,
+ formats, n_formats);
kfree(formats);
if (ret)
return ret;
--
2.39.5
Le 01/08/2025 à 15:51, Dmitry Baryshkov a écrit :
> Use drmm_plain_encoder_alloc() to allocate simple encoder and
> drmm_writeback_connector_init() in order to initialize writeback
> connector instance.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c
> index 600af5ad81b15d0c30f9f79588f40cca07437ed8..182275c0c29cd8527c85dfb3e7317561da392c46 100644
> --- a/drivers/gpu/drm/arm/malidp_mw.c
> +++ b/drivers/gpu/drm/arm/malidp_mw.c
> @@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force)
> return connector_status_connected;
> }
>
> -static void malidp_mw_connector_destroy(struct drm_connector *connector)
> -{
> - drm_connector_cleanup(connector);
> -}
> -
> static struct drm_connector_state *
> malidp_mw_connector_duplicate_state(struct drm_connector *connector)
> {
> @@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = {
> .reset = malidp_mw_connector_reset,
> .detect = malidp_mw_connector_detect,
> .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy = malidp_mw_connector_destroy,
> .atomic_duplicate_state = malidp_mw_connector_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
> @@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
> int malidp_mw_connector_init(struct drm_device *drm)
> {
> struct malidp_drm *malidp = drm_to_malidp(drm);
> + struct drm_encoder *encoder;
> u32 *formats;
> int ret, n_formats;
>
> @@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm)
> if (!formats)
> return -ENOMEM;
>
> - ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
> - &malidp_mw_connector_funcs,
> - &malidp_mw_encoder_helper_funcs,
> - formats, n_formats,
> - 1 << drm_crtc_index(&malidp->crtc));
> + encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL,
> + NULL);
> + if (IS_ERR(encoder))
> + return PTR_ERR(encoder);
> +
> + drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs);
> +
> + encoder->possible_crtcs = 1 << drm_crtc_index(&malidp->crtc);
drm_crtc_mask?
With this:
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> +
> + ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
> + &malidp_mw_connector_funcs,
> + encoder,
> + formats, n_formats);
> kfree(formats);
> if (ret)
> return ret;
>
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
> Subject: Re: [PATCH 3/8] drm/mali: use drmm_writeback_connector_init()
>
>
>
> Le 01/08/2025 à 15:51, Dmitry Baryshkov a écrit :
> > Use drmm_plain_encoder_alloc() to allocate simple encoder and
> > drmm_writeback_connector_init() in order to initialize writeback
> > connector instance.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
LGTM,
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
> > ---
> > drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++-----------
> > 1 file changed, 14 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/arm/malidp_mw.c
> > b/drivers/gpu/drm/arm/malidp_mw.c index
> >
> 600af5ad81b15d0c30f9f79588f40cca07437ed8..182275c0c29cd8527c85dfb3e7
> 31
> > 7561da392c46 100644
> > --- a/drivers/gpu/drm/arm/malidp_mw.c
> > +++ b/drivers/gpu/drm/arm/malidp_mw.c
> > @@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector
> *connector, bool force)
> > return connector_status_connected;
> > }
> >
> > -static void malidp_mw_connector_destroy(struct drm_connector
> > *connector) -{
> > - drm_connector_cleanup(connector);
> > -}
> > -
> > static struct drm_connector_state *
> > malidp_mw_connector_duplicate_state(struct drm_connector *connector)
> > {
> > @@ -114,7 +109,6 @@ static const struct drm_connector_funcs
> malidp_mw_connector_funcs = {
> > .reset = malidp_mw_connector_reset,
> > .detect = malidp_mw_connector_detect,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > - .destroy = malidp_mw_connector_destroy,
> > .atomic_duplicate_state = malidp_mw_connector_duplicate_state,
> > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> > };
> > @@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm
> *malidp, int *n_formats)
> > int malidp_mw_connector_init(struct drm_device *drm)
> > {
> > struct malidp_drm *malidp = drm_to_malidp(drm);
> > + struct drm_encoder *encoder;
> > u32 *formats;
> > int ret, n_formats;
> >
> > @@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device
> *drm)
> > if (!formats)
> > return -ENOMEM;
> >
> > - ret = drm_writeback_connector_init(drm, &malidp->mw_connector,
> > - &malidp_mw_connector_funcs,
> > -
> &malidp_mw_encoder_helper_funcs,
> > - formats, n_formats,
> > - 1 << drm_crtc_index(&malidp-
> >crtc));
> > + encoder = drmm_plain_encoder_alloc(drm, NULL,
> DRM_MODE_ENCODER_VIRTUAL,
> > + NULL);
> > + if (IS_ERR(encoder))
> > + return PTR_ERR(encoder);
> > +
> > + drm_encoder_helper_add(encoder,
> &malidp_mw_encoder_helper_funcs);
> > +
> > + encoder->possible_crtcs = 1 << drm_crtc_index(&malidp->crtc);
>
> drm_crtc_mask?
>
> With this:
>
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
>
> > +
> > + ret = drmm_writeback_connector_init(drm, &malidp->mw_connector,
> > + &malidp_mw_connector_funcs,
> > + encoder,
> > + formats, n_formats);
> > kfree(formats);
> > if (ret)
> > return ret;
> >
>
> --
> Louis Chauvet, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
© 2016 - 2026 Red Hat, Inc.