diff mbox series

[21/22] drm/writeback: Use simple encoder

Message ID 20200305155950.2705-22-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Convert drivers to drm_simple_encoder_init() | expand

Commit Message

Thomas Zimmermann March 5, 2020, 3:59 p.m. UTC
The writeback code uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_writeback.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

kernel test robot March 6, 2020, 12:54 a.m. UTC | #1
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_writeback.c: In function 'drm_writeback_connector_init':
>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors

vim +191 drivers/gpu/drm/drm_writeback.c

   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id, connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot March 6, 2020, 1:17 a.m. UTC | #2
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: mips-randconfig-a001-20200306 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=5.5.0 make.cross ARCH=mips 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_writeback.c: In function 'drm_writeback_connector_init':
>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of function 'drm_simple_encoder_init' [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
           ^
   cc1: some warnings being treated as errors

vim +/drm_simple_encoder_init +191 drivers/gpu/drm/drm_writeback.c

   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id, connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot March 6, 2020, 2:54 p.m. UTC | #3
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of function 'drm_simple_encoder_init' [-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
                 ^
   drivers/gpu/drm/drm_writeback.c:191:8: note: did you mean 'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.

vim +/drm_simple_encoder_init +191 drivers/gpu/drm/drm_writeback.c

   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id, connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index 43d9e3bb3a94..cefb500c4ed7 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -16,6 +16,7 @@ 
 #include <drm/drm_drv.h>
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_property.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_writeback.h>
 
 /**
@@ -146,10 +147,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
@@ -191,9 +188,8 @@  int drm_writeback_connector_init(struct drm_device *dev,
 		return PTR_ERR(blob);
 
 	drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
-	ret = drm_encoder_init(dev, &wb_connector->encoder,
-			       &drm_writeback_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
+	ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
+				      DRM_MODE_ENCODER_VIRTUAL);
 	if (ret)
 		goto fail;