dri-devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions
@ 2020-05-22 13:52 Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro Thomas Zimmermann
                   ` (21 more replies)
  0 siblings, 22 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

Most of the CMA-based drivers use the default implementation for the
callbacks in struct drm_driver. With this patch, these interfaces are
initialized with a common helper macro and GEM object functions replace
several deprecated interfaces.

The first patch updates the existing macro to similar naming as with
SHMEM and adds a helper for drivers that override the default implementation
for .dumb_create(). The remaining patches convert the drivers. The aspeed
driver already uses GEM object functions and only changes to the initializer
macro.

I don't have much of the hardware, so compile-tested on aarch64, arm and
x86-64 only.

Thomas Zimmermann (21):
  drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  drm/arc: Use GEM CMA object functions
  drm/arm: Use GEM CMA object functions
  drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS
  drm/atmel-hlcdc: Use GEM CMA object functions
  drm/fsl-dcu: Use GEM CMA object functions
  drm/hisilicon/kirin: Use GEM CMA object functions
  drm/imx: Use GEM CMA object functions
  drm/ingenic: Use GEM CMA object functions
  drm/komeda: Use GEM CMA object functions
  drm/malidp: Use GEM CMA object functions
  drm/mcde: Use GEM CMA object functions
  drm/meson: Use GEM CMA object functions
  drm/mxsfb: Use GEM CMA object functions
  drm/rcar-du: Use GEM CMA object functions
  drm/shmobile: Use GEM CMA object functions
  drm/stm: Use GEM CMA object functions
  drm/sti: Use GEM CMA object functions
  drm/tilcdc: Use GEM CMA object functions
  drm/tv200: Use GEM CMA object functions
  drm/zte: Use GEM CMA object functions

 drivers/gpu/drm/arc/arcpgu_drv.c              | 12 +---------
 .../gpu/drm/arm/display/komeda/komeda_kms.c   | 11 +--------
 drivers/gpu/drm/arm/hdlcd_drv.c               | 12 +---------
 drivers/gpu/drm/arm/malidp_drv.c              | 11 +--------
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c       |  7 +-----
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c  | 11 +--------
 drivers/gpu/drm/drm_gem_cma_helper.c          |  2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c     | 11 +--------
 .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c   | 12 +---------
 drivers/gpu/drm/imx/imx-drm-core.c            | 12 +---------
 drivers/gpu/drm/ingenic/ingenic-drm.c         | 13 +---------
 drivers/gpu/drm/mcde/mcde_drv.c               | 12 +---------
 drivers/gpu/drm/meson/meson_drv.c             | 15 ++----------
 drivers/gpu/drm/mxsfb/mxsfb_drv.c             | 11 +--------
 drivers/gpu/drm/rcar-du/rcar_du_drv.c         | 11 +--------
 drivers/gpu/drm/shmobile/shmob_drm_drv.c      | 11 +--------
 drivers/gpu/drm/sti/sti_drv.c                 | 12 +---------
 drivers/gpu/drm/stm/drv.c                     | 11 +--------
 drivers/gpu/drm/sun4i/sun4i_drv.c             |  3 +--
 drivers/gpu/drm/tidss/tidss_drv.c             |  2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c           | 13 +---------
 drivers/gpu/drm/tiny/hx8357d.c                |  2 +-
 drivers/gpu/drm/tiny/ili9225.c                |  2 +-
 drivers/gpu/drm/tiny/ili9341.c                |  2 +-
 drivers/gpu/drm/tiny/ili9486.c                |  2 +-
 drivers/gpu/drm/tiny/mi0283qt.c               |  2 +-
 drivers/gpu/drm/tiny/repaper.c                |  2 +-
 drivers/gpu/drm/tiny/st7586.c                 |  2 +-
 drivers/gpu/drm/tiny/st7735r.c                |  2 +-
 drivers/gpu/drm/tve200/tve200_drv.c           | 12 +---------
 drivers/gpu/drm/zte/zx_drm_drv.c              | 11 +--------
 include/drm/drm_gem_cma_helper.h              | 24 +++++++++++++++----
 32 files changed, 52 insertions(+), 226 deletions(-)

--
2.26.2

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

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

* [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 17:48   ` Sam Ravnborg
  2020-05-22 13:52 ` [PATCH 02/21] drm/arc: Use GEM CMA object functions Thomas Zimmermann
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

Rename the macro to DRM_GEM_CMA_DRIVER_OPS to align with SHMEM
helpers. An internal version is provided for drivers that override
the default .dumb_create callback. Adapt drivers to the changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_gem_cma_helper.c |  2 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c    |  3 +--
 drivers/gpu/drm/tidss/tidss_drv.c    |  2 +-
 drivers/gpu/drm/tiny/hx8357d.c       |  2 +-
 drivers/gpu/drm/tiny/ili9225.c       |  2 +-
 drivers/gpu/drm/tiny/ili9341.c       |  2 +-
 drivers/gpu/drm/tiny/ili9486.c       |  2 +-
 drivers/gpu/drm/tiny/mi0283qt.c      |  2 +-
 drivers/gpu/drm/tiny/repaper.c       |  2 +-
 drivers/gpu/drm/tiny/st7586.c        |  2 +-
 drivers/gpu/drm/tiny/st7735r.c       |  2 +-
 include/drm/drm_gem_cma_helper.h     | 24 ++++++++++++++++++++----
 12 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index 12e98fb28229d..6fa4d2f2e3987 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -620,7 +620,7 @@ EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs);
  * address set. This address is released when the object is freed.
  *
  * This function can be used as the &drm_driver.gem_prime_import_sg_table
- * callback. The DRM_GEM_CMA_VMAP_DRIVER_OPS() macro provides a shortcut to set
+ * callback. The &DRM_GEM_CMA_DRIVER_OPS macro provides a shortcut to set
  * the necessary DRM driver operations.
  *
  * Returns:
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 328272ff77d84..012855fd89c24 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -52,8 +52,7 @@ static struct drm_driver sun4i_drv_driver = {
 	.minor			= 0,
 
 	/* GEM Operations */
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
-	.dumb_create		= drm_sun4i_gem_dumb_create,
+	__DRM_GEM_CMA_DRIVER_OPS(drm_sun4i_gem_dumb_create),
 };
 
 static int sun4i_drv_bind(struct device *dev)
diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 99edc66ebdef2..1753cdc74ebda 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -112,7 +112,7 @@ static struct drm_driver tidss_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &tidss_fops,
 	.release		= tidss_release,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.name			= "tidss",
 	.desc			= "TI Keystone DSS",
 	.date			= "20180215",
diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index b4bc358a3269a..592da71d7ca70 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -196,7 +196,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
 static struct drm_driver hx8357d_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &hx8357d_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "hx8357d",
 	.desc			= "HX8357D",
diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
index d1a5ab6747d5c..368ff6c8a1efb 100644
--- a/drivers/gpu/drm/tiny/ili9225.c
+++ b/drivers/gpu/drm/tiny/ili9225.c
@@ -346,7 +346,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
 static struct drm_driver ili9225_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9225_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.name			= "ili9225",
 	.desc			= "Ilitek ILI9225",
 	.date			= "20171106",
diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index bb819f45a5d3b..e1b9043ef7a0a 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -152,7 +152,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
 static struct drm_driver ili9341_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9341_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "ili9341",
 	.desc			= "Ilitek ILI9341",
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 2702ea557d297..90a17f40fdf0c 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -165,7 +165,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
 static struct drm_driver ili9486_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9486_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "ili9486",
 	.desc			= "Ilitek ILI9486",
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index 08ac549ab0f7f..6624c2098fba2 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -156,7 +156,7 @@ DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
 static struct drm_driver mi0283qt_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &mi0283qt_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "mi0283qt",
 	.desc			= "Multi-Inno MI0283QT",
diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 1c0e7169545b4..877dcece25828 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -946,7 +946,7 @@ DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
 static struct drm_driver repaper_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &repaper_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.name			= "repaper",
 	.desc			= "Pervasive Displays RePaper e-ink panels",
 	.date			= "20170405",
diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
index 2a1fae422f7a2..ec84bdc51f60d 100644
--- a/drivers/gpu/drm/tiny/st7586.c
+++ b/drivers/gpu/drm/tiny/st7586.c
@@ -285,7 +285,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
 static struct drm_driver st7586_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &st7586_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "st7586",
 	.desc			= "Sitronix ST7586",
diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
index 0af1b15efdf8a..cfd4933f3b30c 100644
--- a/drivers/gpu/drm/tiny/st7735r.c
+++ b/drivers/gpu/drm/tiny/st7735r.c
@@ -157,7 +157,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
 static struct drm_driver st7735r_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &st7735r_fops,
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "st7735r",
 	.desc			= "Sitronix ST7735R",
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 947ac95eb24a9..917d42603db06 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -110,21 +110,37 @@ struct drm_gem_object *
 drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size);
 
 /**
- * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
- *                               address on the buffer
+ * __DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a
+ *                            virtual address on the buffer
+ * @__dumb_create: callback function for .dumb_create
  *
  * This macro provides a shortcut for setting the default GEM operations in the
  * &drm_driver structure for drivers that need the virtual address also on
  * imported buffers.
+ *
+ * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that
+ * override the default implementation of .dumb_create. Use
+ * DRM_GEM_CMA_DRIVER_OPS if possible.
  */
-#define DRM_GEM_CMA_VMAP_DRIVER_OPS \
+#define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
 	.gem_create_object	= drm_cma_gem_create_object_default_funcs, \
-	.dumb_create		= drm_gem_cma_dumb_create, \
+	.dumb_create		= (__dumb_create), \
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd, \
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle, \
 	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
 	.gem_prime_mmap		= drm_gem_prime_mmap
 
+/**
+ * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
+ *                          address on the buffer
+ *
+ * This macro provides a shortcut for setting the default GEM operations in the
+ * &drm_driver structure for drivers that need the virtual address also on
+ * imported buffers.
+ */
+#define DRM_GEM_CMA_DRIVER_OPS \
+	__DRM_GEM_CMA_DRIVER_OPS(drm_gem_cma_dumb_create)
+
 struct drm_gem_object *
 drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *drm,
 				       struct dma_buf_attachment *attach,
-- 
2.26.2

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

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

* [PATCH 02/21] drm/arc: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 03/21] drm/arm: " Thomas Zimmermann
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The arc driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index c05d001163e0e..f164818ec477a 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -154,17 +154,7 @@ static struct drm_driver arcpgu_drm_driver = {
 	.minor = 0,
 	.patchlevel = 0,
 	.fops = &arcpgu_drm_ops,
-	.dumb_create = drm_gem_cma_dumb_create,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_print_info = drm_gem_cma_print_info,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = arcpgu_debugfs_init,
 #endif
-- 
2.26.2

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

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

* [PATCH 03/21] drm/arm: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 02/21] drm/arc: Use GEM CMA object functions Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 04/21] drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS Thomas Zimmermann
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The arm driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 194419f47c5e5..c83b81a3a582a 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -240,17 +240,7 @@ static struct drm_driver hdlcd_driver = {
 	.irq_preinstall = hdlcd_irq_preinstall,
 	.irq_postinstall = hdlcd_irq_postinstall,
 	.irq_uninstall = hdlcd_irq_uninstall,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_print_info = drm_gem_cma_print_info,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.dumb_create = drm_gem_cma_dumb_create,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = hdlcd_debugfs_init,
 #endif
-- 
2.26.2

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

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

* [PATCH 04/21] drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 03/21] drm/arm: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions Thomas Zimmermann
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index 6b27242b9ee3c..1167ff78e24a3 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -188,12 +188,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver aspeed_gfx_driver = {
 	.driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.gem_create_object	= drm_cma_gem_create_object_default_funcs,
-	.dumb_create		= drm_gem_cma_dumb_create,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_mmap		= drm_gem_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "aspeed-gfx-drm",
 	.desc = "ASPEED GFX DRM",
-- 
2.26.2

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

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

* [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 04/21] drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 18:08   ` Sam Ravnborg
  2020-05-22 19:25   ` Sam Ravnborg
  2020-05-22 13:52 ` [PATCH 06/21] drm/fsl-dcu: " Thomas Zimmermann
                   ` (16 subsequent siblings)
  21 siblings, 2 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The atmel-hlcdc driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 112aa5066ceed..871293d1aeeba 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -821,16 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
 	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
 	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-	.dumb_create = drm_gem_cma_dumb_create,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "atmel-hlcdc",
 	.desc = "Atmel HLCD Controller DRM",
-- 
2.26.2

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

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

* [PATCH 06/21] drm/fsl-dcu: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (4 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 07/21] drm/hisilicon/kirin: " Thomas Zimmermann
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The fsl-dcu driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index f15d2e7967a3e..abbc1ddbf27f0 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -141,16 +141,7 @@ static struct drm_driver fsl_dcu_drm_driver = {
 	.irq_handler		= fsl_dcu_drm_irq,
 	.irq_preinstall		= fsl_dcu_irq_uninstall,
 	.irq_uninstall		= fsl_dcu_irq_uninstall,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-	.dumb_create		= drm_gem_cma_dumb_create,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &fsl_dcu_drm_fops,
 	.name			= "fsl-dcu-drm",
 	.desc			= "Freescale DCU DRM",
-- 
2.26.2

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

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

* [PATCH 07/21] drm/hisilicon/kirin: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (5 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 06/21] drm/fsl-dcu: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 18:11   ` Emil Velikov
  2020-05-22 13:52 ` [PATCH 08/21] drm/imx: " Thomas Zimmermann
                   ` (14 subsequent siblings)
  21 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The kirin driver uses the default implementation for CMA functions; except
