dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: writeback: Use simple encoder
@ 2021-03-10  7:11 Tian Tao
  2021-03-10 11:59 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2021-03-10  7:11 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	sumit.semwal, christian.koenig
  Cc: dri-devel

The driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/gpu/drm/drm_writeback.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index dccf4504..dea9b25 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>
 
 /**
@@ -145,10 +146,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
@@ -190,9 +187,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;
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm: writeback: Use simple encoder
  2021-03-10  7:11 [PATCH] drm: writeback: Use simple encoder Tian Tao
@ 2021-03-10 11:59 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-03-10 11:59 UTC (permalink / raw)
  To: Tian Tao, maarten.lankhorst, mripard, tzimmermann, airlied,
	daniel, sumit.semwal, christian.koenig
  Cc: kbuild-all, dri-devel

[-- Attachment #1: Type: text/plain, Size: 5134 bytes --]

Hi Tian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.12-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Tian-Tao/drm-writeback-Use-simple-encoder/20210310-153629
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 05a59d79793d482f628a31753c671f2e92178a21
config: x86_64-randconfig-m001-20210308 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/3c17eccc7f6b0abfae1af4d6672dfdbae2beb9c0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tian-Tao/drm-writeback-Use-simple-encoder/20210310-153629
        git checkout 3c17eccc7f6b0abfae1af4d6672dfdbae2beb9c0
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

All errors (new ones prefixed by >>):

   ld: drivers/gpu/drm/drm_writeback.o: in function `drm_writeback_connector_init':
>> drivers/gpu/drm/drm_writeback.c:190: undefined reference to `drm_simple_encoder_init'


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

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

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31529 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-10 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  7:11 [PATCH] drm: writeback: Use simple encoder Tian Tao
2021-03-10 11:59 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).