[PATCH 7/8] drm: writeback: drop excess connector initialization functions

Dmitry Baryshkov posted 8 patches 2 months ago
There is a newer version of this series
[PATCH 7/8] drm: writeback: drop excess connector initialization functions
Posted by Dmitry Baryshkov 2 months ago
Now as all drivers have been converted to
drmm_writeback_connector_init(), drop drm_writeback_connector_init() and
drm_writeback_connector::encoder field, they are unused now.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/gpu/drm/drm_writeback.c | 55 -----------------------------------------
 include/drm/drm_writeback.h     | 18 --------------
 2 files changed, 73 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index 95b8a2e4bda69230591b50be15d14d0b3692373b..1a01df91b2c5868e158d489b782f4c57c61a272c 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -142,61 +142,6 @@ static int create_writeback_properties(struct drm_device *dev)
 	return 0;
 }
 
-static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
-/**
- * drm_writeback_connector_init - Initialize a writeback connector and its properties
- * @dev: DRM device
- * @wb_connector: Writeback connector to initialize
- * @con_funcs: Connector funcs vtable
- * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
- * @formats: Array of supported pixel formats for the writeback engine
- * @n_formats: Length of the formats array
- * @possible_crtcs: possible crtcs for the internal writeback encoder
- *
- * This function creates the writeback-connector-specific properties if they
- * have not been already created, initializes the connector as
- * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
- * values. It will also create an internal encoder associated with the
- * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
- * the encoder helper.
- *
- * Drivers should always use this function instead of drm_connector_init() to
- * set up writeback connectors.
- *
- * Returns: 0 on success, or a negative error code
- */
-int drm_writeback_connector_init(struct drm_device *dev,
-				 struct drm_writeback_connector *wb_connector,
-				 const struct drm_connector_funcs *con_funcs,
-				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
-				 const u32 *formats, int n_formats,
-				 u32 possible_crtcs)
-{
-	int ret = 0;
-
-	drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
-
-	wb_connector->encoder.possible_crtcs = possible_crtcs;
-
-	ret = drm_encoder_init(dev, &wb_connector->encoder,
-			       &drm_writeback_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
-	if (ret)
-		return ret;
-
-	ret = drm_writeback_connector_init_with_encoder(dev, wb_connector, &wb_connector->encoder,
-			con_funcs, formats, n_formats);
-
-	if (ret)
-		drm_encoder_cleanup(&wb_connector->encoder);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_writeback_connector_init);
-
 static void delete_writeback_properties(struct drm_device *dev)
 {
 	if (dev->mode_config.writeback_pixel_formats_property) {
diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h
index c380a7b8f55a3616fa070c037d5cc653b0061fe6..879ca103320cc225ffb3687419088361315535fc 100644
--- a/include/drm/drm_writeback.h
+++ b/include/drm/drm_writeback.h
@@ -24,17 +24,6 @@ struct drm_writeback_connector {
 	 */
 	struct drm_connector base;
 
-	/**
-	 * @encoder: Internal encoder used by the connector to fulfill
-	 * the DRM framework requirements. The users of the
-	 * @drm_writeback_connector control the behaviour of the @encoder
-	 * by passing the @enc_funcs parameter to drm_writeback_connector_init()
-	 * function.
-	 * For users of drm_writeback_connector_init_with_encoder(), this field
-	 * is not valid as the encoder is managed within their drivers.
-	 */
-	struct drm_encoder encoder;
-
 	/**
 	 * @pixel_formats_blob_ptr:
 	 *
@@ -148,13 +137,6 @@ drm_connector_to_writeback(struct drm_connector *connector)
 	return container_of(connector, struct drm_writeback_connector, base);
 }
 
-int drm_writeback_connector_init(struct drm_device *dev,
-				 struct drm_writeback_connector *wb_connector,
-				 const struct drm_connector_funcs *con_funcs,
-				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
-				 const u32 *formats, int n_formats,
-				 u32 possible_crtcs);
-
 int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
 				struct drm_writeback_connector *wb_connector,
 				struct drm_encoder *enc,

-- 
2.39.5
Re: [PATCH 7/8] drm: writeback: drop excess connector initialization functions
Posted by Louis Chauvet 2 months ago

Le 01/08/2025 à 15:51, Dmitry Baryshkov a écrit :
> Now as all drivers have been converted to
> drmm_writeback_connector_init(), drop drm_writeback_connector_init() and
> drm_writeback_connector::encoder field, they are unused now.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>

> ---
>   drivers/gpu/drm/drm_writeback.c | 55 -----------------------------------------
>   include/drm/drm_writeback.h     | 18 --------------
>   2 files changed, 73 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
> index 95b8a2e4bda69230591b50be15d14d0b3692373b..1a01df91b2c5868e158d489b782f4c57c61a272c 100644
> --- a/drivers/gpu/drm/drm_writeback.c
> +++ b/drivers/gpu/drm/drm_writeback.c
> @@ -142,61 +142,6 @@ static int create_writeback_properties(struct drm_device *dev)
>   	return 0;
>   }
>   
> -static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
> -	.destroy = drm_encoder_cleanup,
> -};
> -
> -/**
> - * drm_writeback_connector_init - Initialize a writeback connector and its properties
> - * @dev: DRM device
> - * @wb_connector: Writeback connector to initialize
> - * @con_funcs: Connector funcs vtable
> - * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
> - * @formats: Array of supported pixel formats for the writeback engine
> - * @n_formats: Length of the formats array
> - * @possible_crtcs: possible crtcs for the internal writeback encoder
> - *
> - * This function creates the writeback-connector-specific properties if they
> - * have not been already created, initializes the connector as
> - * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
> - * values. It will also create an internal encoder associated with the
> - * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
> - * the encoder helper.
> - *
> - * Drivers should always use this function instead of drm_connector_init() to
> - * set up writeback connectors.
> - *
> - * Returns: 0 on success, or a negative error code
> - */
> -int drm_writeback_connector_init(struct drm_device *dev,
> -				 struct drm_writeback_connector *wb_connector,
> -				 const struct drm_connector_funcs *con_funcs,
> -				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
> -				 const u32 *formats, int n_formats,
> -				 u32 possible_crtcs)
> -{
> -	int ret = 0;
> -
> -	drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
> -
> -	wb_connector->encoder.possible_crtcs = possible_crtcs;
> -
> -	ret = drm_encoder_init(dev, &wb_connector->encoder,
> -			       &drm_writeback_encoder_funcs,
> -			       DRM_MODE_ENCODER_VIRTUAL, NULL);
> -	if (ret)
> -		return ret;
> -
> -	ret = drm_writeback_connector_init_with_encoder(dev, wb_connector, &wb_connector->encoder,
> -			con_funcs, formats, n_formats);
> -
> -	if (ret)
> -		drm_encoder_cleanup(&wb_connector->encoder);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_writeback_connector_init);
> -
>   static void delete_writeback_properties(struct drm_device *dev)
>   {
>   	if (dev->mode_config.writeback_pixel_formats_property) {
> diff --git a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h
> index c380a7b8f55a3616fa070c037d5cc653b0061fe6..879ca103320cc225ffb3687419088361315535fc 100644
> --- a/include/drm/drm_writeback.h
> +++ b/include/drm/drm_writeback.h
> @@ -24,17 +24,6 @@ struct drm_writeback_connector {
>   	 */
>   	struct drm_connector base;
>   
> -	/**
> -	 * @encoder: Internal encoder used by the connector to fulfill
> -	 * the DRM framework requirements. The users of the
> -	 * @drm_writeback_connector control the behaviour of the @encoder
> -	 * by passing the @enc_funcs parameter to drm_writeback_connector_init()
> -	 * function.
> -	 * For users of drm_writeback_connector_init_with_encoder(), this field
> -	 * is not valid as the encoder is managed within their drivers.
> -	 */
> -	struct drm_encoder encoder;
> -
>   	/**
>   	 * @pixel_formats_blob_ptr:
>   	 *
> @@ -148,13 +137,6 @@ drm_connector_to_writeback(struct drm_connector *connector)
>   	return container_of(connector, struct drm_writeback_connector, base);
>   }
>   
> -int drm_writeback_connector_init(struct drm_device *dev,
> -				 struct drm_writeback_connector *wb_connector,
> -				 const struct drm_connector_funcs *con_funcs,
> -				 const struct drm_encoder_helper_funcs *enc_helper_funcs,
> -				 const u32 *formats, int n_formats,
> -				 u32 possible_crtcs);
> -
>   int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
>   				struct drm_writeback_connector *wb_connector,
>   				struct drm_encoder *enc,
> 

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

RE: [PATCH 7/8] drm: writeback: drop excess connector initialization functions
Posted by Kandpal, Suraj 2 months ago
> Subject: Re: [PATCH 7/8] drm: writeback: drop excess connector initialization
> functions

This should be drm/writeback 

Regards,
Suraj Kandpal

> 
> 
> 
> Le 01/08/2025 à 15:51, Dmitry Baryshkov a écrit :
> > Now as all drivers have been converted to
> > drmm_writeback_connector_init(), drop drm_writeback_connector_init()
> > and drm_writeback_connector::encoder field, they are unused now.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> 
> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
> 
> > ---
> >   drivers/gpu/drm/drm_writeback.c | 55 -----------------------------------------
> >   include/drm/drm_writeback.h     | 18 --------------
> >   2 files changed, 73 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_writeback.c
> > b/drivers/gpu/drm/drm_writeback.c index
> >
> 95b8a2e4bda69230591b50be15d14d0b3692373b..1a01df91b2c5868e158d489
> b782f
> > 4c57c61a272c 100644
> > --- a/drivers/gpu/drm/drm_writeback.c
> > +++ b/drivers/gpu/drm/drm_writeback.c
> > @@ -142,61 +142,6 @@ static int create_writeback_properties(struct
> drm_device *dev)
> >   	return 0;
> >   }
> >
> > -static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
> > -	.destroy = drm_encoder_cleanup,
> > -};
> > -
> > -/**
> > - * drm_writeback_connector_init - Initialize a writeback connector
> > and its properties
> > - * @dev: DRM device
> > - * @wb_connector: Writeback connector to initialize
> > - * @con_funcs: Connector funcs vtable
> > - * @enc_helper_funcs: Encoder helper funcs vtable to be used by the
> > internal encoder
> > - * @formats: Array of supported pixel formats for the writeback
> > engine
> > - * @n_formats: Length of the formats array
> > - * @possible_crtcs: possible crtcs for the internal writeback encoder
> > - *
> > - * This function creates the writeback-connector-specific properties
> > if they
> > - * have not been already created, initializes the connector as
> > - * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the
> > property
> > - * values. It will also create an internal encoder associated with
> > the
> > - * drm_writeback_connector and set it to use the @enc_helper_funcs
> > vtable for
> > - * the encoder helper.
> > - *
> > - * Drivers should always use this function instead of
> > drm_connector_init() to
> > - * set up writeback connectors.
> > - *
> > - * Returns: 0 on success, or a negative error code
> > - */
> > -int drm_writeback_connector_init(struct drm_device *dev,
> > -				 struct drm_writeback_connector
> *wb_connector,
> > -				 const struct drm_connector_funcs
> *con_funcs,
> > -				 const struct drm_encoder_helper_funcs
> *enc_helper_funcs,
> > -				 const u32 *formats, int n_formats,
> > -				 u32 possible_crtcs)
> > -{
> > -	int ret = 0;
> > -
> > -	drm_encoder_helper_add(&wb_connector->encoder,
> enc_helper_funcs);
> > -
> > -	wb_connector->encoder.possible_crtcs = possible_crtcs;
> > -
> > -	ret = drm_encoder_init(dev, &wb_connector->encoder,
> > -			       &drm_writeback_encoder_funcs,
> > -			       DRM_MODE_ENCODER_VIRTUAL, NULL);
> > -	if (ret)
> > -		return ret;
> > -
> > -	ret = drm_writeback_connector_init_with_encoder(dev,
> wb_connector, &wb_connector->encoder,
> > -			con_funcs, formats, n_formats);
> > -
> > -	if (ret)
> > -		drm_encoder_cleanup(&wb_connector->encoder);
> > -
> > -	return ret;
> > -}
> > -EXPORT_SYMBOL(drm_writeback_connector_init);
> > -
> >   static void delete_writeback_properties(struct drm_device *dev)
> >   {
> >   	if (dev->mode_config.writeback_pixel_formats_property) { diff --git
> > a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h index
> >
> c380a7b8f55a3616fa070c037d5cc653b0061fe6..879ca103320cc225ffb36874190
> 8
> > 8361315535fc 100644
> > --- a/include/drm/drm_writeback.h
> > +++ b/include/drm/drm_writeback.h
> > @@ -24,17 +24,6 @@ struct drm_writeback_connector {
> >   	 */
> >   	struct drm_connector base;
> >
> > -	/**
> > -	 * @encoder: Internal encoder used by the connector to fulfill
> > -	 * the DRM framework requirements. The users of the
> > -	 * @drm_writeback_connector control the behaviour of the @encoder
> > -	 * by passing the @enc_funcs parameter to
> drm_writeback_connector_init()
> > -	 * function.
> > -	 * For users of drm_writeback_connector_init_with_encoder(), this
> field
> > -	 * is not valid as the encoder is managed within their drivers.
> > -	 */
> > -	struct drm_encoder encoder;
> > -
> >   	/**
> >   	 * @pixel_formats_blob_ptr:
> >   	 *
> > @@ -148,13 +137,6 @@ drm_connector_to_writeback(struct drm_connector
> *connector)
> >   	return container_of(connector, struct drm_writeback_connector, base);
> >   }
> >
> > -int drm_writeback_connector_init(struct drm_device *dev,
> > -				 struct drm_writeback_connector
> *wb_connector,
> > -				 const struct drm_connector_funcs
> *con_funcs,
> > -				 const struct drm_encoder_helper_funcs
> *enc_helper_funcs,
> > -				 const u32 *formats, int n_formats,
> > -				 u32 possible_crtcs);
> > -
> >   int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
> >   				struct drm_writeback_connector
> *wb_connector,
> >   				struct drm_encoder *enc,
> >
> 
> --
> Louis Chauvet, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Re: [PATCH 7/8] drm: writeback: drop excess connector initialization functions
Posted by Dmitry Baryshkov 2 months ago
On 01/08/2025 17:22, Kandpal, Suraj wrote:
>> Subject: Re: [PATCH 7/8] drm: writeback: drop excess connector initialization
>> functions
> 
> This should be drm/writeback

No:

$ git log --oneline --no-merges next/master 
drivers/gpu/drm/drm_writeback.c
fb721b2c35b1 drm: writeback: Fix drm_writeback_connector_cleanup signature
09cba36cc840 drm: Include <linux/export.h>
ddd147d91d50 drm: writeback: Fix kernel doc name
ff3881cc6a58 drm: writeback: Fix use after free in 
drm_writeback_connector_cleanup()
1914ba2b91ea drm: writeback: Create drmm variants for 
drm_writeback_connector initialization
2f3f4a73631b drm: writeback: Add missing cleanup in case of 
initialization failure
135d8fc7af44 drm: writeback: Create an helper for 
drm_writeback_connector initialization
02c50fa60ca5 drm/writeback: remove pointless enable_signaling implementation
720cf96d8fec drm: Drop drm_framebuffer.h from drm_crtc.h
7933aecffa28 drm: introduce drm_writeback_connector_init_with_encoder() API
57b8280a0a41 drm: allow passing possible_crtcs to 
drm_writeback_connector_init()
38d6fd406aaa drm/writeback: don't set fence->ops to default
b1066a123538 drm: Clear the fence pointer when writeback job signaled
0500c04ea14a drm: drop use of drmP.h in drm/*
9d2230dc1351 drm: writeback: Add job prepare and cleanup operations
e482ae9b5fdc drm: writeback: Fix leak of writeback job
97eb9eaeb95b drm: writeback: Cleanup job ownership handling when queuing job
71a5cb3eb758 drm: writeback: Fix doc that says connector should be 
disconnected
cde4c44d8769 drm: drop _mode_ from drm_mode_connector_attach_encoder
73915b2b1f25 drm/writeback: Fix the "overview" section of the doc
b13cc8dd5884 drm: writeback: Add out-fences for writeback connectors
935774cd71fe drm: Add writeback connector type



-- 
With best wishes
Dmitry
RE: [PATCH 7/8] drm: writeback: drop excess connector initialization functions
Posted by Kandpal, Suraj 1 month, 4 weeks ago
> Subject: [PATCH 7/8] drm: writeback: drop excess connector initialization
> functions
> 
> Now as all drivers have been converted to drmm_writeback_connector_init(),
> drop drm_writeback_connector_init() and drm_writeback_connector::encoder
> field, they are unused now.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

LGTM,
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>

> ---
>  drivers/gpu/drm/drm_writeback.c | 55 -----------------------------------------
>  include/drm/drm_writeback.h     | 18 --------------
>  2 files changed, 73 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_writeback.c
> b/drivers/gpu/drm/drm_writeback.c index
> 95b8a2e4bda69230591b50be15d14d0b3692373b..1a01df91b2c5868e158d489
> b782f4c57c61a272c 100644
> --- a/drivers/gpu/drm/drm_writeback.c
> +++ b/drivers/gpu/drm/drm_writeback.c
> @@ -142,61 +142,6 @@ static int create_writeback_properties(struct
> drm_device *dev)
>  	return 0;
>  }
> 
> -static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
> -	.destroy = drm_encoder_cleanup,
> -};
> -
> -/**
> - * drm_writeback_connector_init - Initialize a writeback connector and its
> properties
> - * @dev: DRM device
> - * @wb_connector: Writeback connector to initialize
> - * @con_funcs: Connector funcs vtable
> - * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal
> encoder
> - * @formats: Array of supported pixel formats for the writeback engine
> - * @n_formats: Length of the formats array
> - * @possible_crtcs: possible crtcs for the internal writeback encoder
> - *
> - * This function creates the writeback-connector-specific properties if they
> - * have not been already created, initializes the connector as
> - * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the
> property
> - * values. It will also create an internal encoder associated with the
> - * drm_writeback_connector and set it to use the @enc_helper_funcs vtable
> for
> - * the encoder helper.
> - *
> - * Drivers should always use this function instead of drm_connector_init() to
> - * set up writeback connectors.
> - *
> - * Returns: 0 on success, or a negative error code
> - */
> -int drm_writeback_connector_init(struct drm_device *dev,
> -				 struct drm_writeback_connector
> *wb_connector,
> -				 const struct drm_connector_funcs
> *con_funcs,
> -				 const struct drm_encoder_helper_funcs
> *enc_helper_funcs,
> -				 const u32 *formats, int n_formats,
> -				 u32 possible_crtcs)
> -{
> -	int ret = 0;
> -
> -	drm_encoder_helper_add(&wb_connector->encoder,
> enc_helper_funcs);
> -
> -	wb_connector->encoder.possible_crtcs = possible_crtcs;
> -
> -	ret = drm_encoder_init(dev, &wb_connector->encoder,
> -			       &drm_writeback_encoder_funcs,
> -			       DRM_MODE_ENCODER_VIRTUAL, NULL);
> -	if (ret)
> -		return ret;
> -
> -	ret = drm_writeback_connector_init_with_encoder(dev,
> wb_connector, &wb_connector->encoder,
> -			con_funcs, formats, n_formats);
> -
> -	if (ret)
> -		drm_encoder_cleanup(&wb_connector->encoder);
> -
> -	return ret;
> -}
> -EXPORT_SYMBOL(drm_writeback_connector_init);
> -
>  static void delete_writeback_properties(struct drm_device *dev)  {
>  	if (dev->mode_config.writeback_pixel_formats_property) { diff --git
> a/include/drm/drm_writeback.h b/include/drm/drm_writeback.h index
> c380a7b8f55a3616fa070c037d5cc653b0061fe6..879ca103320cc225ffb36874190
> 88361315535fc 100644
> --- a/include/drm/drm_writeback.h
> +++ b/include/drm/drm_writeback.h
> @@ -24,17 +24,6 @@ struct drm_writeback_connector {
>  	 */
>  	struct drm_connector base;
> 
> -	/**
> -	 * @encoder: Internal encoder used by the connector to fulfill
> -	 * the DRM framework requirements. The users of the
> -	 * @drm_writeback_connector control the behaviour of the @encoder
> -	 * by passing the @enc_funcs parameter to
> drm_writeback_connector_init()
> -	 * function.
> -	 * For users of drm_writeback_connector_init_with_encoder(), this
> field
> -	 * is not valid as the encoder is managed within their drivers.
> -	 */
> -	struct drm_encoder encoder;
> -
>  	/**
>  	 * @pixel_formats_blob_ptr:
>  	 *
> @@ -148,13 +137,6 @@ drm_connector_to_writeback(struct drm_connector
> *connector)
>  	return container_of(connector, struct drm_writeback_connector, base);
> }
> 
> -int drm_writeback_connector_init(struct drm_device *dev,
> -				 struct drm_writeback_connector
> *wb_connector,
> -				 const struct drm_connector_funcs
> *con_funcs,
> -				 const struct drm_encoder_helper_funcs
> *enc_helper_funcs,
> -				 const u32 *formats, int n_formats,
> -				 u32 possible_crtcs);
> -
>  int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
>  				struct drm_writeback_connector
> *wb_connector,
>  				struct drm_encoder *enc,
> 
> --
> 2.39.5