for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
these defaults and .dumb_create in struct drm_driver. All remaining
operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index c339e632522a9..b1ffd7d43e562 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -921,17 +921,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
 static struct drm_driver ade_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops = &ade_fops,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.dumb_create = drm_gem_cma_dumb_create_internal,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-
+	__DRM_GEM_CMA_DRIVER_OPS(drm_gem_cma_dumb_create_internal),
 	.name = "kirin",
 	.desc = "Hisilicon Kirin620 SoC DRM Driver",
 	.date = "20150718",
-- 
2.26.2

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

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

* [PATCH 08/21] drm/imx: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (6 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 07/21] drm/hisilicon/kirin: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 09/21] drm/ingenic: " Thomas Zimmermann
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The imx driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 2e38f1a5cf8da..36037b2e65647 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -146,17 +146,7 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = {
 
 static struct drm_driver imx_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-	.dumb_create		= drm_gem_cma_dumb_create,
-
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.ioctls			= imx_drm_ioctls,
 	.num_ioctls		= ARRAY_SIZE(imx_drm_ioctls),
 	.fops			= &imx_drm_driver_fops,
-- 
2.26.2

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

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

* [PATCH 09/21] drm/ingenic: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (7 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 08/21] drm/imx: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 10/21] drm/komeda: " Thomas Zimmermann
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The ingenic driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
index eff57a1f70fb0..1c1cee367b752 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -519,18 +519,7 @@ static struct drm_driver ingenic_drm_driver_data = {
 	.patchlevel		= 0,
 
 	.fops			= &ingenic_drm_fops,
-
-	.dumb_create		= drm_gem_cma_dumb_create,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 
 	.irq_handler		= ingenic_drm_irq_handler,
 };
-- 
2.26.2

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

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

* [PATCH 10/21] drm/komeda: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (8 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 09/21] drm/ingenic: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 11/21] drm/malidp: " Thomas Zimmermann
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The komeda driver uses the default implementation for CMA functions; except
for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
these defaults and .dumb_create in struct drm_driver. All remaining
operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
index 6b85d5f4caa85..bdfbcbc416260 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
@@ -61,16 +61,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
 static struct drm_driver komeda_kms_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.lastclose			= drm_fb_helper_lastclose,
-	.gem_free_object_unlocked	= drm_gem_cma_free_object,
-	.gem_vm_ops			= &drm_gem_cma_vm_ops,
-	.dumb_create			= komeda_gem_cma_dumb_create,
-	.prime_handle_to_fd		= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle		= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table		= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table	= drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap			= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap		= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap			= drm_gem_cma_prime_mmap,
+	__DRM_GEM_CMA_DRIVER_OPS(komeda_gem_cma_dumb_create),
 	.fops = &komeda_cma_fops,
 	.name = "komeda",
 	.desc = "Arm Komeda Display Processor driver",
-- 
2.26.2

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

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

* [PATCH 11/21] drm/malidp: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (9 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 10/21] drm/komeda: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 12/21] drm/mcde: " Thomas Zimmermann
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The malidp driver uses the default implementation for CMA functions; except
for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
these defaults and .dumb_create in struct drm_driver. All remaining
operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/malidp_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index def8c9ffafcaf..92e0bca6aa2f4 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -563,16 +563,7 @@ static void malidp_debugfs_init(struct drm_minor *minor)
 
 static struct drm_driver malidp_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.dumb_create = malidp_dumb_create,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	__DRM_GEM_CMA_DRIVER_OPS(malidp_dumb_create),
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = malidp_debugfs_init,
 #endif
-- 
2.26.2

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

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

* [PATCH 12/21] drm/mcde: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (10 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 11/21] drm/malidp: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-25 11:36   ` Linus Walleij
  2020-05-22 13:52 ` [PATCH 13/21] drm/meson: " Thomas Zimmermann
                   ` (9 subsequent siblings)
  21 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The mcde driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mcde/mcde_drv.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index 84f3e2dbd77bd..d300be5ee463d 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -228,17 +228,7 @@ static struct drm_driver mcde_drm_driver = {
 	.major = 1,
 	.minor = 0,
 	.patchlevel = 0,
-	.dumb_create = drm_gem_cma_dumb_create,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 };
 
 static int mcde_drm_bind(struct device *dev)
-- 
2.26.2

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

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

* [PATCH 13/21] drm/meson: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (11 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 12/21] drm/mcde: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 14/21] drm/mxsfb: " Thomas Zimmermann
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The meson driver uses the default implementation for CMA functions; except
for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
these defaults and .dumb_create in struct drm_driver. All remaining
operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/meson/meson_drv.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 4c5aafcec7991..2fe88f2b2fb55 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -96,19 +96,8 @@ static struct drm_driver meson_driver = {
 	/* IRQ */
 	.irq_handler		= meson_irq,
 
-	/* PRIME Ops */
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-
-	/* GEM Ops */
-	.dumb_create		= meson_dumb_create,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
+	/* CMA Ops */
+	__DRM_GEM_CMA_DRIVER_OPS(meson_dumb_create),
 
 	/* Misc */
 	.fops			= &fops,
-- 
2.26.2

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

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

* [PATCH 14/21] drm/mxsfb: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (12 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 13/21] drm/meson: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 15/21] drm/rcar-du: " Thomas Zimmermann
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The mxsfb driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 497cf443a9afa..47c7dce03da4a 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -356,16 +356,7 @@ static struct drm_driver mxsfb_driver = {
 	.irq_handler		= mxsfb_irq_handler,
 	.irq_preinstall		= mxsfb_irq_preinstall,
 	.irq_uninstall		= mxsfb_irq_preinstall,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-	.dumb_create		= drm_gem_cma_dumb_create,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops	= &fops,
 	.name	= "mxsfb-drm",
 	.desc	= "MXSFB Controller DRM",
-- 
2.26.2

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

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

* [PATCH 15/21] drm/rcar-du: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (13 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 14/21] drm/mxsfb: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 20:12   ` Laurent Pinchart
  2020-05-22 13:52 ` [PATCH 16/21] drm/shmobile: " Thomas Zimmermann
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The rcar-du driver uses the default implementation for CMA functions;
except for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro
now sets these defaults and .dumb_create in struct drm_driver. All
remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 3e67cf70f0402..3728038cec1d1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -476,16 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
 
 static struct drm_driver rcar_du_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-	.dumb_create		= rcar_du_dumb_create,
+	__DRM_GEM_CMA_DRIVER_OPS(rcar_du_dumb_create),
 	.fops			= &rcar_du_fops,
 	.name			= "rcar-du",
 	.desc			= "Renesas R-Car Display Unit",
-- 
2.26.2

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

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

* [PATCH 16/21] drm/shmobile: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (14 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 15/21] drm/rcar-du: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 17/21] drm/stm: " Thomas Zimmermann
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The shmobile driver uses the default implementation for CMA functions.
The DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct
drm_driver. All remaining operations are provided by CMA GEM object
functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index ae9d6b8d3ca87..26a15c214bd3f 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -131,16 +131,7 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
 static struct drm_driver shmob_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
 	.irq_handler		= shmob_drm_irq,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-	.dumb_create		= drm_gem_cma_dumb_create,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &shmob_drm_fops,
 	.name			= "shmob-drm",
 	.desc			= "Renesas SH Mobile DRM",
-- 
2.26.2

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

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

* [PATCH 17/21] drm/stm: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (15 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 16/21] drm/shmobile: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 18/21] drm/sti: " Thomas Zimmermann
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The stm driver uses the default implementation for CMA functions; except
for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
these defaults and .dumb_create in struct drm_driver. All remaining
operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/stm/drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 0f85dd86cafa7..d6238c71fabf6 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -62,16 +62,7 @@ static struct drm_driver drv_driver = {
 	.minor = 0,
 	.patchlevel = 0,
 	.fops = &drv_driver_fops,
-	.dumb_create = stm_gem_cma_dumb_create,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	__DRM_GEM_CMA_DRIVER_OPS(stm_gem_cma_dumb_create),
 };
 
 static int drv_load(struct drm_device *ddev)
-- 
2.26.2

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

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

* [PATCH 18/21] drm/sti: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (16 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 17/21] drm/stm: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 19/21] drm/tilcdc: " Thomas Zimmermann
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The sti driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/sti/sti_drv.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 3f9db3e3f3978..381804126e70d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -132,19 +132,9 @@ DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops);
 
 static struct drm_driver sti_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.dumb_create = drm_gem_cma_dumb_create,
+	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &sti_driver_fops,
 
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
-
 	.debugfs_init = sti_drm_dbg_init,
 
 	.name = DRIVER_NAME,
-- 
2.26.2

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

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

* [PATCH 19/21] drm/tilcdc: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (17 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 18/21] drm/sti: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 13:52 ` [PATCH 20/21] drm/tv200: " Thomas Zimmermann
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The tilcdc driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index a5e9ee4c7fbf4..0d74a64432633 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -496,18 +496,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 static struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.irq_handler        = tilcdc_irq,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_print_info     = drm_gem_cma_print_info,
-	.gem_vm_ops         = &drm_gem_cma_vm_ops,
-	.dumb_create        = drm_gem_cma_dumb_create,
-
-	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = tilcdc_debugfs_init,
 #endif
-- 
2.26.2

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

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

* [PATCH 20/21] drm/tv200: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (18 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 19/21] drm/tilcdc: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-25 11:36   ` Linus Walleij
  2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
  2020-05-22 18:19 ` [PATCH 00/21] drm: Convert most CMA-based drivers to GEM " Emil Velikov
  21 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The tve200 driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tve200/tve200_drv.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index 00ba9e5ce1307..c3aa39bd38ecd 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -147,17 +147,7 @@ static struct drm_driver tve200_drm_driver = {
 	.major = 1,
 	.minor = 0,
 	.patchlevel = 0,
-	.dumb_create = drm_gem_cma_dumb_create,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_DRIVER_OPS,
 };
 
 static int tve200_probe(struct platform_device *pdev)
-- 
2.26.2

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

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

* [PATCH 21/21] drm/zte: Use GEM CMA object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (19 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 20/21] drm/tv200: " Thomas Zimmermann
@ 2020-05-22 13:52 ` Thomas Zimmermann
  2020-05-22 19:03   ` Sam Ravnborg
                     ` (2 more replies)
  2020-05-22 18:19 ` [PATCH 00/21] drm: Convert most CMA-based drivers to GEM " Emil Velikov
  21 siblings, 3 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-22 13:52 UTC (permalink / raw)
  To: abrodkin, airlied, daniel, james.qian.wang, liviu.dudau,
	mihail.atanassov, brian.starkey, joel, andrew, sam, bbrezillon,
	nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: linux-arm-kernel, Thomas Zimmermann, linux-aspeed, dri-devel

The zte driver uses the default implementation for CMA functions. The
DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
All remaining operations are provided by CMA GEM object functions.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/zte/zx_drm_drv.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index 1141c1ed1ed04..42c59eae0ea03 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -36,16 +36,7 @@ DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
 
 static struct drm_driver zx_drm_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.gem_free_object_unlocked = drm_gem_cma_free_object,
-	.gem_vm_ops = &drm_gem_cma_vm_ops,
-	.dumb_create = drm_gem_cma_dumb_create,
-	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
-	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
-	.gem_prime_vmap = drm_gem_cma_prime_vmap,
-	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
-	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	DRM_GEM_CMA_VMAP_DRIVER_OPS,
 	.fops = &zx_drm_fops,
 	.name = "zx-vou",
 	.desc = "ZTE VOU Controller DRM",
-- 
2.26.2

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

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

* Re: [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 13:52 ` [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro Thomas Zimmermann
@ 2020-05-22 17:48   ` Sam Ravnborg
  2020-05-22 18:15     ` Emil Velikov
                       ` (2 more replies)
  0 siblings, 3 replies; 45+ messages in thread
From: Sam Ravnborg @ 2020-05-22 17:48 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, laurent.pinchart,
	mihail.atanassov, alexandre.torgue, marex, khilman, abrodkin,
	ludovic.desroches, xinliang.liu, kong.kongxinwei, tomi.valkeinen,
	james.qian.wang, joel, linux-imx, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, kernel,
	linux-arm-kernel, mcoquelin.stm32, bbrezillon, andrew, dri-devel,
	nicolas.ferre, yannick.fertre, kieran.bingham+renesas,
	zourongrong, shawnguo

Hi Thomas.

On Fri, May 22, 2020 at 03:52:26PM +0200, Thomas Zimmermann wrote:
> Rename the macro to DRM_GEM_CMA_DRIVER_OPS to align with SHMEM
> helpers.
This part is fine, I like that the naming is somehow consistent.

> An internal version is provided for drivers that override
> the default .dumb_create callback. Adapt drivers to the changes.
I loathe anything named __foo or __FOO. This __ signals to me
that the author was clueless in naming - or some sort.
I know that __ is used in some lib headers - but thats not the case
here.

But I love that we have a variant that takes a create function.
So we do not have to escape from the nice macro.
The macro is another way to tell me as rewiewer that this
drivers uses all the default helpers for this.


So critizising the name I better suggest something that
I personally like better:

DRM_GEM_CMA_DRIVER_OPS_CREATE()

It would look like this:
	/* GEM Operations */
-	DRM_GEM_CMA_VMAP_DRIVER_OPS,
-	.dumb_create            = drm_sun4i_gem_dumb_create,
+	DRM_GEM_CMA_DRIVER_OPS_CREATE(drm_sun4i_gem_dumb_create),



Please fix zte/zx_drm_drv.c which also uses DRM_GEM_CMA_VMAP_DRIVER_OPS.


The naming is a bikeshedding topic that we may not agree on, soo..

With zte fixed the patch is:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

	Sam


> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_gem_cma_helper.c |  2 +-
>  drivers/gpu/drm/sun4i/sun4i_drv.c    |  3 +--
>  drivers/gpu/drm/tidss/tidss_drv.c    |  2 +-
>  drivers/gpu/drm/tiny/hx8357d.c       |  2 +-
>  drivers/gpu/drm/tiny/ili9225.c       |  2 +-
>  drivers/gpu/drm/tiny/ili9341.c       |  2 +-
>  drivers/gpu/drm/tiny/ili9486.c       |  2 +-
>  drivers/gpu/drm/tiny/mi0283qt.c      |  2 +-
>  drivers/gpu/drm/tiny/repaper.c       |  2 +-
>  drivers/gpu/drm/tiny/st7586.c        |  2 +-
>  drivers/gpu/drm/tiny/st7735r.c       |  2 +-
>  include/drm/drm_gem_cma_helper.h     | 24 ++++++++++++++++++++----
>  12 files changed, 31 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> index 12e98fb28229d..6fa4d2f2e3987 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -620,7 +620,7 @@ EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs);
>   * address set. This address is released when the object is freed.
>   *
>   * This function can be used as the &drm_driver.gem_prime_import_sg_table
> - * callback. The DRM_GEM_CMA_VMAP_DRIVER_OPS() macro provides a shortcut to set
> + * callback. The &DRM_GEM_CMA_DRIVER_OPS macro provides a shortcut to set
>   * the necessary DRM driver operations.
>   *
>   * Returns:
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 328272ff77d84..012855fd89c24 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -52,8 +52,7 @@ static struct drm_driver sun4i_drv_driver = {
>  	.minor			= 0,
>  
>  	/* GEM Operations */
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> -	.dumb_create		= drm_sun4i_gem_dumb_create,
> +	__DRM_GEM_CMA_DRIVER_OPS(drm_sun4i_gem_dumb_create),
>  };
>  
>  static int sun4i_drv_bind(struct device *dev)
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> index 99edc66ebdef2..1753cdc74ebda 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.c
> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> @@ -112,7 +112,7 @@ static struct drm_driver tidss_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &tidss_fops,
>  	.release		= tidss_release,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.name			= "tidss",
>  	.desc			= "TI Keystone DSS",
>  	.date			= "20180215",
> diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
> index b4bc358a3269a..592da71d7ca70 100644
> --- a/drivers/gpu/drm/tiny/hx8357d.c
> +++ b/drivers/gpu/drm/tiny/hx8357d.c
> @@ -196,7 +196,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
>  static struct drm_driver hx8357d_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &hx8357d_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "hx8357d",
>  	.desc			= "HX8357D",
> diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
> index d1a5ab6747d5c..368ff6c8a1efb 100644
> --- a/drivers/gpu/drm/tiny/ili9225.c
> +++ b/drivers/gpu/drm/tiny/ili9225.c
> @@ -346,7 +346,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
>  static struct drm_driver ili9225_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9225_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.name			= "ili9225",
>  	.desc			= "Ilitek ILI9225",
>  	.date			= "20171106",
> diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
> index bb819f45a5d3b..e1b9043ef7a0a 100644
> --- a/drivers/gpu/drm/tiny/ili9341.c
> +++ b/drivers/gpu/drm/tiny/ili9341.c
> @@ -152,7 +152,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
>  static struct drm_driver ili9341_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9341_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "ili9341",
>  	.desc			= "Ilitek ILI9341",
> diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
> index 2702ea557d297..90a17f40fdf0c 100644
> --- a/drivers/gpu/drm/tiny/ili9486.c
> +++ b/drivers/gpu/drm/tiny/ili9486.c
> @@ -165,7 +165,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
>  static struct drm_driver ili9486_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9486_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "ili9486",
>  	.desc			= "Ilitek ILI9486",
> diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
> index 08ac549ab0f7f..6624c2098fba2 100644
> --- a/drivers/gpu/drm/tiny/mi0283qt.c
> +++ b/drivers/gpu/drm/tiny/mi0283qt.c
> @@ -156,7 +156,7 @@ DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
>  static struct drm_driver mi0283qt_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &mi0283qt_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "mi0283qt",
>  	.desc			= "Multi-Inno MI0283QT",
> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> index 1c0e7169545b4..877dcece25828 100644
> --- a/drivers/gpu/drm/tiny/repaper.c
> +++ b/drivers/gpu/drm/tiny/repaper.c
> @@ -946,7 +946,7 @@ DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
>  static struct drm_driver repaper_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &repaper_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.name			= "repaper",
>  	.desc			= "Pervasive Displays RePaper e-ink panels",
>  	.date			= "20170405",
> diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
> index 2a1fae422f7a2..ec84bdc51f60d 100644
> --- a/drivers/gpu/drm/tiny/st7586.c
> +++ b/drivers/gpu/drm/tiny/st7586.c
> @@ -285,7 +285,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
>  static struct drm_driver st7586_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &st7586_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "st7586",
>  	.desc			= "Sitronix ST7586",
> diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
> index 0af1b15efdf8a..cfd4933f3b30c 100644
> --- a/drivers/gpu/drm/tiny/st7735r.c
> +++ b/drivers/gpu/drm/tiny/st7735r.c
> @@ -157,7 +157,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
>  static struct drm_driver st7735r_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &st7735r_fops,
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.debugfs_init		= mipi_dbi_debugfs_init,
>  	.name			= "st7735r",
>  	.desc			= "Sitronix ST7735R",
> diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
> index 947ac95eb24a9..917d42603db06 100644
> --- a/include/drm/drm_gem_cma_helper.h
> +++ b/include/drm/drm_gem_cma_helper.h
> @@ -110,21 +110,37 @@ struct drm_gem_object *
>  drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size);
>  
>  /**
> - * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
> - *                               address on the buffer
> + * __DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a
> + *                            virtual address on the buffer
> + * @__dumb_create: callback function for .dumb_create
>   *
>   * This macro provides a shortcut for setting the default GEM operations in the
>   * &drm_driver structure for drivers that need the virtual address also on
>   * imported buffers.
> + *
> + * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that
> + * override the default implementation of .dumb_create. Use
> + * DRM_GEM_CMA_DRIVER_OPS if possible.
>   */
> -#define DRM_GEM_CMA_VMAP_DRIVER_OPS \
> +#define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
>  	.gem_create_object	= drm_cma_gem_create_object_default_funcs, \
> -	.dumb_create		= drm_gem_cma_dumb_create, \
> +	.dumb_create		= (__dumb_create), \
>  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd, \
>  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle, \
>  	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
>  	.gem_prime_mmap		= drm_gem_prime_mmap
>  
> +/**
> + * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
> + *                          address on the buffer
> + *
> + * This macro provides a shortcut for setting the default GEM operations in the
> + * &drm_driver structure for drivers that need the virtual address also on
> + * imported buffers.
> + */
> +#define DRM_GEM_CMA_DRIVER_OPS \
> +	__DRM_GEM_CMA_DRIVER_OPS(drm_gem_cma_dumb_create)
> +
>  struct drm_gem_object *
>  drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *drm,
>  				       struct dma_buf_attachment *attach,
> -- 
> 2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions Thomas Zimmermann
@ 2020-05-22 18:08   ` Sam Ravnborg
  2020-05-25 12:10     ` Thomas Zimmermann
  2020-05-22 19:25   ` Sam Ravnborg
  1 sibling, 1 reply; 45+ messages in thread
From: Sam Ravnborg @ 2020-05-22 18:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, laurent.pinchart,
	mihail.atanassov, alexandre.torgue, marex, khilman, abrodkin,
	ludovic.desroches, xinliang.liu, kong.kongxinwei, tomi.valkeinen,
	james.qian.wang, joel, linux-imx, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, kernel,
	linux-arm-kernel, mcoquelin.stm32, bbrezillon, andrew, dri-devel,
	nicolas.ferre, yannick.fertre, kieran.bingham+renesas,
	zourongrong, shawnguo

Hi Thomas.

On Fri, May 22, 2020 at 03:52:30PM +0200, Thomas Zimmermann wrote:
> The atmel-hlcdc driver uses the default implementation for CMA functions. The
> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> All remaining operations are provided by CMA GEM object functions.

A nice side-effect of introducing the defualt implementation
of CMA functions is that this driver is now migrated over to use
drm_gem_object_funcs, which is why we can replace all these
helpers with a simple macro that defined only 6 helpers.

With an improved changelog:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

And as I said in the other mail, this is really nice.
It is now much more obvious that this drivers uses
all the default helpers for CMA.

And I can drop one item from my TODO list on top of that.

	Sam

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 112aa5066ceed..871293d1aeeba 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -821,16 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
> -	.gem_vm_ops = &drm_gem_cma_vm_ops,
> -	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> -	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> -	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
> -	.gem_prime_vmap = drm_gem_cma_prime_vmap,
> -	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
> -	.gem_prime_mmap = drm_gem_cma_prime_mmap,
> -	.dumb_create = drm_gem_cma_dumb_create,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
>  	.desc = "Atmel HLCD Controller DRM",
> -- 
> 2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 07/21] drm/hisilicon/kirin: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 07/21] drm/hisilicon/kirin: " Thomas Zimmermann
@ 2020-05-22 18:11   ` Emil Velikov
  2020-05-25 12:41     ` Thomas Zimmermann
  0 siblings, 1 reply; 45+ messages in thread
From: Emil Velikov @ 2020-05-22 18:11 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre Torgue,
	Marek Vašut, Alexey Brodkin, ludovic.desroches,
	Xinliang Liu, Xinwei Kong, Tomi Valkeinen,
	james qian wang (Arm Technology China),
	joel, NXP Linux Team, Chen Feng, Sascha Hauer, Alison Wang,
	Jyri Sarha, Chen-Yu Tsai, Vincent Abriou, Sascha Hauer, LAKML,
	Maxime Coquelin, bbrezillon, andrew, ML dri-devel, nicolas.ferre,
	Yannick Fertre, Kieran Bingham, khilman, Rongrong Zou, Shawn Guo

Hi Thomas,

On Fri, 22 May 2020 at 14:53, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> The kirin driver uses the default implementation for CMA functions; except
> for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
> these defaults and .dumb_create in struct drm_driver. All remaining
> operations are provided by CMA GEM object functions.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index c339e632522a9..b1ffd7d43e562 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -921,17 +921,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
>  static struct drm_driver ade_driver = {
>         .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>         .fops = &ade_fops,
> -       .gem_free_object_unlocked = drm_gem_cma_free_object,
> -       .gem_vm_ops = &drm_gem_cma_vm_ops,
> -       .dumb_create = drm_gem_cma_dumb_create_internal,

This doesn't seem right. The _internal documentation explicitly says
that this should _not_ be used as .dumb_create. Instead drivers should
use it to implement their callback.

Since it yields the same result as drm_gem_cma_dumb_create we can use
the default macro below.

Weather to the .dumb_create in separate patch, or squash it here -
I'll leave to you.
In case of the latter, please mentioned it in the commit message.

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

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

* Re: [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 17:48   ` Sam Ravnborg
@ 2020-05-22 18:15     ` Emil Velikov
  2020-05-22 18:45       ` Sam Ravnborg
  2020-05-22 19:48     ` Laurent Pinchart
  2020-05-25 12:03     ` Thomas Zimmermann
  2 siblings, 1 reply; 45+ messages in thread
From: Emil Velikov @ 2020-05-22 18:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: alexandre.belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, ML dri-devel, nicolas.ferre, Paul Cercueil,
	Laurent Pinchart, Mihail Atanassov, Marek Vašut, khilman,
	Alexey Brodkin, Xinwei Kong, Xinliang Liu, ludovic.desroches,
	Tomi Valkeinen, james qian wang (Arm Technology China),
	NXP Linux Team, joel, Alexandre Torgue, Chen Feng, Sascha Hauer,
	Alison Wang, Jyri Sarha, Chen-Yu Tsai, Vincent Abriou,
	Sascha Hauer, LAKML, Maxime Coquelin, bbrezillon, andrew,
	Philippe Cornu, Yannick Fertre, Kieran Bingham,
	Thomas Zimmermann, Rongrong Zou, Shawn Guo

On Fri, 22 May 2020 at 18:48, Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Thomas.
>
> On Fri, May 22, 2020 at 03:52:26PM +0200, Thomas Zimmermann wrote:
> > Rename the macro to DRM_GEM_CMA_DRIVER_OPS to align with SHMEM
> > helpers.
> This part is fine, I like that the naming is somehow consistent.
>
> > An internal version is provided for drivers that override
> > the default .dumb_create callback. Adapt drivers to the changes.
> I loathe anything named __foo or __FOO. This __ signals to me
> that the author was clueless in naming - or some sort.
> I know that __ is used in some lib headers - but thats not the case
> here.
>
> But I love that we have a variant that takes a create function.
> So we do not have to escape from the nice macro.
> The macro is another way to tell me as rewiewer that this
> drivers uses all the default helpers for this.
>
Fwiw I share the sentiment, although I fear we're a little late. __
prefixed functions are widely common in core drm and it's helpers.

>
> So critizising the name I better suggest something that
> I personally like better:
>
> DRM_GEM_CMA_DRIVER_OPS_CREATE()
>
> It would look like this:
>         /* GEM Operations */
> -       DRM_GEM_CMA_VMAP_DRIVER_OPS,
> -       .dumb_create            = drm_sun4i_gem_dumb_create,
> +       DRM_GEM_CMA_DRIVER_OPS_CREATE(drm_sun4i_gem_dumb_create),
>
>
>
> Please fix zte/zx_drm_drv.c which also uses DRM_GEM_CMA_VMAP_DRIVER_OPS.
>
Isn't DRM_GEM_CMA_VMAP_DRIVER_OPS introduced to zte with the last
patch in the series?

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

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

* Re: [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions
  2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
                   ` (20 preceding siblings ...)
  2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
@ 2020-05-22 18:19 ` Emil Velikov
  21 siblings, 0 replies; 45+ messages in thread
From: Emil Velikov @ 2020-05-22 18:19 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre Torgue,
	Marek Vašut, Alexey Brodkin, ludovic.desroches,
	Xinliang Liu, Xinwei Kong, Tomi Valkeinen,
	james qian wang (Arm Technology China),
	joel, NXP Linux Team, Chen Feng, Sascha Hauer, Alison Wang,
	Jyri Sarha, Chen-Yu Tsai, Vincent Abriou, Sascha Hauer, LAKML,
	Maxime Coquelin, bbrezillon, andrew, ML dri-devel, nicolas.ferre,
	Yannick Fertre, Kieran Bingham, khilman, Rongrong Zou, Shawn Guo

Hi Thomas,

On Fri, 22 May 2020 at 14:53, Thomas Zimmermann <tzimmermann@suse.de> wrote:

>  32 files changed, 52 insertions(+), 226 deletions(-)
>
We need more diffstat like this. With this series the .gem_print_info
is no longer set.
Feel free to follow-up and nuke it, alongside the glue in drm_gem.c.

There's a small comment in the kirin patch - with that resolved the series is:
Acked-by: Emil Velikov <emil.velikov@collabora.com>

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

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

* Re: [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 18:15     ` Emil Velikov
@ 2020-05-22 18:45       ` Sam Ravnborg
  0 siblings, 0 replies; 45+ messages in thread
From: Sam Ravnborg @ 2020-05-22 18:45 UTC (permalink / raw)
  To: Emil Velikov
  Cc: alexandre.belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, ML dri-devel, nicolas.ferre, Paul Cercueil,
	Laurent Pinchart, Mihail Atanassov, Marek Vašut, khilman,
	Alexey Brodkin, Xinwei Kong, Xinliang Liu, ludovic.desroches,
	Tomi Valkeinen, james qian wang (Arm Technology China),
	NXP Linux Team, joel, Alexandre Torgue, Chen Feng, Sascha Hauer,
	Alison Wang, Jyri Sarha, Chen-Yu Tsai, Vincent Abriou,
	Sascha Hauer, LAKML, Maxime Coquelin, bbrezillon, andrew,
	Philippe Cornu, Yannick Fertre, Kieran Bingham,
	Thomas Zimmermann, Rongrong Zou, Shawn Guo

Hi Emil.

> > Please fix zte/zx_drm_drv.c which also uses DRM_GEM_CMA_VMAP_DRIVER_OPS.
> >
> Isn't DRM_GEM_CMA_VMAP_DRIVER_OPS introduced to zte with the last
> patch in the series?

You are right, I just applied all patches and throw them after my
build script and zte failed.

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

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

* Re: [PATCH 21/21] drm/zte: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
@ 2020-05-22 19:03   ` Sam Ravnborg
  2020-05-24 14:50   ` kbuild test robot
  2020-05-24 20:11   ` kbuild test robot
  2 siblings, 0 replies; 45+ messages in thread
From: Sam Ravnborg @ 2020-05-22 19:03 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, laurent.pinchart,
	mihail.atanassov, alexandre.torgue, marex, khilman, abrodkin,
	ludovic.desroches, xinliang.liu, kong.kongxinwei, tomi.valkeinen,
	james.qian.wang, joel, linux-imx, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, kernel,
	linux-arm-kernel, mcoquelin.stm32, bbrezillon, andrew, dri-devel,
	nicolas.ferre, yannick.fertre, kieran.bingham+renesas,
	zourongrong, shawnguo

Hi Thomas.

On Fri, May 22, 2020 at 03:52:46PM +0200, Thomas Zimmermann wrote:
> The zte driver uses the default implementation for CMA functions. The
> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> All remaining operations are provided by CMA GEM object functions.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/zte/zx_drm_drv.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index 1141c1ed1ed04..42c59eae0ea03 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -36,16 +36,7 @@ DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
>  
>  static struct drm_driver zx_drm_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
> -	.gem_vm_ops = &drm_gem_cma_vm_ops,
> -	.dumb_create = drm_gem_cma_dumb_create,
> -	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> -	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> -	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
> -	.gem_prime_vmap = drm_gem_cma_prime_vmap,
> -	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
> -	.gem_prime_mmap = drm_gem_cma_prime_mmap,
> +	DRM_GEM_CMA_VMAP_DRIVER_OPS,
s/_VMAP// as pointed out by Emil.

	Sam

>  	.fops = &zx_drm_fops,
>  	.name = "zx-vou",
>  	.desc = "ZTE VOU Controller DRM",
> -- 
> 2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions Thomas Zimmermann
  2020-05-22 18:08   ` Sam Ravnborg
@ 2020-05-22 19:25   ` Sam Ravnborg
  2020-05-25 12:37     ` Thomas Zimmermann
  1 sibling, 1 reply; 45+ messages in thread
From: Sam Ravnborg @ 2020-05-22 19:25 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, laurent.pinchart,
	mihail.atanassov, alexandre.torgue, marex, khilman, abrodkin,
	ludovic.desroches, xinliang.liu, kong.kongxinwei, tomi.valkeinen,
	james.qian.wang, joel, linux-imx, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, kernel,
	linux-arm-kernel, mcoquelin.stm32, bbrezillon, andrew, dri-devel,
	nicolas.ferre, yannick.fertre, kieran.bingham+renesas,
	zourongrong, shawnguo

Hi Thomas.

On Fri, May 22, 2020 at 03:52:30PM +0200, Thomas Zimmermann wrote:
> The atmel-hlcdc driver uses the default implementation for CMA functions. The
> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> All remaining operations are provided by CMA GEM object functions.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 112aa5066ceed..871293d1aeeba 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -821,16 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
> -	.gem_vm_ops = &drm_gem_cma_vm_ops,
> -	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> -	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> -	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
> -	.gem_prime_vmap = drm_gem_cma_prime_vmap,
> -	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,

> -	.gem_prime_mmap = drm_gem_cma_prime_mmap,
When using DRM_GEM_CMA_DRIVER_OPS gem_prime_mmap is set to
drm_gem_prime_mmap.
Why is this the same as drm_gem_cma_prime_mmap?

Maybe this is all obvious when you know all the CMA stuff,
but this puzzeled me.

	Sam


> -	.dumb_create = drm_gem_cma_dumb_create,
> +	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
>  	.desc = "Atmel HLCD Controller DRM",
> -- 
> 2.26.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 17:48   ` Sam Ravnborg
  2020-05-22 18:15     ` Emil Velikov
@ 2020-05-22 19:48     ` Laurent Pinchart
  2020-05-25 12:03     ` Thomas Zimmermann
  2 siblings, 0 replies; 45+ messages in thread
From: Laurent Pinchart @ 2020-05-22 19:48 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, mihail.atanassov,
	alexandre.torgue, marex, khilman, abrodkin, ludovic.desroches,
	xinliang.liu, kong.kongxinwei, tomi.valkeinen, james.qian.wang,
	joel, linux-imx, puck.chen, s.hauer, alison.wang, jsarha, wens,
	vincent.abriou, kernel, linux-arm-kernel, mcoquelin.stm32,
	bbrezillon, andrew, dri-devel, nicolas.ferre, yannick.fertre,
	kieran.bingham+renesas, Thomas Zimmermann, zourongrong, shawnguo

Hello,

On Fri, May 22, 2020 at 07:48:35PM +0200, Sam Ravnborg wrote:
> On Fri, May 22, 2020 at 03:52:26PM +0200, Thomas Zimmermann wrote:
> > Rename the macro to DRM_GEM_CMA_DRIVER_OPS to align with SHMEM
> > helpers.
>
> This part is fine, I like that the naming is somehow consistent.
> 
> > An internal version is provided for drivers that override
> > the default .dumb_create callback. Adapt drivers to the changes.
> I loathe anything named __foo or __FOO. This __ signals to me
> that the author was clueless in naming - or some sort.
> I know that __ is used in some lib headers - but thats not the case
> here.
> 
> But I love that we have a variant that takes a create function.
> So we do not have to escape from the nice macro.
> The macro is another way to tell me as rewiewer that this
> drivers uses all the default helpers for this.
> 
> 
> So critizising the name I better suggest something that
> I personally like better:
> 
> DRM_GEM_CMA_DRIVER_OPS_CREATE()
> 
> It would look like this:
> 	/* GEM Operations */
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> -	.dumb_create            = drm_sun4i_gem_dumb_create,
> +	DRM_GEM_CMA_DRIVER_OPS_CREATE(drm_sun4i_gem_dumb_create),

I agree with Sam here. With this change,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Please fix zte/zx_drm_drv.c which also uses DRM_GEM_CMA_VMAP_DRIVER_OPS.
> 
> The naming is a bikeshedding topic that we may not agree on, soo..
> 
> With zte fixed the patch is:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > ---
> >  drivers/gpu/drm/drm_gem_cma_helper.c |  2 +-
> >  drivers/gpu/drm/sun4i/sun4i_drv.c    |  3 +--
> >  drivers/gpu/drm/tidss/tidss_drv.c    |  2 +-
> >  drivers/gpu/drm/tiny/hx8357d.c       |  2 +-
> >  drivers/gpu/drm/tiny/ili9225.c       |  2 +-
> >  drivers/gpu/drm/tiny/ili9341.c       |  2 +-
> >  drivers/gpu/drm/tiny/ili9486.c       |  2 +-
> >  drivers/gpu/drm/tiny/mi0283qt.c      |  2 +-
> >  drivers/gpu/drm/tiny/repaper.c       |  2 +-
> >  drivers/gpu/drm/tiny/st7586.c        |  2 +-
> >  drivers/gpu/drm/tiny/st7735r.c       |  2 +-
> >  include/drm/drm_gem_cma_helper.h     | 24 ++++++++++++++++++++----
> >  12 files changed, 31 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> > index 12e98fb28229d..6fa4d2f2e3987 100644
> > --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> > @@ -620,7 +620,7 @@ EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs);
> >   * address set. This address is released when the object is freed.
> >   *
> >   * This function can be used as the &drm_driver.gem_prime_import_sg_table
> > - * callback. The DRM_GEM_CMA_VMAP_DRIVER_OPS() macro provides a shortcut to set
> > + * callback. The &DRM_GEM_CMA_DRIVER_OPS macro provides a shortcut to set
> >   * the necessary DRM driver operations.
> >   *
> >   * Returns:
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > index 328272ff77d84..012855fd89c24 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -52,8 +52,7 @@ static struct drm_driver sun4i_drv_driver = {
> >  	.minor			= 0,
> >  
> >  	/* GEM Operations */
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > -	.dumb_create		= drm_sun4i_gem_dumb_create,
> > +	__DRM_GEM_CMA_DRIVER_OPS(drm_sun4i_gem_dumb_create),
> >  };
> >  
> >  static int sun4i_drv_bind(struct device *dev)
> > diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> > index 99edc66ebdef2..1753cdc74ebda 100644
> > --- a/drivers/gpu/drm/tidss/tidss_drv.c
> > +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> > @@ -112,7 +112,7 @@ static struct drm_driver tidss_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &tidss_fops,
> >  	.release		= tidss_release,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.name			= "tidss",
> >  	.desc			= "TI Keystone DSS",
> >  	.date			= "20180215",
> > diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
> > index b4bc358a3269a..592da71d7ca70 100644
> > --- a/drivers/gpu/drm/tiny/hx8357d.c
> > +++ b/drivers/gpu/drm/tiny/hx8357d.c
> > @@ -196,7 +196,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
> >  static struct drm_driver hx8357d_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &hx8357d_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "hx8357d",
> >  	.desc			= "HX8357D",
> > diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
> > index d1a5ab6747d5c..368ff6c8a1efb 100644
> > --- a/drivers/gpu/drm/tiny/ili9225.c
> > +++ b/drivers/gpu/drm/tiny/ili9225.c
> > @@ -346,7 +346,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
> >  static struct drm_driver ili9225_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &ili9225_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.name			= "ili9225",
> >  	.desc			= "Ilitek ILI9225",
> >  	.date			= "20171106",
> > diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
> > index bb819f45a5d3b..e1b9043ef7a0a 100644
> > --- a/drivers/gpu/drm/tiny/ili9341.c
> > +++ b/drivers/gpu/drm/tiny/ili9341.c
> > @@ -152,7 +152,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
> >  static struct drm_driver ili9341_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &ili9341_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "ili9341",
> >  	.desc			= "Ilitek ILI9341",
> > diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
> > index 2702ea557d297..90a17f40fdf0c 100644
> > --- a/drivers/gpu/drm/tiny/ili9486.c
> > +++ b/drivers/gpu/drm/tiny/ili9486.c
> > @@ -165,7 +165,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
> >  static struct drm_driver ili9486_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &ili9486_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "ili9486",
> >  	.desc			= "Ilitek ILI9486",
> > diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
> > index 08ac549ab0f7f..6624c2098fba2 100644
> > --- a/drivers/gpu/drm/tiny/mi0283qt.c
> > +++ b/drivers/gpu/drm/tiny/mi0283qt.c
> > @@ -156,7 +156,7 @@ DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
> >  static struct drm_driver mi0283qt_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &mi0283qt_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "mi0283qt",
> >  	.desc			= "Multi-Inno MI0283QT",
> > diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> > index 1c0e7169545b4..877dcece25828 100644
> > --- a/drivers/gpu/drm/tiny/repaper.c
> > +++ b/drivers/gpu/drm/tiny/repaper.c
> > @@ -946,7 +946,7 @@ DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
> >  static struct drm_driver repaper_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &repaper_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.name			= "repaper",
> >  	.desc			= "Pervasive Displays RePaper e-ink panels",
> >  	.date			= "20170405",
> > diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
> > index 2a1fae422f7a2..ec84bdc51f60d 100644
> > --- a/drivers/gpu/drm/tiny/st7586.c
> > +++ b/drivers/gpu/drm/tiny/st7586.c
> > @@ -285,7 +285,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
> >  static struct drm_driver st7586_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &st7586_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "st7586",
> >  	.desc			= "Sitronix ST7586",
> > diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
> > index 0af1b15efdf8a..cfd4933f3b30c 100644
> > --- a/drivers/gpu/drm/tiny/st7735r.c
> > +++ b/drivers/gpu/drm/tiny/st7735r.c
> > @@ -157,7 +157,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
> >  static struct drm_driver st7735r_driver = {
> >  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >  	.fops			= &st7735r_fops,
> > -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> > +	DRM_GEM_CMA_DRIVER_OPS,
> >  	.debugfs_init		= mipi_dbi_debugfs_init,
> >  	.name			= "st7735r",
> >  	.desc			= "Sitronix ST7735R",
> > diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
> > index 947ac95eb24a9..917d42603db06 100644
> > --- a/include/drm/drm_gem_cma_helper.h
> > +++ b/include/drm/drm_gem_cma_helper.h
> > @@ -110,21 +110,37 @@ struct drm_gem_object *
> >  drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size);
> >  
> >  /**
> > - * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
> > - *                               address on the buffer
> > + * __DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a
> > + *                            virtual address on the buffer
> > + * @__dumb_create: callback function for .dumb_create
> >   *
> >   * This macro provides a shortcut for setting the default GEM operations in the
> >   * &drm_driver structure for drivers that need the virtual address also on
> >   * imported buffers.
> > + *
> > + * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that
> > + * override the default implementation of .dumb_create. Use
> > + * DRM_GEM_CMA_DRIVER_OPS if possible.
> >   */
> > -#define DRM_GEM_CMA_VMAP_DRIVER_OPS \
> > +#define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
> >  	.gem_create_object	= drm_cma_gem_create_object_default_funcs, \
> > -	.dumb_create		= drm_gem_cma_dumb_create, \
> > +	.dumb_create		= (__dumb_create), \
> >  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd, \
> >  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle, \
> >  	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
> >  	.gem_prime_mmap		= drm_gem_prime_mmap
> >  
> > +/**
> > + * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
> > + *                          address on the buffer
> > + *
> > + * This macro provides a shortcut for setting the default GEM operations in the
> > + * &drm_driver structure for drivers that need the virtual address also on
> > + * imported buffers.
> > + */
> > +#define DRM_GEM_CMA_DRIVER_OPS \
> > +	__DRM_GEM_CMA_DRIVER_OPS(drm_gem_cma_dumb_create)
> > +
> >  struct drm_gem_object *
> >  drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *drm,
> >  				       struct dma_buf_attachment *attach,

-- 
Regards,

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

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

* Re: [PATCH 15/21] drm/rcar-du: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 15/21] drm/rcar-du: " Thomas Zimmermann
@ 2020-05-22 20:12   ` Laurent Pinchart
  2020-05-25 12:49     ` Thomas Zimmermann
  0 siblings, 1 reply; 45+ messages in thread
From: Laurent Pinchart @ 2020-05-22 20:12 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, mihail.atanassov, sam,
	alexandre.torgue, marex, abrodkin, ludovic.desroches,
	xinliang.liu, kong.kongxinwei, tomi.valkeinen, james.qian.wang,
	joel, linux-imx, puck.chen, s.hauer, alison.wang, jsarha, wens,
	vincent.abriou, kernel, linux-arm-kernel, mcoquelin.stm32,
	bbrezillon, andrew, dri-devel, nicolas.ferre, yannick.fertre,
	kieran.bingham+renesas, khilman, zourongrong, shawnguo

Hi Thomas,

Thank you for the patch.

On Fri, May 22, 2020 at 03:52:40PM +0200, Thomas Zimmermann wrote:
> The rcar-du driver uses the default implementation for CMA functions;
> except for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro
> now sets these defaults and .dumb_create in struct drm_driver. All
> remaining operations are provided by CMA GEM object functions.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 3e67cf70f0402..3728038cec1d1 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -476,16 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
>  
>  static struct drm_driver rcar_du_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
> -	.gem_vm_ops		= &drm_gem_cma_vm_ops,
> -	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
> -	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
> -	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
> -	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
> -	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
> -	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
> -	.dumb_create		= rcar_du_dumb_create,
> +	__DRM_GEM_CMA_DRIVER_OPS(rcar_du_dumb_create),

Your __DRM_GEM_CMA_DRIVER_OPS is defined as

#define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
        .gem_create_object      = drm_cma_gem_create_object_default_funcs, \
        .dumb_create            = (__dumb_create), \
        .prime_handle_to_fd     = drm_gem_prime_handle_to_fd, \
        .prime_fd_to_handle     = drm_gem_prime_fd_to_handle, \
        .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
        .gem_prime_mmap         = drm_gem_prime_mmap

The patch thus introduces several changes:

- drm_gem_cma_prime_import_sg_table_vmap() is used instead of
  drm_gem_cma_prime_import_sg_table() combined with .gem_prime_vmap()
  and .gem_prime_vunmap(). I believe that's fine, but splitting that
  change in a separate commit, or at the very least explaining it in
  details in the commit message, would make review easier.

- .gem_create_object() is now set. That seems to be OK, but I'm not sure
  to grasp all the implications. This should also be explained in the
  commit message, and ideally split to a separate patch.

- drm_gem_cma_prime_mmap() is replaced with drm_gem_prime_mmap(). Same
  comments :-)

This patch hides way too many changes in what is documented as just
innocent refactoring. It seems other drivers are affected too.

>  	.fops			= &rcar_du_fops,
>  	.name			= "rcar-du",
>  	.desc			= "Renesas R-Car Display Unit",

-- 
Regards,

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

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

* Re: [PATCH 21/21] drm/zte: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
  2020-05-22 19:03   ` Sam Ravnborg
@ 2020-05-24 14:50   ` kbuild test robot
  2020-05-24 20:11   ` kbuild test robot
  2 siblings, 0 replies; 45+ messages in thread
From: kbuild test robot @ 2020-05-24 14:50 UTC (permalink / raw)
  To: Thomas Zimmermann, abrodkin, airlied, daniel, james.qian.wang,
	liviu.dudau, mihail.atanassov, brian.starkey, joel, andrew, sam,
	bbrezillon, nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: kbuild-all, linux-aspeed, dri-devel, clang-built-linux,
	Thomas Zimmermann, linux-arm-kernel


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

Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200519]
[cannot apply to sunxi/sunxi/for-next joel-aspeed/for-next shawnguo/for-next stm32/stm32-next linus/master pinchartl-media/drm/du/next v5.7-rc6 v5.7-rc5 v5.7-rc4 v5.7-rc6]
[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-most-CMA-based-drivers-to-GEM-object-functions/20200522-215754
base:    fb57b1fabcb28f358901b2df90abd2b48abc1ca8
config: arm64-randconfig-r032-20200524 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/gpu/drm/zte/zx_drm_drv.c:39:2: error: use of undeclared identifier 'DRM_GEM_CMA_VMAP_DRIVER_OPS'
DRM_GEM_CMA_VMAP_DRIVER_OPS,
^
1 error generated.

vim +/DRM_GEM_CMA_VMAP_DRIVER_OPS +39 drivers/gpu/drm/zte/zx_drm_drv.c

    36	
    37	static struct drm_driver zx_drm_driver = {
    38		.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
  > 39		DRM_GEM_CMA_VMAP_DRIVER_OPS,
    40		.fops = &zx_drm_fops,
    41		.name = "zx-vou",
    42		.desc = "ZTE VOU Controller DRM",
    43		.date = "20160811",
    44		.major = 1,
    45		.minor = 0,
    46	};
    47	

---
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: 41332 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] 45+ messages in thread

* Re: [PATCH 21/21] drm/zte: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
  2020-05-22 19:03   ` Sam Ravnborg
  2020-05-24 14:50   ` kbuild test robot
@ 2020-05-24 20:11   ` kbuild test robot
  2 siblings, 0 replies; 45+ messages in thread
From: kbuild test robot @ 2020-05-24 20:11 UTC (permalink / raw)
  To: Thomas Zimmermann, abrodkin, airlied, daniel, james.qian.wang,
	liviu.dudau, mihail.atanassov, brian.starkey, joel, andrew, sam,
	bbrezillon, nicolas.ferre, alexandre.belloni, ludovic.desroches,
	maarten.lankhorst, mripard, stefan, alison.wang, xinliang.liu,
	zourongrong, john.stultz, kong.kongxinwei, puck.chen, p.zabel,
	shawnguo, s.hauer, kernel, festevam, linux-imx, paul,
	linus.walleij, narmstrong, khilman, marex, laurent.pinchart,
	kieran.bingham+renesas, benjamin.gaignard, vincent.abriou,
	yannick.fertre, philippe.cornu, mcoquelin.stm32,
	alexandre.torgue, wens, jsarha, tomi.valkeinen, noralf
  Cc: dri-devel, linux-aspeed, kbuild-all, Thomas Zimmermann, linux-arm-kernel


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

Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200519]
[cannot apply to sunxi/sunxi/for-next joel-aspeed/for-next shawnguo/for-next stm32/stm32-next linus/master pinchartl-media/drm/du/next v5.7-rc6 v5.7-rc5 v5.7-rc4 v5.7-rc6]
[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-most-CMA-based-drivers-to-GEM-object-functions/20200522-215754
base:    fb57b1fabcb28f358901b2df90abd2b48abc1ca8
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        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
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

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

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/gpu/drm/zte/zx_drm_drv.c:39:2: error: 'DRM_GEM_CMA_VMAP_DRIVER_OPS' undeclared here (not in a function); did you mean 'DRM_GEM_CMA_DRIVER_OPS'?
39 |  DRM_GEM_CMA_VMAP_DRIVER_OPS,
|  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|  DRM_GEM_CMA_DRIVER_OPS

vim +39 drivers/gpu/drm/zte/zx_drm_drv.c

    36	
    37	static struct drm_driver zx_drm_driver = {
    38		.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
  > 39		DRM_GEM_CMA_VMAP_DRIVER_OPS,
    40		.fops = &zx_drm_fops,
    41		.name = "zx-vou",
    42		.desc = "ZTE VOU Controller DRM",
    43		.date = "20160811",
    44		.major = 1,
    45		.minor = 0,
    46	};
    47	

---
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: 74772 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] 45+ messages in thread

* Re: [PATCH 12/21] drm/mcde: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 12/21] drm/mcde: " Thomas Zimmermann
@ 2020-05-25 11:36   ` Linus Walleij
  2020-05-25 12:51     ` Thomas Zimmermann
  0 siblings, 1 reply; 45+ messages in thread
From: Linus Walleij @ 2020-05-25 11:36 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Alexandre Belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre TORGUE, Marek Vasut,
	abrodkin, Ludovic Desroches, Xinliang Liu, k00278426,
	Tomi Valkeinen, james.qian.wang, Joel Stanley, NXP Linux Team,
	Chenfeng (puck),
	Sascha Hauer, Alison Wang, Jyri Sarha, Chen-Yu Tsai,
	Vincent Abriou, Sascha Hauer, Linux ARM, Maxime Coquelin,
	Boris Brezillon, Andrew Jeffery, open list:DRM PANEL DRIVERS,
	Nicolas Ferre, Yannick Fertre, Kieran Bingham, Kevin Hilman,
	Rongrong Zou, Shawn Guo

On Fri, May 22, 2020 at 3:52 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:

> The mcde driver uses the default implementation for CMA functions. The
> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> All remaining operations are provided by CMA GEM object functions.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

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

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

* Re: [PATCH 20/21] drm/tv200: Use GEM CMA object functions
  2020-05-22 13:52 ` [PATCH 20/21] drm/tv200: " Thomas Zimmermann
@ 2020-05-25 11:36   ` Linus Walleij
  0 siblings, 0 replies; 45+ messages in thread
From: Linus Walleij @ 2020-05-25 11:36 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Alexandre Belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre TORGUE, Marek Vasut,
	abrodkin, Ludovic Desroches, Xinliang Liu, k00278426,
	Tomi Valkeinen, james.qian.wang, Joel Stanley, NXP Linux Team,
	Chenfeng (puck),
	Sascha Hauer, Alison Wang, Jyri Sarha, Chen-Yu Tsai,
	Vincent Abriou, Sascha Hauer, Linux ARM, Maxime Coquelin,
	Boris Brezillon, Andrew Jeffery, open list:DRM PANEL DRIVERS,
	Nicolas Ferre, Yannick Fertre, Kieran Bingham, Kevin Hilman,
	Rongrong Zou, Shawn Guo

On Fri, May 22, 2020 at 3:53 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:

> The tve200 driver uses the default implementation for CMA functions. The
> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> All remaining operations are provided by CMA GEM object functions.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

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

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

* Re: [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
  2020-05-22 17:48   ` Sam Ravnborg
  2020-05-22 18:15     ` Emil Velikov
  2020-05-22 19:48     ` Laurent Pinchart
@ 2020-05-25 12:03     ` Thomas Zimmermann
  2 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:03 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, dri-devel, nicolas.ferre, paul, laurent.pinchart,
	mihail.atanassov, marex, khilman, abrodkin, kong.kongxinwei,
	xinliang.liu, ludovic.desroches, tomi.valkeinen, james.qian.wang,
	linux-imx, joel, alexandre.torgue, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, linux-arm-kernel,
	mcoquelin.stm32, bbrezillon, andrew, philippe.cornu,
	yannick.fertre, kieran.bingham+renesas, kernel, zourongrong,
	shawnguo

[-- Attachment #1.1.1: Type: text/plain, Size: 12225 bytes --]

Hi Sam

Am 22.05.20 um 19:48 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Fri, May 22, 2020 at 03:52:26PM +0200, Thomas Zimmermann wrote:
>> Rename the macro to DRM_GEM_CMA_DRIVER_OPS to align with SHMEM
>> helpers.
> This part is fine, I like that the naming is somehow consistent.
> 
>> An internal version is provided for drivers that override
>> the default .dumb_create callback. Adapt drivers to the changes.
> I loathe anything named __foo or __FOO. This __ signals to me
> that the author was clueless in naming - or some sort.
> I know that __ is used in some lib headers - but thats not the case
> here.

I agree with your comment and I've been trying to find a better name
before posting the patchset. I considered something like
DRM_GEM_CMA_DRIVER_OPS_INTERNAL(), but wasn't happy with that either. In
the end, I uses the double underscore to push driver authors towards the
other macro. This one's only for the special case of settings a separate
implementation for .dumb_create().

> 
> But I love that we have a variant that takes a create function.
> So we do not have to escape from the nice macro.
> The macro is another way to tell me as rewiewer that this
> drivers uses all the default helpers for this.
> 
> 
> So critizising the name I better suggest something that
> I personally like better:
> 
> DRM_GEM_CMA_DRIVER_OPS_CREATE()

Can we at least use DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE ? Because
there's also gem_object_create.

I'll update the patches accordingly.

I noticed that most of the affected drivers do some kind of alignment
calculation in their dumb_create code. IMHO in the long run, we should
move such calculations into the default implementation and put the
control paramters into struct drm_mode_config.

Best regards
Thomas

> 
> It would look like this:
> 	/* GEM Operations */
> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
> -	.dumb_create            = drm_sun4i_gem_dumb_create,
> +	DRM_GEM_CMA_DRIVER_OPS_CREATE(drm_sun4i_gem_dumb_create),
> 
> 
> 
> Please fix zte/zx_drm_drv.c which also uses DRM_GEM_CMA_VMAP_DRIVER_OPS.
> 
> 
> The naming is a bikeshedding topic that we may not agree on, soo..
> 
> With zte fixed the patch is:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 	Sam
> 
> 
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/drm_gem_cma_helper.c |  2 +-
>>  drivers/gpu/drm/sun4i/sun4i_drv.c    |  3 +--
>>  drivers/gpu/drm/tidss/tidss_drv.c    |  2 +-
>>  drivers/gpu/drm/tiny/hx8357d.c       |  2 +-
>>  drivers/gpu/drm/tiny/ili9225.c       |  2 +-
>>  drivers/gpu/drm/tiny/ili9341.c       |  2 +-
>>  drivers/gpu/drm/tiny/ili9486.c       |  2 +-
>>  drivers/gpu/drm/tiny/mi0283qt.c      |  2 +-
>>  drivers/gpu/drm/tiny/repaper.c       |  2 +-
>>  drivers/gpu/drm/tiny/st7586.c        |  2 +-
>>  drivers/gpu/drm/tiny/st7735r.c       |  2 +-
>>  include/drm/drm_gem_cma_helper.h     | 24 ++++++++++++++++++++----
>>  12 files changed, 31 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
>> index 12e98fb28229d..6fa4d2f2e3987 100644
>> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
>> @@ -620,7 +620,7 @@ EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs);
>>   * address set. This address is released when the object is freed.
>>   *
>>   * This function can be used as the &drm_driver.gem_prime_import_sg_table
>> - * callback. The DRM_GEM_CMA_VMAP_DRIVER_OPS() macro provides a shortcut to set
>> + * callback. The &DRM_GEM_CMA_DRIVER_OPS macro provides a shortcut to set
>>   * the necessary DRM driver operations.
>>   *
>>   * Returns:
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> index 328272ff77d84..012855fd89c24 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
>> @@ -52,8 +52,7 @@ static struct drm_driver sun4i_drv_driver = {
>>  	.minor			= 0,
>>  
>>  	/* GEM Operations */
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> -	.dumb_create		= drm_sun4i_gem_dumb_create,
>> +	__DRM_GEM_CMA_DRIVER_OPS(drm_sun4i_gem_dumb_create),
>>  };
>>  
>>  static int sun4i_drv_bind(struct device *dev)
>> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
>> index 99edc66ebdef2..1753cdc74ebda 100644
>> --- a/drivers/gpu/drm/tidss/tidss_drv.c
>> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
>> @@ -112,7 +112,7 @@ static struct drm_driver tidss_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &tidss_fops,
>>  	.release		= tidss_release,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.name			= "tidss",
>>  	.desc			= "TI Keystone DSS",
>>  	.date			= "20180215",
>> diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
>> index b4bc358a3269a..592da71d7ca70 100644
>> --- a/drivers/gpu/drm/tiny/hx8357d.c
>> +++ b/drivers/gpu/drm/tiny/hx8357d.c
>> @@ -196,7 +196,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
>>  static struct drm_driver hx8357d_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &hx8357d_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "hx8357d",
>>  	.desc			= "HX8357D",
>> diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
>> index d1a5ab6747d5c..368ff6c8a1efb 100644
>> --- a/drivers/gpu/drm/tiny/ili9225.c
>> +++ b/drivers/gpu/drm/tiny/ili9225.c
>> @@ -346,7 +346,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
>>  static struct drm_driver ili9225_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &ili9225_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.name			= "ili9225",
>>  	.desc			= "Ilitek ILI9225",
>>  	.date			= "20171106",
>> diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
>> index bb819f45a5d3b..e1b9043ef7a0a 100644
>> --- a/drivers/gpu/drm/tiny/ili9341.c
>> +++ b/drivers/gpu/drm/tiny/ili9341.c
>> @@ -152,7 +152,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
>>  static struct drm_driver ili9341_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &ili9341_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "ili9341",
>>  	.desc			= "Ilitek ILI9341",
>> diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
>> index 2702ea557d297..90a17f40fdf0c 100644
>> --- a/drivers/gpu/drm/tiny/ili9486.c
>> +++ b/drivers/gpu/drm/tiny/ili9486.c
>> @@ -165,7 +165,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
>>  static struct drm_driver ili9486_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &ili9486_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "ili9486",
>>  	.desc			= "Ilitek ILI9486",
>> diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
>> index 08ac549ab0f7f..6624c2098fba2 100644
>> --- a/drivers/gpu/drm/tiny/mi0283qt.c
>> +++ b/drivers/gpu/drm/tiny/mi0283qt.c
>> @@ -156,7 +156,7 @@ DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
>>  static struct drm_driver mi0283qt_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &mi0283qt_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "mi0283qt",
>>  	.desc			= "Multi-Inno MI0283QT",
>> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
>> index 1c0e7169545b4..877dcece25828 100644
>> --- a/drivers/gpu/drm/tiny/repaper.c
>> +++ b/drivers/gpu/drm/tiny/repaper.c
>> @@ -946,7 +946,7 @@ DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
>>  static struct drm_driver repaper_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &repaper_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.name			= "repaper",
>>  	.desc			= "Pervasive Displays RePaper e-ink panels",
>>  	.date			= "20170405",
>> diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
>> index 2a1fae422f7a2..ec84bdc51f60d 100644
>> --- a/drivers/gpu/drm/tiny/st7586.c
>> +++ b/drivers/gpu/drm/tiny/st7586.c
>> @@ -285,7 +285,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
>>  static struct drm_driver st7586_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &st7586_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "st7586",
>>  	.desc			= "Sitronix ST7586",
>> diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
>> index 0af1b15efdf8a..cfd4933f3b30c 100644
>> --- a/drivers/gpu/drm/tiny/st7735r.c
>> +++ b/drivers/gpu/drm/tiny/st7735r.c
>> @@ -157,7 +157,7 @@ DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
>>  static struct drm_driver st7735r_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>  	.fops			= &st7735r_fops,
>> -	DRM_GEM_CMA_VMAP_DRIVER_OPS,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.debugfs_init		= mipi_dbi_debugfs_init,
>>  	.name			= "st7735r",
>>  	.desc			= "Sitronix ST7735R",
>> diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
>> index 947ac95eb24a9..917d42603db06 100644
>> --- a/include/drm/drm_gem_cma_helper.h
>> +++ b/include/drm/drm_gem_cma_helper.h
>> @@ -110,21 +110,37 @@ struct drm_gem_object *
>>  drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size);
>>  
>>  /**
>> - * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
>> - *                               address on the buffer
>> + * __DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a
>> + *                            virtual address on the buffer
>> + * @__dumb_create: callback function for .dumb_create
>>   *
>>   * This macro provides a shortcut for setting the default GEM operations in the
>>   * &drm_driver structure for drivers that need the virtual address also on
>>   * imported buffers.
>> + *
>> + * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that
>> + * override the default implementation of .dumb_create. Use
>> + * DRM_GEM_CMA_DRIVER_OPS if possible.
>>   */
>> -#define DRM_GEM_CMA_VMAP_DRIVER_OPS \
>> +#define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
>>  	.gem_create_object	= drm_cma_gem_create_object_default_funcs, \
>> -	.dumb_create		= drm_gem_cma_dumb_create, \
>> +	.dumb_create		= (__dumb_create), \
>>  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd, \
>>  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle, \
>>  	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
>>  	.gem_prime_mmap		= drm_gem_prime_mmap
>>  
>> +/**
>> + * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations ensuring a virtual
>> + *                          address on the buffer
>> + *
>> + * This macro provides a shortcut for setting the default GEM operations in the
>> + * &drm_driver structure for drivers that need the virtual address also on
>> + * imported buffers.
>> + */
>> +#define DRM_GEM_CMA_DRIVER_OPS \
>> +	__DRM_GEM_CMA_DRIVER_OPS(drm_gem_cma_dumb_create)
>> +
>>  struct drm_gem_object *
>>  drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *drm,
>>  				       struct dma_buf_attachment *attach,
>> -- 
>> 2.26.2
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions
  2020-05-22 18:08   ` Sam Ravnborg
@ 2020-05-25 12:10     ` Thomas Zimmermann
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:10 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, dri-devel, nicolas.ferre, paul, laurent.pinchart,
	mihail.atanassov, marex, khilman, abrodkin, kong.kongxinwei,
	xinliang.liu, ludovic.desroches, tomi.valkeinen, james.qian.wang,
	linux-imx, joel, alexandre.torgue, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, linux-arm-kernel,
	mcoquelin.stm32, bbrezillon, andrew, philippe.cornu,
	yannick.fertre, kieran.bingham+renesas, kernel, zourongrong,
	shawnguo

[-- Attachment #1.1.1: Type: text/plain, Size: 3182 bytes --]

Hi

Am 22.05.20 um 20:08 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Fri, May 22, 2020 at 03:52:30PM +0200, Thomas Zimmermann wrote:
>> The atmel-hlcdc driver uses the default implementation for CMA functions. The
>> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
>> All remaining operations are provided by CMA GEM object functions.
> 
> A nice side-effect of introducing the defualt implementation
> of CMA functions is that this driver is now migrated over to use
> drm_gem_object_funcs, which is why we can replace all these
> helpers with a simple macro that defined only 6 helpers.
> 
> With an improved changelog:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> And as I said in the other mail, this is really nice.
> It is now much more obvious that this drivers uses
> all the default helpers for CMA.
> 
> And I can drop one item from my TODO list on top of that.

There's still more to do. The current macro still sets
.gem_object_create to a CMA default. But that pointer is the interface
where drivers can override some of the CMA object defaults, so it should
not be set by CMA helpers.

After the other CMA drivers have been converted to GEM object functions,
this setting can be kept to zero and __drm_gem_cma_create() can set the
default object functions. SHMEM and VRAM helpers already work this way.

Best regards
Thomas

> 
> 	Sam
> 
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 11 +----------
>>  1 file changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index 112aa5066ceed..871293d1aeeba 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -821,16 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
>> -	.gem_vm_ops = &drm_gem_cma_vm_ops,
>> -	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>> -	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>> -	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>> -	.gem_prime_vmap = drm_gem_cma_prime_vmap,
>> -	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
>> -	.gem_prime_mmap = drm_gem_cma_prime_mmap,
>> -	.dumb_create = drm_gem_cma_dumb_create,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.fops = &fops,
>>  	.name = "atmel-hlcdc",
>>  	.desc = "Atmel HLCD Controller DRM",
>> -- 
>> 2.26.2
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions
  2020-05-22 19:25   ` Sam Ravnborg
@ 2020-05-25 12:37     ` Thomas Zimmermann
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:37 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, philippe.cornu, paul, laurent.pinchart,
	mihail.atanassov, alexandre.torgue, marex, khilman, abrodkin,
	ludovic.desroches, xinliang.liu, kong.kongxinwei, tomi.valkeinen,
	james.qian.wang, joel, linux-imx, puck.chen, s.hauer,
	alison.wang, jsarha, wens, vincent.abriou, kernel,
	linux-arm-kernel, mcoquelin.stm32, bbrezillon, andrew, dri-devel,
	nicolas.ferre, yannick.fertre, kieran.bingham+renesas,
	zourongrong, shawnguo

[-- Attachment #1.1.1: Type: text/plain, Size: 2513 bytes --]

Hi

Am 22.05.20 um 21:25 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Fri, May 22, 2020 at 03:52:30PM +0200, Thomas Zimmermann wrote:
>> The atmel-hlcdc driver uses the default implementation for CMA functions. The
>> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
>> All remaining operations are provided by CMA GEM object functions.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 11 +----------
>>  1 file changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index 112aa5066ceed..871293d1aeeba 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -821,16 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
>> -	.gem_vm_ops = &drm_gem_cma_vm_ops,
>> -	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>> -	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>> -	.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
>> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>> -	.gem_prime_vmap = drm_gem_cma_prime_vmap,
>> -	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
> 
>> -	.gem_prime_mmap = drm_gem_cma_prime_mmap,
> When using DRM_GEM_CMA_DRIVER_OPS gem_prime_mmap is set to
> drm_gem_prime_mmap.
> Why is this the same as drm_gem_cma_prime_mmap?
> 
> Maybe this is all obvious when you know all the CMA stuff,
> but this puzzeled me.

Following through the calls is far from easy.

I took the macro from the aspeed driver. I had some doubts about the
mmap code, but expected the driver to be working correctly. Maybe we
should set that field to drm_gem_cma_prime_mmap or implement the mmap
object function.

Best regards
Thomas



> 
> 	Sam
> 
> 
>> -	.dumb_create = drm_gem_cma_dumb_create,
>> +	DRM_GEM_CMA_DRIVER_OPS,
>>  	.fops = &fops,
>>  	.name = "atmel-hlcdc",
>>  	.desc = "Atmel HLCD Controller DRM",
>> -- 
>> 2.26.2

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 07/21] drm/hisilicon/kirin: Use GEM CMA object functions
  2020-05-22 18:11   ` Emil Velikov
@ 2020-05-25 12:41     ` Thomas Zimmermann
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:41 UTC (permalink / raw)
  To: Emil Velikov
  Cc: alexandre.belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, ML dri-devel, nicolas.ferre, Paul Cercueil,
	Laurent Pinchart, Mihail Atanassov, Sam Ravnborg,
	Marek Vašut, khilman, Alexey Brodkin, Xinwei Kong,
	Xinliang Liu, ludovic.desroches, Tomi Valkeinen,
	james qian wang (Arm Technology China),
	NXP Linux Team, joel, Alexandre Torgue, Chen Feng, Sascha Hauer,
	Alison Wang, Jyri Sarha, Chen-Yu Tsai, Vincent Abriou, LAKML,
	Maxime Coquelin, bbrezillon, andrew, Philippe Cornu,
	Yannick Fertre, Kieran Bingham, Sascha Hauer, Rongrong Zou,
	Shawn Guo

[-- Attachment #1.1.1: Type: text/plain, Size: 2335 bytes --]

Hi Emil

Am 22.05.20 um 20:11 schrieb Emil Velikov:
> Hi Thomas,
> 
> On Fri, 22 May 2020 at 14:53, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> The kirin driver uses the default implementation for CMA functions; except
>> for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets
>> these defaults and .dumb_create in struct drm_driver. All remaining
>> operations are provided by CMA GEM object functions.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +-----------
>>  1 file changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> index c339e632522a9..b1ffd7d43e562 100644
>> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
>> @@ -921,17 +921,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
>>  static struct drm_driver ade_driver = {
>>         .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>         .fops = &ade_fops,
>> -       .gem_free_object_unlocked = drm_gem_cma_free_object,
>> -       .gem_vm_ops = &drm_gem_cma_vm_ops,
>> -       .dumb_create = drm_gem_cma_dumb_create_internal,
> 
> This doesn't seem right. The _internal documentation explicitly says
> that this should _not_ be used as .dumb_create. Instead drivers should
> use it to implement their callback.
> 
> Since it yields the same result as drm_gem_cma_dumb_create we can use
> the default macro below.

I noticed this and thought that the driver authors probably had their
reasons. Changing the driver to the default macro is probably still a
good idea.

Best regards
Thomas

> 
> Weather to the .dumb_create in separate patch, or squash it here -
> I'll leave to you.
> In case of the latter, please mentioned it in the commit message.
> 
> -Emil
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 15/21] drm/rcar-du: Use GEM CMA object functions
  2020-05-22 20:12   ` Laurent Pinchart
@ 2020-05-25 12:49     ` Thomas Zimmermann
  2020-05-25 15:38       ` Kieran Bingham
  0 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:49 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, dri-devel, nicolas.ferre, paul, mihail.atanassov,
	sam, marex, khilman, abrodkin, kong.kongxinwei, xinliang.liu,
	ludovic.desroches, tomi.valkeinen, james.qian.wang, joel,
	linux-imx, alexandre.torgue, puck.chen, s.hauer, alison.wang,
	jsarha, wens, vincent.abriou, linux-arm-kernel, mcoquelin.stm32,
	bbrezillon, andrew, philippe.cornu, yannick.fertre,
	kieran.bingham+renesas, kernel, zourongrong, shawnguo

[-- Attachment #1.1.1: Type: text/plain, Size: 3887 bytes --]

Hi

Am 22.05.20 um 22:12 schrieb Laurent Pinchart:
> Hi Thomas,
> 
> Thank you for the patch.
> 
> On Fri, May 22, 2020 at 03:52:40PM +0200, Thomas Zimmermann wrote:
>> The rcar-du driver uses the default implementation for CMA functions;
>> except for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro
>> now sets these defaults and .dumb_create in struct drm_driver. All
>> remaining operations are provided by CMA GEM object functions.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 11 +----------
>>  1 file changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> index 3e67cf70f0402..3728038cec1d1 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> @@ -476,16 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
>>  
>>  static struct drm_driver rcar_du_driver = {
>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
>> -	.gem_vm_ops		= &drm_gem_cma_vm_ops,
>> -	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
>> -	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
>> -	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
>> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>> -	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
>> -	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
>> -	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
>> -	.dumb_create		= rcar_du_dumb_create,
>> +	__DRM_GEM_CMA_DRIVER_OPS(rcar_du_dumb_create),
> 
> Your __DRM_GEM_CMA_DRIVER_OPS is defined as
> 
> #define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
>         .gem_create_object      = drm_cma_gem_create_object_default_funcs, \
>         .dumb_create            = (__dumb_create), \
>         .prime_handle_to_fd     = drm_gem_prime_handle_to_fd, \
>         .prime_fd_to_handle     = drm_gem_prime_fd_to_handle, \
>         .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
>         .gem_prime_mmap         = drm_gem_prime_mmap
> 
> The patch thus introduces several changes:
> 
> - drm_gem_cma_prime_import_sg_table_vmap() is used instead of
>   drm_gem_cma_prime_import_sg_table() combined with .gem_prime_vmap()
>   and .gem_prime_vunmap(). I believe that's fine, but splitting that
>   change in a separate commit, or at the very least explaining it in
>   details in the commit message, would make review easier.
> 
> - .gem_create_object() is now set. That seems to be OK, but I'm not sure
>   to grasp all the implications. This should also be explained in the
>   commit message, and ideally split to a separate patch.

That's relevant during object creation and sets the object functions.
See one of my other replies for how this can go away after all CMA
drivers have been updated to GEM object functions.


> 
> - drm_gem_cma_prime_mmap() is replaced with drm_gem_prime_mmap(). Same
>   comments :-)

I relied on the aspeed driver to be correct. After Sam's comment on
that, I read the code once again several times. The original
implementation clears VM_PFNMAP. And I cannot find that code any longer.
Going back to the original function might be better.


> 
> This patch hides way too many changes in what is documented as just
> innocent refactoring. It seems other drivers are affected too.

Could you test the patchset? I don't have the HW.

Best regards
Thomas

> 
>>  	.fops			= &rcar_du_fops,
>>  	.name			= "rcar-du",
>>  	.desc			= "Renesas R-Car Display Unit",
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 12/21] drm/mcde: Use GEM CMA object functions
  2020-05-25 11:36   ` Linus Walleij
@ 2020-05-25 12:51     ` Thomas Zimmermann
  2020-05-25 13:08       ` Linus Walleij
  0 siblings, 1 reply; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 12:51 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre TORGUE, Marek Vasut,
	abrodkin, Ludovic Desroches, Xinliang Liu, k00278426,
	Tomi Valkeinen, james.qian.wang, Joel Stanley, NXP Linux Team,
	Chenfeng (puck),
	Sascha Hauer, Alison Wang, Jyri Sarha, Chen-Yu Tsai,
	Vincent Abriou, Sascha Hauer, Linux ARM, Maxime Coquelin,
	Boris Brezillon, Andrew Jeffery, open list:DRM PANEL DRIVERS,
	Nicolas Ferre, Yannick Fertre, Kieran Bingham, Kevin Hilman,
	Rongrong Zou, Shawn Guo

[-- Attachment #1.1.1: Type: text/plain, Size: 797 bytes --]

Hi

Am 25.05.20 um 13:36 schrieb Linus Walleij:
> On Fri, May 22, 2020 at 3:52 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> 
>> The mcde driver uses the default implementation for CMA functions. The
>> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
>> All remaining operations are provided by CMA GEM object functions.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Could you boot-test with the patchset applied?

Best regards
Thomas

> 
> Yours,
> Linus Walleij
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 12/21] drm/mcde: Use GEM CMA object functions
  2020-05-25 12:51     ` Thomas Zimmermann
@ 2020-05-25 13:08       ` Linus Walleij
  2020-05-25 13:27         ` Thomas Zimmermann
  0 siblings, 1 reply; 45+ messages in thread
From: Linus Walleij @ 2020-05-25 13:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Alexandre Belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, Philippe Cornu, Paul Cercueil, Laurent Pinchart,
	Mihail Atanassov, Sam Ravnborg, Alexandre TORGUE, Marek Vasut,
	abrodkin, Ludovic Desroches, Xinliang Liu, k00278426,
	Tomi Valkeinen, james.qian.wang, Joel Stanley, NXP Linux Team,
	Chenfeng (puck),
	Sascha Hauer, Alison Wang, Jyri Sarha, Chen-Yu Tsai,
	Vincent Abriou, Sascha Hauer, Linux ARM, Maxime Coquelin,
	Boris Brezillon, Andrew Jeffery, open list:DRM PANEL DRIVERS,
	Nicolas Ferre, Yannick Fertre, Kieran Bingham, Kevin Hilman,
	Rongrong Zou, Shawn Guo

On Mon, May 25, 2020 at 2:51 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Am 25.05.20 um 13:36 schrieb Linus Walleij:
> > On Fri, May 22, 2020 at 3:52 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >
> >> The mcde driver uses the default implementation for CMA functions. The
> >> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
> >> All remaining operations are provided by CMA GEM object functions.
> >>
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Could you boot-test with the patchset applied?

Yes, if you have a git branch I can just build and boot I can
do it quickly!

I have no idea what this patch set is based on so it could be
hard to figure out the dependencies otherwise. Also many
patches.

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

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

* Re: [PATCH 12/21] drm/mcde: Use GEM CMA object functions
  2020-05-25 13:08       ` Linus Walleij
@ 2020-05-25 13:27         ` Thomas Zimmermann
  0 siblings, 0 replies; 45+ messages in thread
From: Thomas Zimmermann @ 2020-05-25 13:27 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Belloni, linux-aspeed, Neil Armstrong, Dave Airlie,
	Liviu Dudau, open list:DRM PANEL DRIVERS, Nicolas Ferre,
	Paul Cercueil, Laurent Pinchart, Mihail Atanassov, Sam Ravnborg,
	Marek Vasut, Kevin Hilman, abrodkin, k00278426, Xinliang Liu,
	Ludovic Desroches, Tomi Valkeinen, james.qian.wang,
	NXP Linux Team, Joel Stanley, Alexandre TORGUE, Chenfeng (puck),
	Sascha Hauer, Alison Wang, Jyri Sarha, Chen-Yu Tsai,
	Vincent Abriou, Linux ARM, Maxime Coquelin, Boris Brezillon,
	Andrew Jeffery, Philippe Cornu, Yannick Fertre, Kieran Bingham,
	Sascha Hauer, Rongrong Zou, Shawn Guo

[-- Attachment #1.1.1: Type: text/plain, Size: 1551 bytes --]

Hi

Am 25.05.20 um 15:08 schrieb Linus Walleij:
> On Mon, May 25, 2020 at 2:51 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Am 25.05.20 um 13:36 schrieb Linus Walleij:
>>> On Fri, May 22, 2020 at 3:52 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>
>>>> The mcde driver uses the default implementation for CMA functions. The
>>>> DRM_GEM_CMA_DRIVER_OPS macro now sets these defaults in struct drm_driver.
>>>> All remaining operations are provided by CMA GEM object functions.
>>>>
>>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>>
>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> Could you boot-test with the patchset applied?
> 
> Yes, if you have a git branch I can just build and boot I can
> do it quickly!

Fantastic! It's the cma-objfuncs branch of

 https://gitlab.freedesktop.org/tzimmermann/linux.git

Here's the gitlab page:

 https://gitlab.freedesktop.org/tzimmermann/linux/-/tree/cma-objfuncs

Best regards
Thomas

> 
> I have no idea what this patch set is based on so it could be
> hard to figure out the dependencies otherwise. Also many
> patches.
> 
> Yours,
> Linus Walleij
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: 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] 45+ messages in thread

* Re: [PATCH 15/21] drm/rcar-du: Use GEM CMA object functions
  2020-05-25 12:49     ` Thomas Zimmermann
@ 2020-05-25 15:38       ` Kieran Bingham
  0 siblings, 0 replies; 45+ messages in thread
From: Kieran Bingham @ 2020-05-25 15:38 UTC (permalink / raw)
  To: Thomas Zimmermann, Laurent Pinchart
  Cc: alexandre.belloni, linux-aspeed, narmstrong, airlied,
	liviu.dudau, dri-devel, nicolas.ferre, paul, mihail.atanassov,
	sam, marex, khilman, abrodkin, kong.kongxinwei, xinliang.liu,
	ludovic.desroches, tomi.valkeinen, james.qian.wang, joel,
	linux-imx, alexandre.torgue, puck.chen, s.hauer, alison.wang,
	jsarha, wens, vincent.abriou, linux-arm-kernel, mcoquelin.stm32,
	bbrezillon, andrew, philippe.cornu, yannick.fertre, kernel,
	zourongrong, shawnguo

On 25/05/2020 13:49, Thomas Zimmermann wrote:
> Hi
> 
> Am 22.05.20 um 22:12 schrieb Laurent Pinchart:
>> Hi Thomas,
>>
>> Thank you for the patch.
>>
>> On Fri, May 22, 2020 at 03:52:40PM +0200, Thomas Zimmermann wrote:
>>> The rcar-du driver uses the default implementation for CMA functions;
>>> except for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro
>>> now sets these defaults and .dumb_create in struct drm_driver. All
>>> remaining operations are provided by CMA GEM object functions.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 11 +----------
>>>  1 file changed, 1 insertion(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>>> index 3e67cf70f0402..3728038cec1d1 100644
>>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>>> @@ -476,16 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
>>>  
>>>  static struct drm_driver rcar_du_driver = {
>>>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>>> -	.gem_free_object_unlocked = drm_gem_cma_free_object,
>>> -	.gem_vm_ops		= &drm_gem_cma_vm_ops,
>>> -	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
>>> -	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
>>> -	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,
>>> -	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
>>> -	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
>>> -	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
>>> -	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
>>> -	.dumb_create		= rcar_du_dumb_create,
>>> +	__DRM_GEM_CMA_DRIVER_OPS(rcar_du_dumb_create),
>>
>> Your __DRM_GEM_CMA_DRIVER_OPS is defined as
>>
>> #define __DRM_GEM_CMA_DRIVER_OPS(__dumb_create) \
>>         .gem_create_object      = drm_cma_gem_create_object_default_funcs, \
>>         .dumb_create            = (__dumb_create), \
>>         .prime_handle_to_fd     = drm_gem_prime_handle_to_fd, \
>>         .prime_fd_to_handle     = drm_gem_prime_fd_to_handle, \
>>         .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table_vmap, \
>>         .gem_prime_mmap         = drm_gem_prime_mmap
>>
>> The patch thus introduces several changes:
>>
>> - drm_gem_cma_prime_import_sg_table_vmap() is used instead of
>>   drm_gem_cma_prime_import_sg_table() combined with .gem_prime_vmap()
>>   and .gem_prime_vunmap(). I believe that's fine, but splitting that
>>   change in a separate commit, or at the very least explaining it in
>>   details in the commit message, would make review easier.
>>
>> - .gem_create_object() is now set. That seems to be OK, but I'm not sure
>>   to grasp all the implications. This should also be explained in the
>>   commit message, and ideally split to a separate patch.
> 
> That's relevant during object creation and sets the object functions.
> See one of my other replies for how this can go away after all CMA
> drivers have been updated to GEM object functions.
> 
> 
>>
>> - drm_gem_cma_prime_mmap() is replaced with drm_gem_prime_mmap(). Same
>>   comments :-)
> 
> I relied on the aspeed driver to be correct. After Sam's comment on
> that, I read the code once again several times. The original
> implementation clears VM_PFNMAP. And I cannot find that code any longer.
> Going back to the original function might be better.
> 
> 
>>
>> This patch hides way too many changes in what is documented as just
>> innocent refactoring. It seems other drivers are affected too.
> 
> Could you test the patchset? I don't have the HW.

Digging out the branch you provided elsewhere in this thread:

>>> Could you boot-test with the patchset applied?
>>
>> Yes, if you have a git branch I can just build and boot I can
>> do it quickly!
>
> Fantastic! It's the cma-objfuncs branch of
>
> https://gitlab.freedesktop.org/tzimmermann/linux.git

I have successfully run our display tests with your patches here on an
R-Car H3 Salvator-XS(-es2).

Tested-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>



> Best regards
> Thomas
> 
>>
>>>  	.fops			= &rcar_du_fops,
>>>  	.name			= "rcar-du",
>>>  	.desc			= "Renesas R-Car Display Unit",
>>
> 

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

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

end of thread, back to index

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 13:52 [PATCH 00/21] drm: Convert most CMA-based drivers to GEM object functions Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 01/21] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro Thomas Zimmermann
2020-05-22 17:48   ` Sam Ravnborg
2020-05-22 18:15     ` Emil Velikov
2020-05-22 18:45       ` Sam Ravnborg
2020-05-22 19:48     ` Laurent Pinchart
2020-05-25 12:03     ` Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 02/21] drm/arc: Use GEM CMA object functions Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 03/21] drm/arm: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 04/21] drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 05/21] drm/atmel-hlcdc: Use GEM CMA object functions Thomas Zimmermann
2020-05-22 18:08   ` Sam Ravnborg
2020-05-25 12:10     ` Thomas Zimmermann
2020-05-22 19:25   ` Sam Ravnborg
2020-05-25 12:37     ` Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 06/21] drm/fsl-dcu: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 07/21] drm/hisilicon/kirin: " Thomas Zimmermann
2020-05-22 18:11   ` Emil Velikov
2020-05-25 12:41     ` Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 08/21] drm/imx: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 09/21] drm/ingenic: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 10/21] drm/komeda: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 11/21] drm/malidp: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 12/21] drm/mcde: " Thomas Zimmermann
2020-05-25 11:36   ` Linus Walleij
2020-05-25 12:51     ` Thomas Zimmermann
2020-05-25 13:08       ` Linus Walleij
2020-05-25 13:27         ` Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 13/21] drm/meson: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 14/21] drm/mxsfb: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 15/21] drm/rcar-du: " Thomas Zimmermann
2020-05-22 20:12   ` Laurent Pinchart
2020-05-25 12:49     ` Thomas Zimmermann
2020-05-25 15:38       ` Kieran Bingham
2020-05-22 13:52 ` [PATCH 16/21] drm/shmobile: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 17/21] drm/stm: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 18/21] drm/sti: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 19/21] drm/tilcdc: " Thomas Zimmermann
2020-05-22 13:52 ` [PATCH 20/21] drm/tv200: " Thomas Zimmermann
2020-05-25 11:36   ` Linus Walleij
2020-05-22 13:52 ` [PATCH 21/21] drm/zte: " Thomas Zimmermann
2020-05-22 19:03   ` Sam Ravnborg
2020-05-24 14:50   ` kbuild test robot
2020-05-24 20:11   ` kbuild test robot
2020-05-22 18:19 ` [PATCH 00/21] drm: Convert most CMA-based drivers to GEM " Emil Velikov

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git