All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions
@ 2017-11-04 13:03 Noralf Trønnes
  2017-11-04 13:03 ` [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional Noralf Trønnes
                   ` (22 more replies)
  0 siblings, 23 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

This patchset adds drm_fb_cma_fbdev_init/fini() functions that replaces
drm_fbdev_cma_init/fini(). The reason for doing so is to get rid of
struct drm_fbdev_cma and it's wrapper functions. The final piece will
happen when tinydrm moves away from the cma helper and we can remove the
struct.

Note:
Patches 19-22 depends on patchset:
drm/: Add simple modeset suspend/resume helpers

Noralf.

Noralf Trønnes (22):
  drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
  drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
  drm/arc: Use drm_fb_cma_fbdev_init/fini()
  drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
  drm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()
  drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini()
  drm/imx: Use drm_fb_cma_fbdev_init/fini()
  drm/meson: Use drm_fb_cma_fbdev_init/fini()
  drm/mxsfb: Use drm_fb_cma_fbdev_init/fini()
  drm/pl111: Use drm_fb_cma_fbdev_init/fini()
  drm/rcar-du: Use drm_fb_cma_fbdev_init/fini()
  drm/sti: Use drm_fb_cma_fbdev_init/fini()
  drm/stm: Use drm_fb_cma_fbdev_init/fini()
  drm/sun4i: Use drm_fb_cma_fbdev_init/fini()
  drm/tilcdc: Use drm_fb_cma_fbdev_init/fini()
  drm/tve200: Use drm_fb_cma_fbdev_init/fini()
  drm/vc4: Use drm_fb_cma_fbdev_init/fini()
  drm/zte: Use drm_fb_cma_fbdev_init/fini()
  drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
  drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
  drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
  drm/cma-helper: Remove drm_fbdev_cma* functions

 Documentation/gpu/todo.rst                      |   5 -
 drivers/gpu/drm/arc/arcpgu.h                    |   4 -
 drivers/gpu/drm/arc/arcpgu_drv.c                |  36 +----
 drivers/gpu/drm/arm/hdlcd_drv.c                 |  37 +----
 drivers/gpu/drm/arm/hdlcd_drv.h                 |   1 -
 drivers/gpu/drm/arm/malidp_drv.c                |  39 +----
 drivers/gpu/drm/arm/malidp_drv.h                |   1 -
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    |  26 +---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h    |   2 +-
 drivers/gpu/drm/drm_fb_cma_helper.c             | 188 +++++++++---------------
 drivers/gpu/drm/drm_gem_framebuffer_helper.c    |   6 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       |  26 +---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h       |   1 -
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  35 +----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |   4 -
 drivers/gpu/drm/imx/imx-drm-core.c              |  33 +----
 drivers/gpu/drm/imx/imx-drm.h                   |   1 -
 drivers/gpu/drm/meson/meson_drv.c               |  20 +--
 drivers/gpu/drm/meson/meson_drv.h               |   1 -
 drivers/gpu/drm/mxsfb/mxsfb_drv.c               |  21 +--
 drivers/gpu/drm/mxsfb/mxsfb_drv.h               |   1 -
 drivers/gpu/drm/pl111/pl111_drm.h               |   1 -
 drivers/gpu/drm/pl111/pl111_drv.c               |  16 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c           |  13 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h           |   2 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c           |  20 +--
 drivers/gpu/drm/sti/sti_drv.c                   |  25 +---
 drivers/gpu/drm/sti/sti_drv.h                   |   1 -
 drivers/gpu/drm/stm/drv.c                       |  37 +----
 drivers/gpu/drm/stm/ltdc.h                      |   1 -
 drivers/gpu/drm/sun4i/sun4i_drv.c               |  14 +-
 drivers/gpu/drm/sun4i/sun4i_drv.h               |   2 -
 drivers/gpu/drm/sun4i/sun4i_framebuffer.c       |  18 +--
 drivers/gpu/drm/sun4i/sun4i_framebuffer.h       |   2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c             |  26 +---
 drivers/gpu/drm/tilcdc/tilcdc_drv.h             |   2 -
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c     |  37 +----
 drivers/gpu/drm/tinydrm/mi0283qt.c              |   3 +-
 drivers/gpu/drm/tinydrm/st7586.c                |   3 +-
 drivers/gpu/drm/tve200/tve200_drm.h             |   1 -
 drivers/gpu/drm/tve200/tve200_drv.c             |  16 +-
 drivers/gpu/drm/vc4/vc4_drv.c                   |  13 +-
 drivers/gpu/drm/vc4/vc4_drv.h                   |   2 -
 drivers/gpu/drm/vc4/vc4_kms.c                   |  18 +--
 drivers/gpu/drm/zte/zx_drm_drv.c                |  48 +-----
 include/drm/drm_fb_cma_helper.h                 |  29 +---
 include/drm/tinydrm/tinydrm.h                   |   3 -
 47 files changed, 196 insertions(+), 645 deletions(-)

-- 
2.14.2

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

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

* [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
@ 2017-11-04 13:03 ` Noralf Trønnes
  2017-11-06  8:54   ` Daniel Vetter
  2017-11-04 13:03 ` [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini() Noralf Trønnes
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Make the drm_framebuffer_funcs argument optional for drivers that
don't need to set the dirty callback.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index aa8cb9bfa499..4d682a6e8bcb 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
  * @sizes: fbdev size description
  * @pitch_align: Optional pitch alignment
  * @obj: GEM object backing the framebuffer
- * @funcs: vtable to be used for the new framebuffer object
+ * @funcs: Optional vtable to be used for the new framebuffer object when the
+ *         dirty callback is needed.
  *
  * This function creates a framebuffer from a &drm_fb_helper_surface_size
  * description for use in the &drm_fb_helper_funcs.fb_probe callback.
@@ -300,6 +301,9 @@ drm_gem_fbdev_fb_create(struct drm_device *dev,
 	if (obj->size < mode_cmd.pitches[0] * mode_cmd.height)
 		return ERR_PTR(-EINVAL);
 
+	if (!funcs)
+		funcs = &drm_gem_fb_funcs;
+
 	return drm_gem_fb_alloc(dev, &mode_cmd, &obj, 1, funcs);
 }
 EXPORT_SYMBOL(drm_gem_fbdev_fb_create);
-- 
2.14.2

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

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

* [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
  2017-11-04 13:03 ` [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional Noralf Trønnes
@ 2017-11-04 13:03 ` Noralf Trønnes
  2017-11-06  9:04   ` Daniel Vetter
  2017-11-04 13:03 ` [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini() Noralf Trønnes
                   ` (20 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Add functions drm_fb_cma_fbdev_init(), drm_fb_cma_fbdev_fini() and
drm_fb_cma_fbdev_init_with_funcs(). These functions relies on the fact
that the drm_fb_helper struct is stored in dev->drm_fb_helper_private
so drivers don't need to store it.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 116 +++++++++++++++++++++++++++++++++++-
 include/drm/drm_fb_cma_helper.h     |   7 +++
 2 files changed, 121 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0e3c14174d08..267c04216281 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -23,6 +23,7 @@
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_print.h>
 #include <linux/module.h>
 
 #define DEFAULT_FBDEFIO_DELAY_MS 50
@@ -42,7 +43,7 @@ struct drm_fbdev_cma {
  * callback function to create a cma backed framebuffer.
  *
  * An fbdev framebuffer backed by cma is also available by calling
- * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
+ * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down.
  * If the &drm_framebuffer_funcs.dirty callback is set, fb_deferred_io will be
  * set up automatically. &drm_framebuffer_funcs.dirty is called by
  * drm_fb_helper_deferred_io() in process context (&struct delayed_work).
@@ -68,7 +69,7 @@ struct drm_fbdev_cma {
  *
  * Initialize::
  *
- *     fbdev = drm_fbdev_cma_init_with_funcs(dev, 16,
+ *     fbdev = drm_fb_cma_fbdev_init_with_funcs(dev, 16,
  *                                           dev->mode_config.num_crtc,
  *                                           dev->mode_config.num_connector,
  *                                           &driver_fb_funcs);
@@ -314,6 +315,117 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
 	.fb_probe = drm_fbdev_cma_create,
 };
 
+/**
+ * drm_fb_cma_fbdev_init_with_funcs() - Allocate and initialize fbdev emulation
+ * @dev: DRM device
+ * @preferred_bpp: Preferred bits per pixel for the device.
+ *                 @dev->mode_config.preferred_depth is used if this is zero.
+ * @max_conn_count: Maximum number of connectors.
+ *                  @dev->mode_config.num_connector is used if this is zero.
+ * @funcs: Framebuffer functions, in particular a custom dirty() callback.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
+	unsigned int preferred_bpp, unsigned int max_conn_count,
+	const struct drm_framebuffer_funcs *funcs)
+{
+	struct drm_fbdev_cma *fbdev_cma;
+	struct drm_fb_helper *fb_helper;
+	int ret;
+
+	if (!preferred_bpp)
+		preferred_bpp = dev->mode_config.preferred_depth;
+	if (!preferred_bpp)
+		preferred_bpp = 32;
+
+	if (!max_conn_count)
+		max_conn_count = dev->mode_config.num_connector;
+
+	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
+	if (!fbdev_cma)
+		return -ENOMEM;
+
+	fbdev_cma->fb_funcs = funcs;
+	fb_helper = &fbdev_cma->fb_helper;
+
+	drm_fb_helper_prepare(dev, fb_helper, &drm_fb_cma_helper_funcs);
+
+	ret = drm_fb_helper_init(dev, fb_helper, max_conn_count);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev->dev, "Failed to initialize fbdev helper.\n");
+		goto err_free;
+	}
+
+	ret = drm_fb_helper_single_add_all_connectors(fb_helper);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev->dev, "Failed to add connectors.\n");
+		goto err_drm_fb_helper_fini;
+	}
+
+	ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp);
+	if (ret < 0) {
+		DRM_DEV_ERROR(dev->dev, "Failed to set fbdev configuration.\n");
+		goto err_drm_fb_helper_fini;
+	}
+
+	return 0;
+
+err_drm_fb_helper_fini:
+	drm_fb_helper_fini(fb_helper);
+err_free:
+	kfree(fbdev_cma);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init_with_funcs);
+
+/**
+ * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation
+ * @dev: DRM device
+ * @preferred_bpp: Preferred bits per pixel for the device.
+ *                 @dev->mode_config.preferred_depth is used if this is zero.
+ * @max_conn_count: Maximum number of connectors.
+ *                  @dev->mode_config.num_connector is used if this is zero.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
+			  unsigned int max_conn_count)
+{
+	return drm_fb_cma_fbdev_init_with_funcs(dev, preferred_bpp,
+						max_conn_count, NULL);
+}
+EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init);
+
+/**
+ * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation
+ * @dev: DRM device
+ */
+void drm_fb_cma_fbdev_fini(struct drm_device *dev)
+{
+	struct drm_fb_helper *fb_helper = dev->fb_helper;
+
+	if (!fb_helper)
+		return;
+
+	/* Unregister if it hasn't been done already */
+	if (fb_helper->fbdev && fb_helper->fbdev->dev)
+		drm_fb_helper_unregister_fbi(fb_helper);
+
+	if (fb_helper->fbdev)
+		drm_fbdev_cma_defio_fini(fb_helper->fbdev);
+
+	if (fb_helper->fb)
+		drm_framebuffer_remove(fb_helper->fb);
+
+	drm_fb_helper_fini(fb_helper);
+	kfree(to_fbdev_cma(fb_helper));
+}
+EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
+
 /**
  * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct
  * @dev: DRM device
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 023f052a5873..22be22e641a4 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -15,6 +15,13 @@ struct drm_mode_fb_cmd2;
 struct drm_plane;
 struct drm_plane_state;
 
+int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
+	unsigned int preferred_bpp, unsigned int max_conn_count,
+	const struct drm_framebuffer_funcs *funcs);
+int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
+			  unsigned int max_conn_count);
+void drm_fb_cma_fbdev_fini(struct drm_device *dev);
+
 struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
 	unsigned int preferred_bpp, unsigned int max_conn_count,
 	const struct drm_framebuffer_funcs *funcs);
-- 
2.14.2

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

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

* [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
  2017-11-04 13:03 ` [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional Noralf Trønnes
  2017-11-04 13:03 ` [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini() Noralf Trønnes
@ 2017-11-04 13:03 ` Noralf Trønnes
  2017-11-06  9:08   ` Daniel Vetter
  2017-11-04 13:03 ` [PATCH 04/22] drm/arm/hdlcd: " Noralf Trønnes
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove unused function prototype arcpgu_fbdev_cma_init().

Cc: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/arc/arcpgu.h     |  4 ----
 drivers/gpu/drm/arc/arcpgu_drv.c | 36 +++++++-----------------------------
 2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
index e8fcf3ab1d9a..90ef76b19f8a 100644
--- a/drivers/gpu/drm/arc/arcpgu.h
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -20,7 +20,6 @@
 struct arcpgu_drm_private {
 	void __iomem		*regs;
 	struct clk		*clk;
-	struct drm_fbdev_cma	*fbdev;
 	struct drm_framebuffer	*fb;
 	struct drm_crtc		crtc;
 	struct drm_plane	*plane;
@@ -43,8 +42,5 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
 int arc_pgu_setup_crtc(struct drm_device *dev);
 int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
-struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int num_crtc,
-	unsigned int max_conn_count);
 
 #endif
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 074fd4ea7ece..f54481ee834c 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -25,16 +26,9 @@
 #include "arcpgu.h"
 #include "arcpgu_regs.h"
 
-static void arcpgu_fb_output_poll_changed(struct drm_device *dev)
-{
-	struct arcpgu_drm_private *arcpgu = dev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(arcpgu->fbdev);
-}
-
 static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
 	.fb_create  = drm_gem_fb_create,
-	.output_poll_changed = arcpgu_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -51,13 +45,6 @@ static void arcpgu_setup_mode_config(struct drm_device *drm)
 
 DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops);
 
-static void arcpgu_lastclose(struct drm_device *drm)
-{
-	struct arcpgu_drm_private *arcpgu = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(arcpgu->fbdev);
-}
-
 static int arcpgu_load(struct drm_device *drm)
 {
 	struct platform_device *pdev = to_platform_device(drm->dev);
@@ -113,13 +100,9 @@ static int arcpgu_load(struct drm_device *drm)
 	drm_mode_config_reset(drm);
 	drm_kms_helper_poll_init(drm);
 
-	arcpgu->fbdev = drm_fbdev_cma_init(drm, 16,
-					   drm->mode_config.num_connector);
-	if (IS_ERR(arcpgu->fbdev)) {
-		ret = PTR_ERR(arcpgu->fbdev);
-		arcpgu->fbdev = NULL;
-		return -ENODEV;
-	}
+	ret = drm_fb_cma_fbdev_init(drm, 16, 0);
+	if (ret)
+		return ret;
 
 	platform_set_drvdata(pdev, drm);
 	return 0;
@@ -127,12 +110,7 @@ static int arcpgu_load(struct drm_device *drm)
 
 static int arcpgu_unload(struct drm_device *drm)
 {
-	struct arcpgu_drm_private *arcpgu = drm->dev_private;
-
-	if (arcpgu->fbdev) {
-		drm_fbdev_cma_fini(arcpgu->fbdev);
-		arcpgu->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 	drm_kms_helper_poll_fini(drm);
 	drm_mode_config_cleanup(drm);
 
@@ -168,7 +146,7 @@ static int arcpgu_debugfs_init(struct drm_minor *minor)
 static struct drm_driver arcpgu_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = arcpgu_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.name = "arcpgu",
 	.desc = "ARC PGU Controller",
 	.date = "20160219",
-- 
2.14.2

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

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

* [PATCH 04/22] drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (2 preceding siblings ...)
  2017-11-04 13:03 ` [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini() Noralf Trønnes
@ 2017-11-04 13:03 ` Noralf Trønnes
  2017-11-05 14:27   ` Liviu Dudau
  2017-11-04 13:03 ` [PATCH 05/22] drm/atmel-hlcdc: " Noralf Trønnes
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 37 ++++++-------------------------------
 drivers/gpu/drm/arm/hdlcd_drv.h |  1 -
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 764d0c83710c..fe963072b6f5 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -99,16 +99,9 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 	return ret;
 }
 
-static void hdlcd_fb_output_poll_changed(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-
-	drm_fbdev_cma_hotplug_event(hdlcd->fbdev);
-}
-
 static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = hdlcd_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -123,13 +116,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
 	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
 }
 
-static void hdlcd_lastclose(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(hdlcd->fbdev);
-}
-
 static irqreturn_t hdlcd_irq(int irq, void *arg)
 {
 	struct drm_device *drm = arg;
@@ -246,7 +232,7 @@ static struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
 			   DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = hdlcd_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.irq_handler = hdlcd_irq,
 	.irq_preinstall = hdlcd_irq_preinstall,
 	.irq_postinstall = hdlcd_irq_postinstall,
@@ -320,14 +306,9 @@ static int hdlcd_drm_bind(struct device *dev)
 	drm_mode_config_reset(drm);
 	drm_kms_helper_poll_init(drm);
 
-	hdlcd->fbdev = drm_fbdev_cma_init(drm, 32,
-					  drm->mode_config.num_connector);
-
-	if (IS_ERR(hdlcd->fbdev)) {
-		ret = PTR_ERR(hdlcd->fbdev);
-		hdlcd->fbdev = NULL;
+	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
+	if (ret)
 		goto err_fbdev;
-	}
 
 	ret = drm_dev_register(drm, 0);
 	if (ret)
@@ -336,10 +317,7 @@ static int hdlcd_drm_bind(struct device *dev)
 	return 0;
 
 err_register:
-	if (hdlcd->fbdev) {
-		drm_fbdev_cma_fini(hdlcd->fbdev);
-		hdlcd->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 err_fbdev:
 	drm_kms_helper_poll_fini(drm);
 err_vblank:
@@ -365,10 +343,7 @@ static void hdlcd_drm_unbind(struct device *dev)
 	struct hdlcd_drm_private *hdlcd = drm->dev_private;
 
 	drm_dev_unregister(drm);
-	if (hdlcd->fbdev) {
-		drm_fbdev_cma_fini(hdlcd->fbdev);
-		hdlcd->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 	drm_kms_helper_poll_fini(drm);
 	component_unbind_all(dev, drm);
 	of_node_put(hdlcd->crtc.port);
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index e3950a071152..a9f0b4350d95 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -8,7 +8,6 @@
 struct hdlcd_drm_private {
 	void __iomem			*mmio;
 	struct clk			*clk;
-	struct drm_fbdev_cma		*fbdev;
 	struct drm_crtc			crtc;
 	struct drm_plane		*plane;
 	struct drm_atomic_state		*state;
-- 
2.14.2

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

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

* [PATCH 05/22] drm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (3 preceding siblings ...)
  2017-11-04 13:03 ` [PATCH 04/22] drm/arm/hdlcd: " Noralf Trønnes
@ 2017-11-04 13:03 ` Noralf Trønnes
  2017-11-06 10:16   ` Boris Brezillon
  2017-11-04 13:04 ` [PATCH 06/22] drm/hisilicon/kirin: " Noralf Trønnes
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:03 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 26 ++++----------------------
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h |  2 +-
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index c6e8061ffcfc..c1ea5c36b006 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -461,13 +461,6 @@ static struct drm_framebuffer *atmel_hlcdc_fb_create(struct drm_device *dev,
 	return drm_gem_fb_create(dev, file_priv, mode_cmd);
 }
 
-static void atmel_hlcdc_fb_output_poll_changed(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(dc->fbdev);
-}
-
 struct atmel_hlcdc_dc_commit {
 	struct work_struct work;
 	struct drm_device *dev;
@@ -563,7 +556,7 @@ static int atmel_hlcdc_dc_atomic_commit(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = atmel_hlcdc_fb_create,
-	.output_poll_changed = atmel_hlcdc_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = atmel_hlcdc_dc_atomic_commit,
 };
@@ -665,10 +658,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 
 	platform_set_drvdata(pdev, dev);
 
-	dc->fbdev = drm_fbdev_cma_init(dev, 24,
-			dev->mode_config.num_connector);
-	if (IS_ERR(dc->fbdev))
-		dc->fbdev = NULL;
+	drm_fb_cma_fbdev_init(dev, 24, 0);
 
 	drm_kms_helper_poll_init(dev);
 
@@ -688,8 +678,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 {
 	struct atmel_hlcdc_dc *dc = dev->dev_private;
 
-	if (dc->fbdev)
-		drm_fbdev_cma_fini(dc->fbdev);
+	drm_fb_cma_fbdev_fini(dev);
 	flush_workqueue(dc->wq);
 	drm_kms_helper_poll_fini(dev);
 	drm_mode_config_cleanup(dev);
@@ -705,13 +694,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	destroy_workqueue(dc->wq);
 }
 
-static void atmel_hlcdc_dc_lastclose(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(dc->fbdev);
-}
-
 static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
 {
 	struct atmel_hlcdc_dc *dc = dev->dev_private;
@@ -744,7 +726,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
 			   DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = atmel_hlcdc_dc_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.irq_handler = atmel_hlcdc_dc_irq_handler,
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
 	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
index 6833ee253cfa..ab32d5b268d2 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
@@ -32,6 +32,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -374,7 +375,6 @@ struct atmel_hlcdc_dc {
 	const struct atmel_hlcdc_dc_desc *desc;
 	struct dma_pool *dscrpool;
 	struct atmel_hlcdc *hlcdc;
-	struct drm_fbdev_cma *fbdev;
 	struct drm_crtc *crtc;
 	struct atmel_hlcdc_layer *layers[ATMEL_HLCDC_MAX_LAYERS];
 	struct workqueue_struct *wq;
-- 
2.14.2

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

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

* [PATCH 06/22] drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (4 preceding siblings ...)
  2017-11-04 13:03 ` [PATCH 05/22] drm/atmel-hlcdc: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-04 13:04 ` [PATCH 07/22] drm/imx: " Noralf Trønnes
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 ++++---------------------
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ---
 2 files changed, 5 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index ddb0403f1975..e3673efbf1c2 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -21,6 +21,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_atomic_helper.h>
@@ -33,32 +34,17 @@ static struct kirin_dc_ops *dc_ops;
 
 static int kirin_drm_kms_cleanup(struct drm_device *dev)
 {
-	struct kirin_drm_private *priv = dev->dev_private;
-
-	if (priv->fbdev) {
-		drm_fbdev_cma_fini(priv->fbdev);
-		priv->fbdev = NULL;
-	}
-
+	drm_fb_cma_fbdev_fini(dev);
 	drm_kms_helper_poll_fini(dev);
 	dc_ops->cleanup(to_platform_device(dev->dev));
 	drm_mode_config_cleanup(dev);
-	devm_kfree(dev->dev, priv);
-	dev->dev_private = NULL;
 
 	return 0;
 }
 
-static void kirin_fbdev_output_poll_changed(struct drm_device *dev)
-{
-	struct kirin_drm_private *priv = dev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(priv->fbdev);
-}
-
 static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = kirin_fbdev_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -76,14 +62,8 @@ static void kirin_drm_mode_config_init(struct drm_device *dev)
 
 static int kirin_drm_kms_init(struct drm_device *dev)
 {
-	struct kirin_drm_private *priv;
 	int ret;
 
-	priv = devm_kzalloc(dev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
-		return -ENOMEM;
-
-	dev->dev_private = priv;
 	dev_set_drvdata(dev->dev, dev);
 
 	/* dev->mode_config initialization */
@@ -117,12 +97,9 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 	/* init kms poll for handling hpd */
 	drm_kms_helper_poll_init(dev);
 
-	priv->fbdev = drm_fbdev_cma_init(dev, 32,
-					 dev->mode_config.num_connector);
-
-	if (IS_ERR(priv->fbdev)) {
+	ret = drm_fb_cma_fbdev_init(dev, 32, 0);
+	if (ret) {
 		DRM_ERROR("failed to initialize fbdev.\n");
-		ret = PTR_ERR(priv->fbdev);
 		goto err_cleanup_poll;
 	}
 	return 0;
@@ -135,8 +112,6 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 	dc_ops->cleanup(to_platform_device(dev->dev));
 err_mode_config_cleanup:
 	drm_mode_config_cleanup(dev);
-	devm_kfree(dev->dev, priv);
-	dev->dev_private = NULL;
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
index 56cb62df065c..ad027d1cc826 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -19,10 +19,6 @@ struct kirin_dc_ops {
 	void (*cleanup)(struct platform_device *pdev);
 };
 
-struct kirin_drm_private {
-	struct drm_fbdev_cma *fbdev;
-};
-
 extern const struct kirin_dc_ops ade_dc_ops;
 
 #endif /* __KIRIN_DRM_DRV_H__ */
-- 
2.14.2

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

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

* [PATCH 07/22] drm/imx: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (5 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 06/22] drm/hisilicon/kirin: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06  9:59   ` Philipp Zabel
  2017-11-04 13:04 ` [PATCH 08/22] drm/meson: " Noralf Trønnes
                   ` (15 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 33 ++++++---------------------------
 drivers/gpu/drm/imx/imx-drm.h      |  1 -
 2 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 93c7e3f9b4a8..197484f01849 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -38,7 +38,6 @@
 struct imx_drm_device {
 	struct drm_device			*drm;
 	unsigned int				pipes;
-	struct drm_fbdev_cma			*fbhelper;
 	struct drm_atomic_state			*state;
 };
 
@@ -47,13 +46,6 @@ static int legacyfb_depth = 16;
 module_param(legacyfb_depth, int, 0444);
 #endif
 
-static void imx_drm_driver_lastclose(struct drm_device *drm)
-{
-	struct imx_drm_device *imxdrm = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(imx_drm_driver_fops);
 
 void imx_drm_connector_destroy(struct drm_connector *connector)
@@ -69,13 +61,6 @@ void imx_drm_encoder_destroy(struct drm_encoder *encoder)
 }
 EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
 
-static void imx_drm_output_poll_changed(struct drm_device *drm)
-{
-	struct imx_drm_device *imxdrm = drm->dev_private;
-
-	drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
-}
-
 static int imx_drm_atomic_check(struct drm_device *dev,
 				struct drm_atomic_state *state)
 {
@@ -107,7 +92,7 @@ static int imx_drm_atomic_check(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = imx_drm_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = imx_drm_atomic_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -179,7 +164,7 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = {
 static struct drm_driver imx_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 				  DRIVER_ATOMIC,
-	.lastclose		= imx_drm_driver_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops		= &drm_gem_cma_vm_ops,
 	.dumb_create		= drm_gem_cma_dumb_create,
@@ -291,12 +276,9 @@ static int imx_drm_bind(struct device *dev)
 		dev_warn(dev, "Invalid legacyfb_depth.  Defaulting to 16bpp\n");
 		legacyfb_depth = 16;
 	}
-	imxdrm->fbhelper = drm_fbdev_cma_init(drm, legacyfb_depth, MAX_CRTC);
-	if (IS_ERR(imxdrm->fbhelper)) {
-		ret = PTR_ERR(imxdrm->fbhelper);
-		imxdrm->fbhelper = NULL;
+	ret = drm_fb_cma_fbdev_init(drm, legacyfb_depth, MAX_CRTC);
+	if (ret)
 		goto err_unbind;
-	}
 #endif
 
 	drm_kms_helper_poll_init(drm);
@@ -310,8 +292,7 @@ static int imx_drm_bind(struct device *dev)
 err_fbhelper:
 	drm_kms_helper_poll_fini(drm);
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
-	if (imxdrm->fbhelper)
-		drm_fbdev_cma_fini(imxdrm->fbhelper);
+	drm_fb_cma_fbdev_fini(drm);
 err_unbind:
 #endif
 	component_unbind_all(drm->dev, drm);
@@ -326,14 +307,12 @@ static int imx_drm_bind(struct device *dev)
 static void imx_drm_unbind(struct device *dev)
 {
 	struct drm_device *drm = dev_get_drvdata(dev);
-	struct imx_drm_device *imxdrm = drm->dev_private;
 
 	drm_dev_unregister(drm);
 
 	drm_kms_helper_poll_fini(drm);
 
-	if (imxdrm->fbhelper)
-		drm_fbdev_cma_fini(imxdrm->fbhelper);
+	drm_fb_cma_fbdev_fini(drm);
 
 	drm_mode_config_cleanup(drm);
 
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index f6dd64be9cd5..8afdc49ee695 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -7,7 +7,6 @@ struct drm_connector;
 struct drm_device;
 struct drm_display_mode;
 struct drm_encoder;
-struct drm_fbdev_cma;
 struct drm_framebuffer;
 struct drm_plane;
 struct imx_drm_crtc;
-- 
2.14.2

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

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

* [PATCH 08/22] drm/meson: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (6 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 07/22] drm/imx: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-04 13:04 ` [PATCH 09/22] drm/mxsfb: " Noralf Trønnes
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/meson/meson_drv.c | 20 +++++---------------
 drivers/gpu/drm/meson/meson_drv.h |  1 -
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 3b804fdaf7a0..35e6ad5b565f 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -35,6 +35,7 @@
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_rect.h>
 #include <drm/drm_fb_helper.h>
@@ -68,15 +69,8 @@
  * - Powering Up HDMI controller and PHY
  */
 
-static void meson_fb_output_poll_changed(struct drm_device *dev)
-{
-	struct meson_drm *priv = dev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(priv->fbdev);
-}
-
 static const struct drm_mode_config_funcs meson_mode_config_funcs = {
-	.output_poll_changed = meson_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check        = drm_atomic_helper_check,
 	.atomic_commit       = drm_atomic_helper_commit,
 	.fb_create           = drm_gem_fb_create,
@@ -254,12 +248,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	drm_mode_config_reset(drm);
 
-	priv->fbdev = drm_fbdev_cma_init(drm, 32,
-					 drm->mode_config.num_connector);
-	if (IS_ERR(priv->fbdev)) {
-		ret = PTR_ERR(priv->fbdev);
+	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
+	if (ret)
 		goto free_drm;
-	}
 
 	drm_kms_helper_poll_init(drm);
 
@@ -285,11 +276,10 @@ static int meson_drv_bind(struct device *dev)
 static void meson_drv_unbind(struct device *dev)
 {
 	struct drm_device *drm = dev_get_drvdata(dev);
-	struct meson_drm *priv = drm->dev_private;
 
 	drm_dev_unregister(drm);
 	drm_kms_helper_poll_fini(drm);
-	drm_fbdev_cma_fini(priv->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 	drm_mode_config_cleanup(drm);
 	drm_dev_unref(drm);
 
diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
index 5e8b392b9d1f..746bbdbbdec3 100644
--- a/drivers/gpu/drm/meson/meson_drv.h
+++ b/drivers/gpu/drm/meson/meson_drv.h
@@ -33,7 +33,6 @@ struct meson_drm {
 
 	struct drm_device *drm;
 	struct drm_crtc *crtc;
-	struct drm_fbdev_cma *fbdev;
 	struct drm_plane *primary_plane;
 
 	/* Components Data */
-- 
2.14.2

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

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

* [PATCH 09/22] drm/mxsfb: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (7 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 08/22] drm/meson: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-04 13:04 ` [PATCH 10/22] drm/pl111: " Noralf Trønnes
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 ++++-----------------
 drivers/gpu/drm/mxsfb/mxsfb_drv.h |  1 -
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 1207ffe36250..d846dbfc22e9 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -223,11 +223,8 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
 
 	drm_kms_helper_poll_init(drm);
 
-	mxsfb->fbdev = drm_fbdev_cma_init(drm, 32,
-					  drm->mode_config.num_connector);
-	if (IS_ERR(mxsfb->fbdev)) {
-		ret = PTR_ERR(mxsfb->fbdev);
-		mxsfb->fbdev = NULL;
+	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
+	if (ret) {
 		dev_err(drm->dev, "Failed to init FB CMA area\n");
 		goto err_cma;
 	}
@@ -250,10 +247,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
 
 static void mxsfb_unload(struct drm_device *drm)
 {
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	if (mxsfb->fbdev)
-		drm_fbdev_cma_fini(mxsfb->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 
 	drm_kms_helper_poll_fini(drm);
 	drm_mode_config_cleanup(drm);
@@ -267,13 +261,6 @@ static void mxsfb_unload(struct drm_device *drm)
 	pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_lastclose(struct drm_device *drm)
-{
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(mxsfb->fbdev);
-}
-
 static int mxsfb_enable_vblank(struct drm_device *drm, unsigned int crtc)
 {
 	struct mxsfb_drm_private *mxsfb = drm->dev_private;
@@ -329,7 +316,7 @@ static struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET |
 				  DRIVER_PRIME | DRIVER_ATOMIC |
 				  DRIVER_HAVE_IRQ,
-	.lastclose		= mxsfb_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.irq_handler		= mxsfb_irq_handler,
 	.irq_preinstall		= mxsfb_irq_preinstall,
 	.irq_uninstall		= mxsfb_irq_preinstall,
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index 5d0883fc805b..bedd6801edca 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -37,7 +37,6 @@ struct mxsfb_drm_private {
 	struct drm_simple_display_pipe	pipe;
 	struct drm_connector		connector;
 	struct drm_panel		*panel;
-	struct drm_fbdev_cma		*fbdev;
 };
 
 int mxsfb_setup_crtc(struct drm_device *dev);
-- 
2.14.2

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

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

* [PATCH 10/22] drm/pl111: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (8 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 09/22] drm/mxsfb: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06 13:18   ` Linus Walleij
  2017-11-04 13:04 ` [PATCH 11/22] drm/rcar-du: " Noralf Trønnes
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/pl111/pl111_drm.h |  1 -
 drivers/gpu/drm/pl111/pl111_drv.c | 16 ++++------------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index 440f53ebee8c..07fa2cdb364a 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -53,7 +53,6 @@ struct pl111_drm_dev_private {
 	struct drm_panel *panel;
 	struct drm_bridge *bridge;
 	struct drm_simple_display_pipe pipe;
-	struct drm_fbdev_cma *fbdev;
 
 	void *regs;
 	u32 ienb;
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 201d57d5cb54..acb738c69873 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -64,6 +64,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_bridge.h>
@@ -137,8 +138,7 @@ static int pl111_modeset_init(struct drm_device *dev)
 
 	drm_mode_config_reset(dev);
 
-	priv->fbdev = drm_fbdev_cma_init(dev, 32,
-					 dev->mode_config.num_connector);
+	drm_fb_cma_fbdev_init(dev, 32, 0);
 
 	drm_kms_helper_poll_init(dev);
 
@@ -155,17 +155,10 @@ static int pl111_modeset_init(struct drm_device *dev)
 
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
-static void pl111_lastclose(struct drm_device *dev)
-{
-	struct pl111_drm_dev_private *priv = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(priv->fbdev);
-}
-
 static struct drm_driver pl111_drm_driver = {
 	.driver_features =
 		DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,
-	.lastclose = pl111_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.ioctls = NULL,
 	.fops = &drm_fops,
 	.name = "pl111",
@@ -281,8 +274,7 @@ static int pl111_amba_remove(struct amba_device *amba_dev)
 	struct pl111_drm_dev_private *priv = drm->dev_private;
 
 	drm_dev_unregister(drm);
-	if (priv->fbdev)
-		drm_fbdev_cma_fini(priv->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 	if (priv->panel)
 		drm_panel_bridge_remove(priv->bridge);
 	drm_mode_config_cleanup(drm);
-- 
2.14.2

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

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

* [PATCH 11/22] drm/rcar-du: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (9 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 10/22] drm/pl111: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-04 13:04 ` [PATCH 12/22] drm/sti: " Noralf Trønnes
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 13 +++----------
 drivers/gpu/drm/rcar-du/rcar_du_drv.h |  2 --
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 20 +++++---------------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index d2f29e6b1112..aa342a1b0d12 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -23,6 +23,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 
@@ -224,19 +225,12 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table);
  * DRM operations
  */
 
-static void rcar_du_lastclose(struct drm_device *dev)
-{
-	struct rcar_du_device *rcdu = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(rcdu->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
 
 static struct drm_driver rcar_du_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
 				| DRIVER_ATOMIC,
-	.lastclose		= rcar_du_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.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,
@@ -298,8 +292,7 @@ static int rcar_du_remove(struct platform_device *pdev)
 
 	drm_dev_unregister(ddev);
 
-	if (rcdu->fbdev)
-		drm_fbdev_cma_fini(rcdu->fbdev);
+	drm_fb_cma_fbdev_fini(ddev);
 
 	drm_kms_helper_poll_fini(ddev);
 	drm_mode_config_cleanup(ddev);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index f8cd79488ece..bb3516ad26b3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -24,7 +24,6 @@
 struct clk;
 struct device;
 struct drm_device;
-struct drm_fbdev_cma;
 struct rcar_du_device;
 struct rcar_du_lvdsenc;
 
@@ -80,7 +79,6 @@ struct rcar_du_device {
 	void __iomem *mmio;
 
 	struct drm_device *ddev;
-	struct drm_fbdev_cma *fbdev;
 
 	struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
 	unsigned int num_crtcs;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 566d1a948c8f..344c4613fbc1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -16,6 +16,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -217,13 +218,6 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 	return drm_gem_fb_create(dev, file_priv, mode_cmd);
 }
 
-static void rcar_du_output_poll_changed(struct drm_device *dev)
-{
-	struct rcar_du_device *rcdu = dev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(rcdu->fbdev);
-}
-
 /* -----------------------------------------------------------------------------
  * Atomic Check and Update
  */
@@ -278,7 +272,7 @@ static const struct drm_mode_config_helper_funcs rcar_du_mode_config_helper = {
 
 static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = {
 	.fb_create = rcar_du_fb_create,
-	.output_poll_changed = rcar_du_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = rcar_du_atomic_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -519,7 +513,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 
 	struct drm_device *dev = rcdu->ddev;
 	struct drm_encoder *encoder;
-	struct drm_fbdev_cma *fbdev;
 	unsigned int num_encoders;
 	unsigned int num_groups;
 	unsigned int i;
@@ -629,12 +622,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 	drm_kms_helper_poll_init(dev);
 
 	if (dev->mode_config.num_connector) {
-		fbdev = drm_fbdev_cma_init(dev, 32,
-					   dev->mode_config.num_connector);
-		if (IS_ERR(fbdev))
-			return PTR_ERR(fbdev);
-
-		rcdu->fbdev = fbdev;
+		ret = drm_fb_cma_fbdev_init(dev, 32, 0);
+		if (ret)
+			return ret;
 	} else {
 		dev_info(rcdu->dev,
 			 "no connector found, disabling fbdev emulation\n");
-- 
2.14.2

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

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

* [PATCH 12/22] drm/sti: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (10 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 11/22] drm/rcar-du: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-08 12:21   ` Benjamin Gaignard
  2017-11-04 13:04 ` [PATCH 13/22] drm/stm: " Noralf Trønnes
                   ` (10 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/sti/sti_drv.c | 25 +++++--------------------
 drivers/gpu/drm/sti/sti_drv.h |  1 -
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 9e9343101738..d61efef30a82 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -17,6 +17,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_of.h>
 
@@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
 	return ret;
 }
 
-static void sti_output_poll_changed(struct drm_device *ddev)
-{
-	struct sti_private *private = ddev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(private->fbdev);
-}
-
 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = sti_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = sti_atomic_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
 {
 	struct sti_private *private = ddev->dev_private;
 
-	if (private->fbdev) {
-		drm_fbdev_cma_fini(private->fbdev);
-		private->fbdev = NULL;
-	}
-
+	drm_fb_cma_fbdev_fini(ddev);
 	drm_kms_helper_poll_fini(ddev);
 	component_unbind_all(ddev->dev, ddev);
 	kfree(private);
@@ -245,7 +235,6 @@ static int sti_bind(struct device *dev)
 {
 	struct drm_device *ddev;
 	struct sti_private *private;
-	struct drm_fbdev_cma *fbdev;
 	int ret;
 
 	ddev = drm_dev_alloc(&sti_driver, dev);
@@ -268,13 +257,9 @@ static int sti_bind(struct device *dev)
 
 	private = ddev->dev_private;
 	if (ddev->mode_config.num_connector) {
-		fbdev = drm_fbdev_cma_init(ddev, 32,
-					   ddev->mode_config.num_connector);
-		if (IS_ERR(fbdev)) {
+		ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
+		if (ret)
 			DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
-			fbdev = NULL;
-		}
-		private->fbdev = fbdev;
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
index 6502ed2d3351..16c5c9110cb0 100644
--- a/drivers/gpu/drm/sti/sti_drv.h
+++ b/drivers/gpu/drm/sti/sti_drv.h
@@ -24,7 +24,6 @@ struct sti_private {
 	struct sti_compositor *compo;
 	struct drm_property *plane_zorder_property;
 	struct drm_device *drm_dev;
-	struct drm_fbdev_cma *fbdev;
 };
 
 extern struct platform_driver sti_tvout_driver;
-- 
2.14.2

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

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

* [PATCH 13/22] drm/stm: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (11 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 12/22] drm/sti: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06 17:32   ` Philippe CORNU
  2017-11-04 13:04 ` [PATCH 14/22] drm/sun4i: " Noralf Trønnes
                   ` (9 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Yannick Fertre <yannick.fertre@st.com>
Cc: Philippe Cornu <philippe.cornu@st.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/stm/drv.c  | 37 ++++++-------------------------------
 drivers/gpu/drm/stm/ltdc.h |  1 -
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index c857663eafc2..9a66f5671d4f 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -15,6 +15,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -24,35 +25,19 @@
 #define STM_MAX_FB_WIDTH	2048
 #define STM_MAX_FB_HEIGHT	2048 /* same as width to handle orientation */
 
-static void drv_output_poll_changed(struct drm_device *ddev)
-{
-	struct ltdc_device *ldev = ddev->dev_private;
-
-	drm_fbdev_cma_hotplug_event(ldev->fbdev);
-}
-
 static const struct drm_mode_config_funcs drv_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = drv_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
-static void drv_lastclose(struct drm_device *ddev)
-{
-	struct ltdc_device *ldev = ddev->dev_private;
-
-	DRM_DEBUG("%s\n", __func__);
-
-	drm_fbdev_cma_restore_mode(ldev->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
 
 static struct drm_driver drv_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = drv_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.name = "stm",
 	.desc = "STMicroelectronics SoC DRM",
 	.date = "20170330",
@@ -79,7 +64,6 @@ static struct drm_driver drv_driver = {
 static int drv_load(struct drm_device *ddev)
 {
 	struct platform_device *pdev = to_platform_device(ddev->dev);
-	struct drm_fbdev_cma *fbdev;
 	struct ltdc_device *ldev;
 	int ret;
 
@@ -113,13 +97,9 @@ static int drv_load(struct drm_device *ddev)
 
 	if (ddev->mode_config.num_connector) {
 		ldev = ddev->dev_private;
-		fbdev = drm_fbdev_cma_init(ddev, 16,
-					   ddev->mode_config.num_connector);
-		if (IS_ERR(fbdev)) {
+		ret = drm_fb_cma_fbdev_init(ddev, 16, 0);
+		if (ret)
 			DRM_DEBUG("Warning: fails to create fbdev\n");
-			fbdev = NULL;
-		}
-		ldev->fbdev = fbdev;
 	}
 
 	platform_set_drvdata(pdev, ddev);
@@ -132,14 +112,9 @@ static int drv_load(struct drm_device *ddev)
 
 static void drv_unload(struct drm_device *ddev)
 {
-	struct ltdc_device *ldev = ddev->dev_private;
-
 	DRM_DEBUG("%s\n", __func__);
 
-	if (ldev->fbdev) {
-		drm_fbdev_cma_fini(ldev->fbdev);
-		ldev->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(ddev);
 	drm_kms_helper_poll_fini(ddev);
 	ltdc_unload(ddev);
 	drm_mode_config_cleanup(ddev);
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index ae437557d715..27ac217406be 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -21,7 +21,6 @@ struct ltdc_caps {
 };
 
 struct ltdc_device {
-	struct drm_fbdev_cma *fbdev;
 	void __iomem *regs;
 	struct clk *pixel_clk;	/* lcd pixel clock */
 	struct mutex err_lock;	/* protecting error_status */
-- 
2.14.2

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

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

* [PATCH 14/22] drm/sun4i: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (12 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 13/22] drm/stm: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06  7:51   ` Maxime Ripard
  2017-11-04 13:04 ` [PATCH 15/22] drm/tilcdc: " Noralf Trønnes
                   ` (8 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/sun4i/sun4i_drv.c         | 14 +++-----------
 drivers/gpu/drm/sun4i/sun4i_drv.h         |  2 --
 drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 18 +++++-------------
 drivers/gpu/drm/sun4i/sun4i_framebuffer.h |  2 +-
 4 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 75c76cdd82bc..2743c8a839a0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -26,20 +26,13 @@
 #include "sun4i_framebuffer.h"
 #include "sun4i_tcon.h"
 
-static void sun4i_drv_lastclose(struct drm_device *dev)
-{
-	struct sun4i_drv *drv = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(drv->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
 
 static struct drm_driver sun4i_drv_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
 
 	/* Generic Operations */
-	.lastclose		= sun4i_drv_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.fops			= &sun4i_drv_fops,
 	.name			= "sun4i-drm",
 	.desc			= "Allwinner sun4i Display Engine",
@@ -126,10 +119,9 @@ static int sun4i_drv_bind(struct device *dev)
 	sun4i_remove_framebuffers();
 
 	/* Create our framebuffer */
-	drv->fbdev = sun4i_framebuffer_init(drm);
-	if (IS_ERR(drv->fbdev)) {
+	ret = sun4i_framebuffer_init(drm);
+	if (ret) {
 		dev_err(drm->dev, "Couldn't create our framebuffer\n");
-		ret = PTR_ERR(drv->fbdev);
 		goto cleanup_mode_config;
 	}
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.h b/drivers/gpu/drm/sun4i/sun4i_drv.h
index a960c89270cc..2825f140da54 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.h
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.h
@@ -20,8 +20,6 @@
 struct sun4i_drv {
 	struct list_head	engine_list;
 	struct list_head	tcon_list;
-
-	struct drm_fbdev_cma	*fbdev;
 };
 
 #endif /* _SUN4I_DRV_H_ */
diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
index 2992f0a6b349..38a36c0dfa2f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
@@ -11,6 +11,7 @@
  */
 
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drmP.h>
@@ -18,21 +19,14 @@
 #include "sun4i_drv.h"
 #include "sun4i_framebuffer.h"
 
-static void sun4i_de_output_poll_changed(struct drm_device *drm)
-{
-	struct sun4i_drv *drv = drm->dev_private;
-
-	drm_fbdev_cma_hotplug_event(drv->fbdev);
-}
-
 static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = {
-	.output_poll_changed	= sun4i_de_output_poll_changed,
+	.output_poll_changed	= drm_fb_helper_output_poll_changed,
 	.atomic_check		= drm_atomic_helper_check,
 	.atomic_commit		= drm_atomic_helper_commit,
 	.fb_create		= drm_gem_fb_create,
 };
 
-struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm)
+int sun4i_framebuffer_init(struct drm_device *drm)
 {
 	drm_mode_config_reset(drm);
 
@@ -41,12 +35,10 @@ struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm)
 
 	drm->mode_config.funcs = &sun4i_de_mode_config_funcs;
 
-	return drm_fbdev_cma_init(drm, 32, drm->mode_config.num_connector);
+	return drm_fb_cma_fbdev_init(drm, 32, 0);
 }
 
 void sun4i_framebuffer_free(struct drm_device *drm)
 {
-	struct sun4i_drv *drv = drm->dev_private;
-
-	drm_fbdev_cma_fini(drv->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 }
diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.h b/drivers/gpu/drm/sun4i/sun4i_framebuffer.h
index 3afd65252ee0..7ef0aed8384c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.h
+++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.h
@@ -13,7 +13,7 @@
 #ifndef _SUN4I_FRAMEBUFFER_H_
 #define _SUN4I_FRAMEBUFFER_H_
 
-struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm);
+int sun4i_framebuffer_init(struct drm_device *drm);
 void sun4i_framebuffer_free(struct drm_device *drm);
 
 #endif /* _SUN4I_FRAMEBUFFER_H_ */
-- 
2.14.2

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

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

* [PATCH 15/22] drm/tilcdc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (13 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 14/22] drm/sun4i: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-07  8:33   ` Jyri Sarha
  2017-11-04 13:04 ` [PATCH 16/22] drm/tve200: " Noralf Trønnes
                   ` (7 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 26 +++++---------------------
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  2 --
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 72ce063aa0d8..091b1025898e 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -69,12 +69,6 @@ static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev,
 	return drm_gem_fb_create(dev, file_priv, mode_cmd);
 }
 
-static void tilcdc_fb_output_poll_changed(struct drm_device *dev)
-{
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	drm_fbdev_cma_hotplug_event(priv->fbdev);
-}
-
 static int tilcdc_atomic_check(struct drm_device *dev,
 			       struct drm_atomic_state *state)
 {
@@ -146,7 +140,7 @@ static int tilcdc_commit(struct drm_device *dev,
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = tilcdc_fb_create,
-	.output_poll_changed = tilcdc_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = tilcdc_atomic_check,
 	.atomic_commit = tilcdc_commit,
 };
@@ -198,8 +192,7 @@ static void tilcdc_fini(struct drm_device *dev)
 
 	drm_kms_helper_poll_fini(dev);
 
-	if (priv->fbdev)
-		drm_fbdev_cma_fini(priv->fbdev);
+	drm_fb_cma_fbdev_fini(dev);
 
 	drm_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
@@ -405,12 +398,9 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
 
 	drm_mode_config_reset(ddev);
 
-	priv->fbdev = drm_fbdev_cma_init(ddev, bpp,
-					 ddev->mode_config.num_connector);
-	if (IS_ERR(priv->fbdev)) {
-		ret = PTR_ERR(priv->fbdev);
+	ret = drm_fb_cma_fbdev_init(ddev, bpp, 0);
+	if (ret)
 		goto init_failed;
-	}
 
 	drm_kms_helper_poll_init(ddev);
 
@@ -427,12 +417,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
 	return ret;
 }
 
-static void tilcdc_lastclose(struct drm_device *dev)
-{
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	drm_fbdev_cma_restore_mode(priv->fbdev);
-}
-
 static irqreturn_t tilcdc_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -538,7 +522,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 static struct drm_driver tilcdc_driver = {
 	.driver_features    = (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET |
 			       DRIVER_PRIME | DRIVER_ATOMIC),
-	.lastclose          = tilcdc_lastclose,
+	.lastclose          = drm_fb_helper_lastclose,
 	.irq_handler        = tilcdc_irq,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops         = &drm_gem_cma_vm_ops,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index 8caa11bc7aec..ead512216669 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -79,8 +79,6 @@ struct tilcdc_drm_private {
 
 	struct workqueue_struct *wq;
 
-	struct drm_fbdev_cma *fbdev;
-
 	struct drm_crtc *crtc;
 
 	unsigned int num_encoders;
-- 
2.14.2

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

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

* [PATCH 16/22] drm/tve200: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (14 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 15/22] drm/tilcdc: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06 13:19   ` Linus Walleij
  2017-11-04 13:04 ` [PATCH 17/22] drm/vc4: " Noralf Trønnes
                   ` (6 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/tve200/tve200_drm.h |  1 -
 drivers/gpu/drm/tve200/tve200_drv.c | 16 ++++------------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/tve200/tve200_drm.h b/drivers/gpu/drm/tve200/tve200_drm.h
index 628b79324c48..5c270055bd58 100644
--- a/drivers/gpu/drm/tve200/tve200_drm.h
+++ b/drivers/gpu/drm/tve200/tve200_drm.h
@@ -103,7 +103,6 @@ struct tve200_drm_dev_private {
 	struct drm_panel *panel;
 	struct drm_bridge *bridge;
 	struct drm_simple_display_pipe pipe;
-	struct drm_fbdev_cma *fbdev;
 
 	void *regs;
 	struct clk *pclk;
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index bd6c9454d767..44911d921864 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -46,6 +46,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_of.h>
@@ -130,8 +131,7 @@ static int tve200_modeset_init(struct drm_device *dev)
 	 * Passing in 16 here will make the RGB656 mode the default
 	 * Passing in 32 will use XRGB8888 mode
 	 */
-	priv->fbdev = drm_fbdev_cma_init(dev, 16,
-					 dev->mode_config.num_connector);
+	drm_fb_cma_fbdev_init(dev, 16, 0);
 	drm_kms_helper_poll_init(dev);
 
 	goto finish;
@@ -146,17 +146,10 @@ static int tve200_modeset_init(struct drm_device *dev)
 
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
-static void tve200_lastclose(struct drm_device *dev)
-{
-	struct tve200_drm_dev_private *priv = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(priv->fbdev);
-}
-
 static struct drm_driver tve200_drm_driver = {
 	.driver_features =
 		DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,
-	.lastclose = tve200_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.ioctls = NULL,
 	.fops = &drm_fops,
 	.name = "tve200",
@@ -270,8 +263,7 @@ static int tve200_remove(struct platform_device *pdev)
 	struct tve200_drm_dev_private *priv = drm->dev_private;
 
 	drm_dev_unregister(drm);
-	if (priv->fbdev)
-		drm_fbdev_cma_fini(priv->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 	if (priv->panel)
 		drm_panel_bridge_remove(priv->bridge);
 	drm_mode_config_cleanup(drm);
-- 
2.14.2

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

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

* [PATCH 17/22] drm/vc4: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (15 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 16/22] drm/tve200: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06 16:19   ` Eric Anholt
  2017-11-04 13:04 ` [PATCH 18/22] drm/zte: " Noralf Trønnes
                   ` (5 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 13 ++-----------
 drivers/gpu/drm/vc4/vc4_drv.h |  2 --
 drivers/gpu/drm/vc4/vc4_kms.c | 18 ++++--------------
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index e3c29729da2e..ceb385fd69c5 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -111,13 +111,6 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
-static void vc4_lastclose(struct drm_device *dev)
-{
-	struct vc4_dev *vc4 = to_vc4_dev(dev);
-
-	drm_fbdev_cma_restore_mode(vc4->fbdev);
-}
-
 static const struct vm_operations_struct vc4_vm_ops = {
 	.fault = vc4_fault,
 	.open = drm_gem_vm_open,
@@ -159,7 +152,7 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_HAVE_IRQ |
 			    DRIVER_RENDER |
 			    DRIVER_PRIME),
-	.lastclose = vc4_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.irq_handler = vc4_irq,
 	.irq_preinstall = vc4_irq_preinstall,
 	.irq_postinstall = vc4_irq_postinstall,
@@ -301,12 +294,10 @@ static void vc4_drm_unbind(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct drm_device *drm = platform_get_drvdata(pdev);
-	struct vc4_dev *vc4 = to_vc4_dev(drm);
 
 	drm_dev_unregister(drm);
 
-	if (vc4->fbdev)
-		drm_fbdev_cma_fini(vc4->fbdev);
+	drm_fb_cma_fbdev_fini(drm);
 
 	drm_mode_config_cleanup(drm);
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 9c0d380c96f2..3af22936d9b3 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -39,8 +39,6 @@ struct vc4_dev {
 	struct vc4_dsi *dsi1;
 	struct vc4_vec *vec;
 
-	struct drm_fbdev_cma *fbdev;
-
 	struct vc4_hang_state *hang_state;
 
 	/* The kernel-space BO cache.  Tracks buffers that have been
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 50c4959b5bd3..4256f294c346 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -19,17 +19,11 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_plane_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include "vc4_drv.h"
 
-static void vc4_output_poll_changed(struct drm_device *dev)
-{
-	struct vc4_dev *vc4 = to_vc4_dev(dev);
-
-	drm_fbdev_cma_hotplug_event(vc4->fbdev);
-}
-
 static void
 vc4_atomic_complete_commit(struct drm_atomic_state *state)
 {
@@ -194,7 +188,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev,
 }
 
 static const struct drm_mode_config_funcs vc4_mode_funcs = {
-	.output_poll_changed = vc4_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = vc4_atomic_commit,
 	.fb_create = vc4_fb_create,
@@ -224,12 +218,8 @@ int vc4_kms_load(struct drm_device *dev)
 
 	drm_mode_config_reset(dev);
 
-	if (dev->mode_config.num_connector) {
-		vc4->fbdev = drm_fbdev_cma_init(dev, 32,
-						dev->mode_config.num_connector);
-		if (IS_ERR(vc4->fbdev))
-			vc4->fbdev = NULL;
-	}
+	if (dev->mode_config.num_connector)
+		drm_fb_cma_fbdev_init(dev, 32, 0);
 
 	drm_kms_helper_poll_init(dev);
 
-- 
2.14.2

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

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

* [PATCH 18/22] drm/zte: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (16 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 17/22] drm/vc4: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-04 13:04 ` [PATCH 19/22] drm/arm/mali: " Noralf Trønnes
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/zte/zx_drm_drv.c | 48 +++++-----------------------------------
 1 file changed, 6 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index e8b8266c0cde..6f4205e80378 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -29,37 +29,19 @@
 #include "zx_drm_drv.h"
 #include "zx_vou.h"
 
-struct zx_drm_private {
-	struct drm_fbdev_cma *fbdev;
-};
-
-static void zx_drm_fb_output_poll_changed(struct drm_device *drm)
-{
-	struct zx_drm_private *priv = drm->dev_private;
-
-	drm_fbdev_cma_hotplug_event(priv->fbdev);
-}
-
 static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = zx_drm_fb_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
-static void zx_drm_lastclose(struct drm_device *drm)
-{
-	struct zx_drm_private *priv = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(priv->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
 
 static struct drm_driver zx_drm_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.lastclose = zx_drm_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
@@ -83,18 +65,12 @@ static struct drm_driver zx_drm_driver = {
 static int zx_drm_bind(struct device *dev)
 {
 	struct drm_device *drm;
-	struct zx_drm_private *priv;
 	int ret;
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
-		return -ENOMEM;
-
 	drm = drm_dev_alloc(&zx_drm_driver, dev);
 	if (IS_ERR(drm))
 		return PTR_ERR(drm);
 
-	drm->dev_private = priv;
 	dev_set_drvdata(dev, drm);
 
 	drm_mode_config_init(drm);
@@ -125,12 +101,9 @@ static int zx_drm_bind(struct device *dev)
 	drm_mode_config_reset(drm);
 	drm_kms_helper_poll_init(drm);
 
-	priv->fbdev = drm_fbdev_cma_init(drm, 32,
-					 drm->mode_config.num_connector);
-	if (IS_ERR(priv->fbdev)) {
-		ret = PTR_ERR(priv->fbdev);
+	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
+	if (ret) {
 		DRM_DEV_ERROR(dev, "failed to init cma fbdev: %d\n", ret);
-		priv->fbdev = NULL;
 		goto out_poll_fini;
 	}
 
@@ -141,10 +114,7 @@ static int zx_drm_bind(struct device *dev)
 	return 0;
 
 out_fbdev_fini:
-	if (priv->fbdev) {
-		drm_fbdev_cma_fini(priv->fbdev);
-		priv->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 out_poll_fini:
 	drm_kms_helper_poll_fini(drm);
 	drm_mode_config_cleanup(drm);
@@ -152,7 +122,6 @@ static int zx_drm_bind(struct device *dev)
 	component_unbind_all(dev, drm);
 out_unregister:
 	dev_set_drvdata(dev, NULL);
-	drm->dev_private = NULL;
 	drm_dev_unref(drm);
 	return ret;
 }
@@ -160,18 +129,13 @@ static int zx_drm_bind(struct device *dev)
 static void zx_drm_unbind(struct device *dev)
 {
 	struct drm_device *drm = dev_get_drvdata(dev);
-	struct zx_drm_private *priv = drm->dev_private;
 
 	drm_dev_unregister(drm);
-	if (priv->fbdev) {
-		drm_fbdev_cma_fini(priv->fbdev);
-		priv->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 	drm_kms_helper_poll_fini(drm);
 	drm_mode_config_cleanup(drm);
 	component_unbind_all(dev, drm);
 	dev_set_drvdata(dev, NULL);
-	drm->dev_private = NULL;
 	drm_dev_unref(drm);
 }
 
-- 
2.14.2

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

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

* [PATCH 19/22] drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (17 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 18/22] drm/zte: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-05 14:31   ` Liviu Dudau
  2017-11-04 13:04 ` [PATCH 20/22] drm/fsl-dcu: " Noralf Trønnes
                   ` (3 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/arm/malidp_drv.c | 39 +++++++--------------------------------
 drivers/gpu/drm/arm/malidp_drv.h |  1 -
 2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 75f0bce33941..65ecc49c5862 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/component.h>
-#include <linux/console.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/of_reserved_mem.h>
@@ -24,6 +23,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -183,13 +183,6 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm)
 	return (ret > 0) ? 0 : -ETIMEDOUT;
 }
 
-static void malidp_output_poll_changed(struct drm_device *drm)
-{
-	struct malidp_drm *malidp = drm->dev_private;
-
-	drm_fbdev_cma_hotplug_event(malidp->fbdev);
-}
-
 static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
 {
 	struct drm_pending_vblank_event *event;
@@ -252,7 +245,7 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = {
 
 static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
-	.output_poll_changed = malidp_output_poll_changed,
+	.output_poll_changed = drm_fb_helper_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -317,19 +310,12 @@ static int malidp_irq_init(struct platform_device *pdev)
 	return 0;
 }
 
-static void malidp_lastclose(struct drm_device *drm)
-{
-	struct malidp_drm *malidp = drm->dev_private;
-
-	drm_fbdev_cma_restore_mode(malidp->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver malidp_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
 			   DRIVER_PRIME,
-	.lastclose = malidp_lastclose,
+	.lastclose = drm_fb_helper_lastclose,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
@@ -627,14 +613,9 @@ static int malidp_bind(struct device *dev)
 
 	drm_mode_config_reset(drm);
 
-	malidp->fbdev = drm_fbdev_cma_init(drm, 32,
-					   drm->mode_config.num_connector);
-
-	if (IS_ERR(malidp->fbdev)) {
-		ret = PTR_ERR(malidp->fbdev);
-		malidp->fbdev = NULL;
+	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
+	if (ret)
 		goto fbdev_fail;
-	}
 
 	drm_kms_helper_poll_init(drm);
 
@@ -645,10 +626,7 @@ static int malidp_bind(struct device *dev)
 	return 0;
 
 register_fail:
-	if (malidp->fbdev) {
-		drm_fbdev_cma_fini(malidp->fbdev);
-		malidp->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 	drm_kms_helper_poll_fini(drm);
 fbdev_fail:
 	pm_runtime_get_sync(dev);
@@ -685,10 +663,7 @@ static void malidp_unbind(struct device *dev)
 	struct malidp_drm *malidp = drm->dev_private;
 
 	drm_dev_unregister(drm);
-	if (malidp->fbdev) {
-		drm_fbdev_cma_fini(malidp->fbdev);
-		malidp->fbdev = NULL;
-	}
+	drm_fb_cma_fbdev_fini(drm);
 	drm_kms_helper_poll_fini(drm);
 	pm_runtime_get_sync(dev);
 	malidp_se_irq_fini(drm);
diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 70ed6aeccf05..e0d12c9fc6b8 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -20,7 +20,6 @@
 
 struct malidp_drm {
 	struct malidp_hw_device *dev;
-	struct drm_fbdev_cma *fbdev;
 	struct drm_crtc crtc;
 	wait_queue_head_t wq;
 	atomic_t config_valid;
-- 
2.14.2

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

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

* [PATCH 20/22] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (18 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 19/22] drm/arm/mali: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-10 17:01   ` Stefan Agner
  2017-11-04 13:04 ` [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() Noralf Trønnes
                   ` (2 subsequent siblings)
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@freescale.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++--------------------
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
 2 files changed, 6 insertions(+), 21 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 1a9ee657bbac..45a44bb7a2e4 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -11,7 +11,6 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
-#include <linux/console.h>
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mm.h>
@@ -25,6 +24,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_modeset_helper.h>
@@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 			"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
 		legacyfb_depth = 24;
 	}
-	fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
-	if (IS_ERR(fsl_dev->fbdev)) {
-		ret = PTR_ERR(fsl_dev->fbdev);
-		fsl_dev->fbdev = NULL;
+	ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1);
+	if (ret)
 		goto done;
-	}
 
 	return 0;
 done:
 	drm_kms_helper_poll_fini(dev);
 
-	if (fsl_dev->fbdev)
-		drm_fbdev_cma_fini(fsl_dev->fbdev);
+	drm_fb_cma_fbdev_fini(dev);
 
 	drm_mode_config_cleanup(dev);
 	drm_irq_uninstall(dev);
@@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 
 static void fsl_dcu_unload(struct drm_device *dev)
 {
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
 	drm_atomic_helper_shutdown(dev);
 	drm_kms_helper_poll_fini(dev);
 
-	if (fsl_dev->fbdev)
-		drm_fbdev_cma_fini(fsl_dev->fbdev);
+	drm_fb_cma_fbdev_fini(dev);
 
 	drm_mode_config_cleanup(dev);
 	drm_irq_uninstall(dev);
@@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-static void fsl_dcu_drm_lastclose(struct drm_device *dev)
-{
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
-	drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
 static struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
 				| DRIVER_PRIME | DRIVER_ATOMIC,
-	.lastclose		= fsl_dcu_drm_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
 	.irq_handler		= fsl_dcu_drm_irq,
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 93bfb98012d4..cb87bb74cb87 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
 	/*protects hardware register*/
 	spinlock_t irq_lock;
 	struct drm_device *drm;
-	struct drm_fbdev_cma *fbdev;
 	struct drm_crtc crtc;
 	struct drm_encoder encoder;
 	struct fsl_dcu_drm_connector connector;
-- 
2.14.2

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

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

* [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (19 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 20/22] drm/fsl-dcu: " Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06 18:05   ` David Lechner
  2017-11-04 13:04 ` [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
  2017-11-10 18:12 ` [PATCH 00/22] " Noralf Trønnes
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Use drm_fb_cma_fbdev_init_with_funcs() and drm_fb_cma_fbdev_fini() which
relies on the fact that drm_device holds a pointer to the drm_fb_helper
structure. This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove todo entry.

Cc: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 Documentation/gpu/todo.rst                  |  5 ----
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 37 ++++-------------------------
 drivers/gpu/drm/tinydrm/mi0283qt.c          |  3 ++-
 drivers/gpu/drm/tinydrm/st7586.c            |  3 ++-
 include/drm/tinydrm/tinydrm.h               |  3 ---
 5 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 6bce1beafabe..6dbcd4a90015 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -395,11 +395,6 @@ those drivers as simple as possible, so lots of room for refactoring:
   one of the ideas for having a shared dsi/dbi helper, abstracting away the
   transport details more.
 
-- tinydrm_lastclose could be drm_fb_helper_lastclose. Only thing we need
-  for that is to store the drm_fb_helper pointer somewhere in
-  drm_device->mode_config. And then we could roll that out to all the
-  drivers.
-
 - tinydrm_gem_cma_prime_import_sg_table should probably go into the cma
   helpers, as a _vmapped variant (since not every driver needs the vmap).
   And tinydrm_gem_cma_free_object could the be merged into
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
index bd7b82824a34..4c6616278c48 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
@@ -10,6 +10,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/tinydrm.h>
 #include <linux/device.h>
@@ -35,23 +36,6 @@
  * and registers the DRM device using devm_tinydrm_register().
  */
 
-/**
- * tinydrm_lastclose - DRM lastclose helper
- * @drm: DRM device
- *
- * This function ensures that fbdev is restored when drm_lastclose() is called
- * on the last drm_release(). Drivers can use this as their
- * &drm_driver->lastclose callback.
- */
-void tinydrm_lastclose(struct drm_device *drm)
-{
-	struct tinydrm_device *tdev = drm->dev_private;
-
-	DRM_DEBUG_KMS("\n");
-	drm_fbdev_cma_restore_mode(tdev->fbdev_cma);
-}
-EXPORT_SYMBOL(tinydrm_lastclose);
-
 /**
  * tinydrm_gem_cma_prime_import_sg_table - Produce a CMA GEM object from
  *     another driver's scatter/gather table of pinned pages
@@ -214,35 +198,24 @@ EXPORT_SYMBOL(devm_tinydrm_init);
 static int tinydrm_register(struct tinydrm_device *tdev)
 {
 	struct drm_device *drm = tdev->drm;
-	int bpp = drm->mode_config.preferred_depth;
-	struct drm_fbdev_cma *fbdev;
 	int ret;
 
 	ret = drm_dev_register(tdev->drm, 0);
 	if (ret)
 		return ret;
 
-	fbdev = drm_fbdev_cma_init_with_funcs(drm, bpp ? bpp : 32,
-					      drm->mode_config.num_connector,
-					      tdev->fb_funcs);
-	if (IS_ERR(fbdev))
-		DRM_ERROR("Failed to initialize fbdev: %ld\n", PTR_ERR(fbdev));
-	else
-		tdev->fbdev_cma = fbdev;
+	ret = drm_fb_cma_fbdev_init_with_funcs(drm, 0, 0, tdev->fb_funcs);
+	if (ret)
+		DRM_ERROR("Failed to initialize fbdev: %d\n", ret);
 
 	return 0;
 }
 
 static void tinydrm_unregister(struct tinydrm_device *tdev)
 {
-	struct drm_fbdev_cma *fbdev_cma = tdev->fbdev_cma;
-
 	drm_atomic_helper_shutdown(tdev->drm);
-	/* don't restore fbdev in lastclose, keep pipeline disabled */
-	tdev->fbdev_cma = NULL;
+	drm_fb_cma_fbdev_fini(tdev->drm);
 	drm_dev_unregister(tdev->drm);
-	if (fbdev_cma)
-		drm_fbdev_cma_fini(fbdev_cma);
 }
 
 static void devm_tinydrm_register_release(void *data)
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 70ae4f76f455..674d407640be 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -9,6 +9,7 @@
  * (at your option) any later version.
  */
 
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/tinydrm/ili9341.h>
 #include <drm/tinydrm/mipi-dbi.h>
@@ -140,7 +141,7 @@ static struct drm_driver mi0283qt_driver = {
 				  DRIVER_ATOMIC,
 	.fops			= &mi0283qt_fops,
 	TINYDRM_GEM_DRIVER_OPS,
-	.lastclose		= tinydrm_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "mi0283qt",
 	.desc			= "Multi-Inno MI0283QT",
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c
index 0a2c60da5c0e..5aebfceb740e 100644
--- a/drivers/gpu/drm/tinydrm/st7586.c
+++ b/drivers/gpu/drm/tinydrm/st7586.c
@@ -17,6 +17,7 @@
 #include <linux/spi/spi.h>
 #include <video/mipi_display.h>
 
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/tinydrm/mipi-dbi.h>
 #include <drm/tinydrm/tinydrm-helpers.h>
@@ -320,7 +321,7 @@ static struct drm_driver st7586_driver = {
 				  DRIVER_ATOMIC,
 	.fops			= &st7586_fops,
 	TINYDRM_GEM_DRIVER_OPS,
-	.lastclose		= tinydrm_lastclose,
+	.lastclose		= drm_fb_helper_lastclose,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "st7586",
 	.desc			= "Sitronix ST7586",
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
index fb0d86600ea3..584be2bcade1 100644
--- a/include/drm/tinydrm/tinydrm.h
+++ b/include/drm/tinydrm/tinydrm.h
@@ -19,14 +19,12 @@
  * @drm: DRM device
  * @pipe: Display pipe structure
  * @dirty_lock: Serializes framebuffer flushing
- * @fbdev_cma: CMA fbdev structure
  * @fb_funcs: Framebuffer functions used when creating framebuffers
  */
 struct tinydrm_device {
 	struct drm_device *drm;
 	struct drm_simple_display_pipe pipe;
 	struct mutex dirty_lock;
-	struct drm_fbdev_cma *fbdev_cma;
 	const struct drm_framebuffer_funcs *fb_funcs;
 };
 
@@ -79,7 +77,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	.type = DRM_MODE_TYPE_DRIVER, \
 	.clock = 1 /* pass validation */
 
-void tinydrm_lastclose(struct drm_device *drm);
 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj);
 struct drm_gem_object *
 tinydrm_gem_cma_prime_import_sg_table(struct drm_device *drm,
-- 
2.14.2

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

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

* [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (20 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() Noralf Trønnes
@ 2017-11-04 13:04 ` Noralf Trønnes
  2017-11-06  9:09   ` Daniel Vetter
  2017-11-10 18:12 ` [PATCH 00/22] " Noralf Trønnes
  22 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-04 13:04 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

Remove the unused struct drm_fbdev_cma functions.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 158 ------------------------------------
 include/drm/drm_fb_cma_helper.h     |  28 +------
 2 files changed, 3 insertions(+), 183 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 267c04216281..0c73957d7aad 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -425,161 +425,3 @@ void drm_fb_cma_fbdev_fini(struct drm_device *dev)
 	kfree(to_fbdev_cma(fb_helper));
 }
 EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
-
-/**
- * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device
- * @max_conn_count: Maximum number of connectors
- * @funcs: fb helper functions, in particular a custom dirty() callback
- *
- * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
- */
-struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count,
-	const struct drm_framebuffer_funcs *funcs)
-{
-	struct drm_fbdev_cma *fbdev_cma;
-	struct drm_fb_helper *helper;
-	int ret;
-
-	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
-	if (!fbdev_cma) {
-		dev_err(dev->dev, "Failed to allocate drm fbdev.\n");
-		return ERR_PTR(-ENOMEM);
-	}
-	fbdev_cma->fb_funcs = funcs;
-
-	helper = &fbdev_cma->fb_helper;
-
-	drm_fb_helper_prepare(dev, helper, &drm_fb_cma_helper_funcs);
-
-	ret = drm_fb_helper_init(dev, helper, max_conn_count);
-	if (ret < 0) {
-		dev_err(dev->dev, "Failed to initialize drm fb helper.\n");
-		goto err_free;
-	}
-
-	ret = drm_fb_helper_single_add_all_connectors(helper);
-	if (ret < 0) {
-		dev_err(dev->dev, "Failed to add connectors.\n");
-		goto err_drm_fb_helper_fini;
-
-	}
-
-	ret = drm_fb_helper_initial_config(helper, preferred_bpp);
-	if (ret < 0) {
-		dev_err(dev->dev, "Failed to set initial hw configuration.\n");
-		goto err_drm_fb_helper_fini;
-	}
-
-	return fbdev_cma;
-
-err_drm_fb_helper_fini:
-	drm_fb_helper_fini(helper);
-err_free:
-	kfree(fbdev_cma);
-
-	return ERR_PTR(ret);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);
-
-static const struct drm_framebuffer_funcs drm_fb_cma_funcs = {
-	.destroy	= drm_gem_fb_destroy,
-	.create_handle	= drm_gem_fb_create_handle,
-};
-
-/**
- * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device
- * @max_conn_count: Maximum number of connectors
- *
- * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
- */
-struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count)
-{
-	return drm_fbdev_cma_init_with_funcs(dev, preferred_bpp,
-					     max_conn_count,
-					     &drm_fb_cma_funcs);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
-
-/**
- * drm_fbdev_cma_fini() - Free drm_fbdev_cma struct
- * @fbdev_cma: The drm_fbdev_cma struct
- */
-void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
-{
-	drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
-	if (fbdev_cma->fb_helper.fbdev)
-		drm_fbdev_cma_defio_fini(fbdev_cma->fb_helper.fbdev);
-
-	if (fbdev_cma->fb_helper.fb)
-		drm_framebuffer_remove(fbdev_cma->fb_helper.fb);
-
-	drm_fb_helper_fini(&fbdev_cma->fb_helper);
-	kfree(fbdev_cma);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini);
-
-/**
- * drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- *
- * This function is usually called from the &drm_driver.lastclose callback.
- */
-void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma)
-{
-	if (fbdev_cma)
-		drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode);
-
-/**
- * drm_fbdev_cma_hotplug_event() - Poll for hotpulug events
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- *
- * This function is usually called from the &drm_mode_config.output_poll_changed
- * callback.
- */
-void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
-{
-	if (fbdev_cma)
-		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
-}
-EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
-
-/**
- * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- * @state: desired state, zero to resume, non-zero to suspend
- *
- * Calls drm_fb_helper_set_suspend, which is a wrapper around
- * fb_set_suspend implemented by fbdev core.
- */
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
-{
-	if (fbdev_cma)
-		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
-}
-EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
-
-/**
- * drm_fbdev_cma_set_suspend_unlocked - wrapper around
- *                                      drm_fb_helper_set_suspend_unlocked
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- * @state: desired state, zero to resume, non-zero to suspend
- *
- * Calls drm_fb_helper_set_suspend, which is a wrapper around
- * fb_set_suspend implemented by fbdev core.
- */
-void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					bool state)
-{
-	if (fbdev_cma)
-		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
-						   state);
-}
-EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 22be22e641a4..e0ed0ce29c03 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -1,18 +1,10 @@
 #ifndef __DRM_FB_CMA_HELPER_H__
 #define __DRM_FB_CMA_HELPER_H__
 
-struct drm_fbdev_cma;
-struct drm_gem_cma_object;
-
-struct drm_fb_helper_surface_size;
-struct drm_framebuffer_funcs;
-struct drm_fb_helper_funcs;
-struct drm_framebuffer;
-struct drm_fb_helper;
 struct drm_device;
-struct drm_file;
-struct drm_mode_fb_cmd2;
-struct drm_plane;
+struct drm_framebuffer;
+struct drm_framebuffer_funcs;
+struct drm_gem_cma_object;
 struct drm_plane_state;
 
 int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
@@ -22,19 +14,6 @@ int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
 			  unsigned int max_conn_count);
 void drm_fb_cma_fbdev_fini(struct drm_device *dev);
 
-struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count,
-	const struct drm_framebuffer_funcs *funcs);
-struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
-	unsigned int preferred_bpp, unsigned int max_conn_count);
-void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
-
-void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
-void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
-void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					bool state);
-
 struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
 	unsigned int plane);
 
@@ -49,4 +28,3 @@ int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg);
 #endif
 
 #endif
-
-- 
2.14.2

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

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

* Re: [PATCH 04/22] drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 ` [PATCH 04/22] drm/arm/hdlcd: " Noralf Trønnes
@ 2017-11-05 14:27   ` Liviu Dudau
  0 siblings, 0 replies; 49+ messages in thread
From: Liviu Dudau @ 2017-11-05 14:27 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, laurent.pinchart, marex, boris.brezillon, abrodkin,
	z.liuxinliang, kong.kongxinwei, tomi.valkeinen, david, puck.chen,
	jsarha, dri-devel, vincent.abriou, alison.wang, philippe.cornu,
	yannick.fertre, zourongrong, maxime.ripard, shawnguo

Hi Noralf,

On Sat, Nov 04, 2017 at 02:03:58PM +0100, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Looks good! Thanks for the cleanup!

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Let me know if you want me to pull this patch into the HDLCD tree or if
you are OK to carry the whole series through the drm-misc tree.

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/hdlcd_drv.c | 37 ++++++-------------------------------
>  drivers/gpu/drm/arm/hdlcd_drv.h |  1 -
>  2 files changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 764d0c83710c..fe963072b6f5 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -99,16 +99,9 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  	return ret;
>  }
>  
> -static void hdlcd_fb_output_poll_changed(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -
> -	drm_fbdev_cma_hotplug_event(hdlcd->fbdev);
> -}
> -
>  static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
> -	.output_poll_changed = hdlcd_fb_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = drm_atomic_helper_check,
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
> @@ -123,13 +116,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>  	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>  }
>  
> -static void hdlcd_lastclose(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -
> -	drm_fbdev_cma_restore_mode(hdlcd->fbdev);
> -}
> -
>  static irqreturn_t hdlcd_irq(int irq, void *arg)
>  {
>  	struct drm_device *drm = arg;
> @@ -246,7 +232,7 @@ static struct drm_driver hdlcd_driver = {
>  	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
>  			   DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
> -	.lastclose = hdlcd_lastclose,
> +	.lastclose = drm_fb_helper_lastclose,
>  	.irq_handler = hdlcd_irq,
>  	.irq_preinstall = hdlcd_irq_preinstall,
>  	.irq_postinstall = hdlcd_irq_postinstall,
> @@ -320,14 +306,9 @@ static int hdlcd_drm_bind(struct device *dev)
>  	drm_mode_config_reset(drm);
>  	drm_kms_helper_poll_init(drm);
>  
> -	hdlcd->fbdev = drm_fbdev_cma_init(drm, 32,
> -					  drm->mode_config.num_connector);
> -
> -	if (IS_ERR(hdlcd->fbdev)) {
> -		ret = PTR_ERR(hdlcd->fbdev);
> -		hdlcd->fbdev = NULL;
> +	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
> +	if (ret)
>  		goto err_fbdev;
> -	}
>  
>  	ret = drm_dev_register(drm, 0);
>  	if (ret)
> @@ -336,10 +317,7 @@ static int hdlcd_drm_bind(struct device *dev)
>  	return 0;
>  
>  err_register:
> -	if (hdlcd->fbdev) {
> -		drm_fbdev_cma_fini(hdlcd->fbdev);
> -		hdlcd->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(drm);
>  err_fbdev:
>  	drm_kms_helper_poll_fini(drm);
>  err_vblank:
> @@ -365,10 +343,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>  	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>  
>  	drm_dev_unregister(drm);
> -	if (hdlcd->fbdev) {
> -		drm_fbdev_cma_fini(hdlcd->fbdev);
> -		hdlcd->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(drm);
>  	drm_kms_helper_poll_fini(drm);
>  	component_unbind_all(dev, drm);
>  	of_node_put(hdlcd->crtc.port);
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
> index e3950a071152..a9f0b4350d95 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
> @@ -8,7 +8,6 @@
>  struct hdlcd_drm_private {
>  	void __iomem			*mmio;
>  	struct clk			*clk;
> -	struct drm_fbdev_cma		*fbdev;
>  	struct drm_crtc			crtc;
>  	struct drm_plane		*plane;
>  	struct drm_atomic_state		*state;
> -- 
> 2.14.2
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 19/22] drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 19/22] drm/arm/mali: " Noralf Trønnes
@ 2017-11-05 14:31   ` Liviu Dudau
  0 siblings, 0 replies; 49+ messages in thread
From: Liviu Dudau @ 2017-11-05 14:31 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, laurent.pinchart, marex, boris.brezillon, abrodkin,
	z.liuxinliang, kong.kongxinwei, tomi.valkeinen, david, puck.chen,
	jsarha, dri-devel, vincent.abriou, alison.wang, philippe.cornu,
	yannick.fertre, zourongrong, maxime.ripard, shawnguo

On Sat, Nov 04, 2017 at 02:04:13PM +0100, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Again, let me know if you don't want to carry this patch through
drm-misc and I will pull it into the mali-dp tree.

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 39 +++++++--------------------------------
>  drivers/gpu/drm/arm/malidp_drv.h |  1 -
>  2 files changed, 7 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 75f0bce33941..65ecc49c5862 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -13,7 +13,6 @@
>  #include <linux/module.h>
>  #include <linux/clk.h>
>  #include <linux/component.h>
> -#include <linux/console.h>
>  #include <linux/of_device.h>
>  #include <linux/of_graph.h>
>  #include <linux/of_reserved_mem.h>
> @@ -24,6 +23,7 @@
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> @@ -183,13 +183,6 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm)
>  	return (ret > 0) ? 0 : -ETIMEDOUT;
>  }
>  
> -static void malidp_output_poll_changed(struct drm_device *drm)
> -{
> -	struct malidp_drm *malidp = drm->dev_private;
> -
> -	drm_fbdev_cma_hotplug_event(malidp->fbdev);
> -}
> -
>  static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
>  {
>  	struct drm_pending_vblank_event *event;
> @@ -252,7 +245,7 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = {
>  
>  static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
> -	.output_poll_changed = malidp_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = drm_atomic_helper_check,
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
> @@ -317,19 +310,12 @@ static int malidp_irq_init(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static void malidp_lastclose(struct drm_device *drm)
> -{
> -	struct malidp_drm *malidp = drm->dev_private;
> -
> -	drm_fbdev_cma_restore_mode(malidp->fbdev);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static struct drm_driver malidp_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
>  			   DRIVER_PRIME,
> -	.lastclose = malidp_lastclose,
> +	.lastclose = drm_fb_helper_lastclose,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
>  	.gem_vm_ops = &drm_gem_cma_vm_ops,
>  	.dumb_create = drm_gem_cma_dumb_create,
> @@ -627,14 +613,9 @@ static int malidp_bind(struct device *dev)
>  
>  	drm_mode_config_reset(drm);
>  
> -	malidp->fbdev = drm_fbdev_cma_init(drm, 32,
> -					   drm->mode_config.num_connector);
> -
> -	if (IS_ERR(malidp->fbdev)) {
> -		ret = PTR_ERR(malidp->fbdev);
> -		malidp->fbdev = NULL;
> +	ret = drm_fb_cma_fbdev_init(drm, 32, 0);
> +	if (ret)
>  		goto fbdev_fail;
> -	}
>  
>  	drm_kms_helper_poll_init(drm);
>  
> @@ -645,10 +626,7 @@ static int malidp_bind(struct device *dev)
>  	return 0;
>  
>  register_fail:
> -	if (malidp->fbdev) {
> -		drm_fbdev_cma_fini(malidp->fbdev);
> -		malidp->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(drm);
>  	drm_kms_helper_poll_fini(drm);
>  fbdev_fail:
>  	pm_runtime_get_sync(dev);
> @@ -685,10 +663,7 @@ static void malidp_unbind(struct device *dev)
>  	struct malidp_drm *malidp = drm->dev_private;
>  
>  	drm_dev_unregister(drm);
> -	if (malidp->fbdev) {
> -		drm_fbdev_cma_fini(malidp->fbdev);
> -		malidp->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(drm);
>  	drm_kms_helper_poll_fini(drm);
>  	pm_runtime_get_sync(dev);
>  	malidp_se_irq_fini(drm);
> diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
> index 70ed6aeccf05..e0d12c9fc6b8 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.h
> +++ b/drivers/gpu/drm/arm/malidp_drv.h
> @@ -20,7 +20,6 @@
>  
>  struct malidp_drm {
>  	struct malidp_hw_device *dev;
> -	struct drm_fbdev_cma *fbdev;
>  	struct drm_crtc crtc;
>  	wait_queue_head_t wq;
>  	atomic_t config_valid;
> -- 
> 2.14.2
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 14/22] drm/sun4i: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 14/22] drm/sun4i: " Noralf Trønnes
@ 2017-11-06  7:51   ` Maxime Ripard
  0 siblings, 0 replies; 49+ messages in thread
From: Maxime Ripard @ 2017-11-06  7:51 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, dri-devel,
	vincent.abriou, alison.wang, philippe.cornu, yannick.fertre,
	zourongrong, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 631 bytes --]

On Sat, Nov 04, 2017 at 02:04:08PM +0100, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 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] 49+ messages in thread

* Re: [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
  2017-11-04 13:03 ` [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional Noralf Trønnes
@ 2017-11-06  8:54   ` Daniel Vetter
  2017-11-06 12:40     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Daniel Vetter @ 2017-11-06  8:54 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre

On Sat, Nov 04, 2017 at 02:03:55PM +0100, Noralf Trønnes wrote:
> Make the drm_framebuffer_funcs argument optional for drivers that
> don't need to set the dirty callback.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Looks like this patch ended up in the wrong patch series? Atm there's not
much users of this (I guess they're still waiting for acks), and somehow
I'd expect that there's some drivers which really want this (but I don't
see any in this patch series). Looks good, but I'm a bit confused.
-Daniel

> ---
>  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> index aa8cb9bfa499..4d682a6e8bcb 100644
> --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> @@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
>   * @sizes: fbdev size description
>   * @pitch_align: Optional pitch alignment
>   * @obj: GEM object backing the framebuffer
> - * @funcs: vtable to be used for the new framebuffer object
> + * @funcs: Optional vtable to be used for the new framebuffer object when the
> + *         dirty callback is needed.
>   *
>   * This function creates a framebuffer from a &drm_fb_helper_surface_size
>   * description for use in the &drm_fb_helper_funcs.fb_probe callback.
> @@ -300,6 +301,9 @@ drm_gem_fbdev_fb_create(struct drm_device *dev,
>  	if (obj->size < mode_cmd.pitches[0] * mode_cmd.height)
>  		return ERR_PTR(-EINVAL);
>  
> +	if (!funcs)
> +		funcs = &drm_gem_fb_funcs;
> +
>  	return drm_gem_fb_alloc(dev, &mode_cmd, &obj, 1, funcs);
>  }
>  EXPORT_SYMBOL(drm_gem_fbdev_fb_create);
> -- 
> 2.14.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 ` [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini() Noralf Trønnes
@ 2017-11-06  9:04   ` Daniel Vetter
  2017-11-06 12:40     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Daniel Vetter @ 2017-11-06  9:04 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre

On Sat, Nov 04, 2017 at 02:03:56PM +0100, Noralf Trønnes wrote:
> Add functions drm_fb_cma_fbdev_init(), drm_fb_cma_fbdev_fini() and
> drm_fb_cma_fbdev_init_with_funcs(). These functions relies on the fact
> that the drm_fb_helper struct is stored in dev->drm_fb_helper_private
> so drivers don't need to store it.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

I guess you've proven me wrong, since at the end of this patch series we
do have some neat functions that do the same thing an earlier patch series
did, expect there's a _cma_ in the name. But the function itself is 100%
generic.

Sry for all the meandering, I guess this once again shows that any problem
in software can indeed be solved by adding another abstraction layer on
top. You'll probably be slightly mad, but I'd vote for the patch to drop
the _cma_ infix again (once everything has landed, no need to respin all
the patches again).


> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 116 +++++++++++++++++++++++++++++++++++-
>  include/drm/drm_fb_cma_helper.h     |   7 +++
>  2 files changed, 121 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 0e3c14174d08..267c04216281 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -23,6 +23,7 @@
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
> +#include <drm/drm_print.h>
>  #include <linux/module.h>
>  
>  #define DEFAULT_FBDEFIO_DELAY_MS 50
> @@ -42,7 +43,7 @@ struct drm_fbdev_cma {
>   * callback function to create a cma backed framebuffer.
>   *
>   * An fbdev framebuffer backed by cma is also available by calling
> - * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
> + * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down.
>   * If the &drm_framebuffer_funcs.dirty callback is set, fb_deferred_io will be
>   * set up automatically. &drm_framebuffer_funcs.dirty is called by
>   * drm_fb_helper_deferred_io() in process context (&struct delayed_work).
> @@ -68,7 +69,7 @@ struct drm_fbdev_cma {
>   *
>   * Initialize::
>   *
> - *     fbdev = drm_fbdev_cma_init_with_funcs(dev, 16,
> + *     fbdev = drm_fb_cma_fbdev_init_with_funcs(dev, 16,
>   *                                           dev->mode_config.num_crtc,
>   *                                           dev->mode_config.num_connector,
>   *                                           &driver_fb_funcs);
> @@ -314,6 +315,117 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
>  	.fb_probe = drm_fbdev_cma_create,
>  };
>  
> +/**
> + * drm_fb_cma_fbdev_init_with_funcs() - Allocate and initialize fbdev emulation
> + * @dev: DRM device
> + * @preferred_bpp: Preferred bits per pixel for the device.
> + *                 @dev->mode_config.preferred_depth is used if this is zero.
> + * @max_conn_count: Maximum number of connectors.
> + *                  @dev->mode_config.num_connector is used if this is zero.
> + * @funcs: Framebuffer functions, in particular a custom dirty() callback.

With the previous patch this is allowed to be NULL, right? Please
document.

And since that also explains the patch 1, on both patches:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

But please get an ack from Laurent too.
-Daniel

> + *
> + * Returns:
> + * Zero on success or negative error code on failure.
> + */
> +int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
> +	unsigned int preferred_bpp, unsigned int max_conn_count,
> +	const struct drm_framebuffer_funcs *funcs)
> +{
> +	struct drm_fbdev_cma *fbdev_cma;
> +	struct drm_fb_helper *fb_helper;
> +	int ret;
> +
> +	if (!preferred_bpp)
> +		preferred_bpp = dev->mode_config.preferred_depth;
> +	if (!preferred_bpp)
> +		preferred_bpp = 32;
> +
> +	if (!max_conn_count)
> +		max_conn_count = dev->mode_config.num_connector;
> +
> +	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
> +	if (!fbdev_cma)
> +		return -ENOMEM;
> +
> +	fbdev_cma->fb_funcs = funcs;
> +	fb_helper = &fbdev_cma->fb_helper;
> +
> +	drm_fb_helper_prepare(dev, fb_helper, &drm_fb_cma_helper_funcs);
> +
> +	ret = drm_fb_helper_init(dev, fb_helper, max_conn_count);
> +	if (ret < 0) {
> +		DRM_DEV_ERROR(dev->dev, "Failed to initialize fbdev helper.\n");
> +		goto err_free;
> +	}
> +
> +	ret = drm_fb_helper_single_add_all_connectors(fb_helper);
> +	if (ret < 0) {
> +		DRM_DEV_ERROR(dev->dev, "Failed to add connectors.\n");
> +		goto err_drm_fb_helper_fini;
> +	}
> +
> +	ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp);
> +	if (ret < 0) {
> +		DRM_DEV_ERROR(dev->dev, "Failed to set fbdev configuration.\n");
> +		goto err_drm_fb_helper_fini;
> +	}
> +
> +	return 0;
> +
> +err_drm_fb_helper_fini:
> +	drm_fb_helper_fini(fb_helper);
> +err_free:
> +	kfree(fbdev_cma);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init_with_funcs);
> +
> +/**
> + * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation
> + * @dev: DRM device
> + * @preferred_bpp: Preferred bits per pixel for the device.
> + *                 @dev->mode_config.preferred_depth is used if this is zero.
> + * @max_conn_count: Maximum number of connectors.
> + *                  @dev->mode_config.num_connector is used if this is zero.
> + *
> + * Returns:
> + * Zero on success or negative error code on failure.
> + */
> +int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
> +			  unsigned int max_conn_count)
> +{
> +	return drm_fb_cma_fbdev_init_with_funcs(dev, preferred_bpp,
> +						max_conn_count, NULL);
> +}
> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init);
> +
> +/**
> + * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation
> + * @dev: DRM device
> + */
> +void drm_fb_cma_fbdev_fini(struct drm_device *dev)
> +{
> +	struct drm_fb_helper *fb_helper = dev->fb_helper;
> +
> +	if (!fb_helper)
> +		return;
> +
> +	/* Unregister if it hasn't been done already */
> +	if (fb_helper->fbdev && fb_helper->fbdev->dev)
> +		drm_fb_helper_unregister_fbi(fb_helper);
> +
> +	if (fb_helper->fbdev)
> +		drm_fbdev_cma_defio_fini(fb_helper->fbdev);
> +
> +	if (fb_helper->fb)
> +		drm_framebuffer_remove(fb_helper->fb);
> +
> +	drm_fb_helper_fini(fb_helper);
> +	kfree(to_fbdev_cma(fb_helper));
> +}
> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
> +
>  /**
>   * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct
>   * @dev: DRM device
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 023f052a5873..22be22e641a4 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -15,6 +15,13 @@ struct drm_mode_fb_cmd2;
>  struct drm_plane;
>  struct drm_plane_state;
>  
> +int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
> +	unsigned int preferred_bpp, unsigned int max_conn_count,
> +	const struct drm_framebuffer_funcs *funcs);
> +int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
> +			  unsigned int max_conn_count);
> +void drm_fb_cma_fbdev_fini(struct drm_device *dev);
> +
>  struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
>  	unsigned int preferred_bpp, unsigned int max_conn_count,
>  	const struct drm_framebuffer_funcs *funcs);
> -- 
> 2.14.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 ` [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini() Noralf Trønnes
@ 2017-11-06  9:08   ` Daniel Vetter
  2017-11-06 12:48     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Daniel Vetter @ 2017-11-06  9:08 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre

On Sat, Nov 04, 2017 at 02:03:57PM +0100, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> Remove unused function prototype arcpgu_fbdev_cma_init().
> 
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/arc/arcpgu.h     |  4 ----
>  drivers/gpu/drm/arc/arcpgu_drv.c | 36 +++++++-----------------------------
>  2 files changed, 7 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
> index e8fcf3ab1d9a..90ef76b19f8a 100644
> --- a/drivers/gpu/drm/arc/arcpgu.h
> +++ b/drivers/gpu/drm/arc/arcpgu.h
> @@ -20,7 +20,6 @@
>  struct arcpgu_drm_private {
>  	void __iomem		*regs;
>  	struct clk		*clk;
> -	struct drm_fbdev_cma	*fbdev;
>  	struct drm_framebuffer	*fb;
>  	struct drm_crtc		crtc;
>  	struct drm_plane	*plane;
> @@ -43,8 +42,5 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
>  int arc_pgu_setup_crtc(struct drm_device *dev);
>  int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
>  int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
> -struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int num_crtc,
> -	unsigned int max_conn_count);
>  
>  #endif
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 074fd4ea7ece..f54481ee834c 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -16,6 +16,7 @@
>  
>  #include <linux/clk.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> @@ -25,16 +26,9 @@
>  #include "arcpgu.h"
>  #include "arcpgu_regs.h"
>  
> -static void arcpgu_fb_output_poll_changed(struct drm_device *dev)
> -{
> -	struct arcpgu_drm_private *arcpgu = dev->dev_private;
> -
> -	drm_fbdev_cma_hotplug_event(arcpgu->fbdev);
> -}
> -
>  static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
>  	.fb_create  = drm_gem_fb_create,
> -	.output_poll_changed = arcpgu_fb_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = drm_atomic_helper_check,
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
> @@ -51,13 +45,6 @@ static void arcpgu_setup_mode_config(struct drm_device *drm)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops);
>  
> -static void arcpgu_lastclose(struct drm_device *drm)
> -{
> -	struct arcpgu_drm_private *arcpgu = drm->dev_private;
> -
> -	drm_fbdev_cma_restore_mode(arcpgu->fbdev);
> -}
> -
>  static int arcpgu_load(struct drm_device *drm)
>  {
>  	struct platform_device *pdev = to_platform_device(drm->dev);
> @@ -113,13 +100,9 @@ static int arcpgu_load(struct drm_device *drm)
>  	drm_mode_config_reset(drm);
>  	drm_kms_helper_poll_init(drm);
>  
> -	arcpgu->fbdev = drm_fbdev_cma_init(drm, 16,
> -					   drm->mode_config.num_connector);
> -	if (IS_ERR(arcpgu->fbdev)) {
> -		ret = PTR_ERR(arcpgu->fbdev);
> -		arcpgu->fbdev = NULL;
> -		return -ENODEV;
> -	}
> +	ret = drm_fb_cma_fbdev_init(drm, 16, 0);

s/0/NULL/

Probably applies to other patches too.

Also, why did you merge this new change into the old patch with the
output_poll/lastclose change? It took me a while to figure out what you're
doing, because the patches looked familiar, but the cover letter didn't
mention how stuff evolved, nor the patches here.

Also, you've lost the bunch of acks/r-bs you've gathered already. If
there's no technical reason to merge the 2 patches I'm kinda leaning
towards merging them separately, at least the ones that have acks already.
Just to avoid the pitfall of the continually evolving patch series that
never lands.
-Daniel

> +	if (ret)
> +		return ret;
>  
>  	platform_set_drvdata(pdev, drm);
>  	return 0;
> @@ -127,12 +110,7 @@ static int arcpgu_load(struct drm_device *drm)
>  
>  static int arcpgu_unload(struct drm_device *drm)
>  {
> -	struct arcpgu_drm_private *arcpgu = drm->dev_private;
> -
> -	if (arcpgu->fbdev) {
> -		drm_fbdev_cma_fini(arcpgu->fbdev);
> -		arcpgu->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(drm);
>  	drm_kms_helper_poll_fini(drm);
>  	drm_mode_config_cleanup(drm);
>  
> @@ -168,7 +146,7 @@ static int arcpgu_debugfs_init(struct drm_minor *minor)
>  static struct drm_driver arcpgu_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
> -	.lastclose = arcpgu_lastclose,
> +	.lastclose = drm_fb_helper_lastclose,
>  	.name = "arcpgu",
>  	.desc = "ARC PGU Controller",
>  	.date = "20160219",
> -- 
> 2.14.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions
  2017-11-04 13:04 ` [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
@ 2017-11-06  9:09   ` Daniel Vetter
  0 siblings, 0 replies; 49+ messages in thread
From: Daniel Vetter @ 2017-11-06  9:09 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre

On Sat, Nov 04, 2017 at 02:04:16PM +0100, Noralf Trønnes wrote:
> Remove the unused struct drm_fbdev_cma functions.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

On patches 22&21:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 158 ------------------------------------
>  include/drm/drm_fb_cma_helper.h     |  28 +------
>  2 files changed, 3 insertions(+), 183 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 267c04216281..0c73957d7aad 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -425,161 +425,3 @@ void drm_fb_cma_fbdev_fini(struct drm_device *dev)
>  	kfree(to_fbdev_cma(fb_helper));
>  }
>  EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
> -
> -/**
> - * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct
> - * @dev: DRM device
> - * @preferred_bpp: Preferred bits per pixel for the device
> - * @max_conn_count: Maximum number of connectors
> - * @funcs: fb helper functions, in particular a custom dirty() callback
> - *
> - * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
> - */
> -struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count,
> -	const struct drm_framebuffer_funcs *funcs)
> -{
> -	struct drm_fbdev_cma *fbdev_cma;
> -	struct drm_fb_helper *helper;
> -	int ret;
> -
> -	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
> -	if (!fbdev_cma) {
> -		dev_err(dev->dev, "Failed to allocate drm fbdev.\n");
> -		return ERR_PTR(-ENOMEM);
> -	}
> -	fbdev_cma->fb_funcs = funcs;
> -
> -	helper = &fbdev_cma->fb_helper;
> -
> -	drm_fb_helper_prepare(dev, helper, &drm_fb_cma_helper_funcs);
> -
> -	ret = drm_fb_helper_init(dev, helper, max_conn_count);
> -	if (ret < 0) {
> -		dev_err(dev->dev, "Failed to initialize drm fb helper.\n");
> -		goto err_free;
> -	}
> -
> -	ret = drm_fb_helper_single_add_all_connectors(helper);
> -	if (ret < 0) {
> -		dev_err(dev->dev, "Failed to add connectors.\n");
> -		goto err_drm_fb_helper_fini;
> -
> -	}
> -
> -	ret = drm_fb_helper_initial_config(helper, preferred_bpp);
> -	if (ret < 0) {
> -		dev_err(dev->dev, "Failed to set initial hw configuration.\n");
> -		goto err_drm_fb_helper_fini;
> -	}
> -
> -	return fbdev_cma;
> -
> -err_drm_fb_helper_fini:
> -	drm_fb_helper_fini(helper);
> -err_free:
> -	kfree(fbdev_cma);
> -
> -	return ERR_PTR(ret);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs);
> -
> -static const struct drm_framebuffer_funcs drm_fb_cma_funcs = {
> -	.destroy	= drm_gem_fb_destroy,
> -	.create_handle	= drm_gem_fb_create_handle,
> -};
> -
> -/**
> - * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
> - * @dev: DRM device
> - * @preferred_bpp: Preferred bits per pixel for the device
> - * @max_conn_count: Maximum number of connectors
> - *
> - * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
> - */
> -struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count)
> -{
> -	return drm_fbdev_cma_init_with_funcs(dev, preferred_bpp,
> -					     max_conn_count,
> -					     &drm_fb_cma_funcs);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
> -
> -/**
> - * drm_fbdev_cma_fini() - Free drm_fbdev_cma struct
> - * @fbdev_cma: The drm_fbdev_cma struct
> - */
> -void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
> -	if (fbdev_cma->fb_helper.fbdev)
> -		drm_fbdev_cma_defio_fini(fbdev_cma->fb_helper.fbdev);
> -
> -	if (fbdev_cma->fb_helper.fb)
> -		drm_framebuffer_remove(fbdev_cma->fb_helper.fb);
> -
> -	drm_fb_helper_fini(&fbdev_cma->fb_helper);
> -	kfree(fbdev_cma);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini);
> -
> -/**
> - * drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - *
> - * This function is usually called from the &drm_driver.lastclose callback.
> - */
> -void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode);
> -
> -/**
> - * drm_fbdev_cma_hotplug_event() - Poll for hotpulug events
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - *
> - * This function is usually called from the &drm_mode_config.output_poll_changed
> - * callback.
> - */
> -void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
> -}
> -EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> -
> -/**
> - * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - * @state: desired state, zero to resume, non-zero to suspend
> - *
> - * Calls drm_fb_helper_set_suspend, which is a wrapper around
> - * fb_set_suspend implemented by fbdev core.
> - */
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
> -}
> -EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
> -
> -/**
> - * drm_fbdev_cma_set_suspend_unlocked - wrapper around
> - *                                      drm_fb_helper_set_suspend_unlocked
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - * @state: desired state, zero to resume, non-zero to suspend
> - *
> - * Calls drm_fb_helper_set_suspend, which is a wrapper around
> - * fb_set_suspend implemented by fbdev core.
> - */
> -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					bool state)
> -{
> -	if (fbdev_cma)
> -		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> -						   state);
> -}
> -EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 22be22e641a4..e0ed0ce29c03 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -1,18 +1,10 @@
>  #ifndef __DRM_FB_CMA_HELPER_H__
>  #define __DRM_FB_CMA_HELPER_H__
>  
> -struct drm_fbdev_cma;
> -struct drm_gem_cma_object;
> -
> -struct drm_fb_helper_surface_size;
> -struct drm_framebuffer_funcs;
> -struct drm_fb_helper_funcs;
> -struct drm_framebuffer;
> -struct drm_fb_helper;
>  struct drm_device;
> -struct drm_file;
> -struct drm_mode_fb_cmd2;
> -struct drm_plane;
> +struct drm_framebuffer;
> +struct drm_framebuffer_funcs;
> +struct drm_gem_cma_object;
>  struct drm_plane_state;
>  
>  int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
> @@ -22,19 +14,6 @@ int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
>  			  unsigned int max_conn_count);
>  void drm_fb_cma_fbdev_fini(struct drm_device *dev);
>  
> -struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count,
> -	const struct drm_framebuffer_funcs *funcs);
> -struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
> -	unsigned int preferred_bpp, unsigned int max_conn_count);
> -void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
> -
> -void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
> -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					bool state);
> -
>  struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
>  	unsigned int plane);
>  
> @@ -49,4 +28,3 @@ int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg);
>  #endif
>  
>  #endif
> -
> -- 
> 2.14.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 07/22] drm/imx: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 07/22] drm/imx: " Noralf Trønnes
@ 2017-11-06  9:59   ` Philipp Zabel
  0 siblings, 0 replies; 49+ messages in thread
From: Philipp Zabel @ 2017-11-06  9:59 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

On Sat, 2017-11-04 at 14:04 +0100, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

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

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

* Re: [PATCH 05/22] drm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:03 ` [PATCH 05/22] drm/atmel-hlcdc: " Noralf Trønnes
@ 2017-11-06 10:16   ` Boris Brezillon
  0 siblings, 0 replies; 49+ messages in thread
From: Boris Brezillon @ 2017-11-06 10:16 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex, abrodkin,
	z.liuxinliang, kong.kongxinwei, tomi.valkeinen, david, puck.chen,
	jsarha, dri-devel, vincent.abriou, alison.wang, philippe.cornu,
	yannick.fertre, zourongrong, maxime.ripard, shawnguo

On Sat,  4 Nov 2017 14:03:59 +0100
Noralf Trønnes <noralf@tronnes.org> wrote:

> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 26 ++++----------------------
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h |  2 +-
>  2 files changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index c6e8061ffcfc..c1ea5c36b006 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -461,13 +461,6 @@ static struct drm_framebuffer *atmel_hlcdc_fb_create(struct drm_device *dev,
>  	return drm_gem_fb_create(dev, file_priv, mode_cmd);
>  }
>  
> -static void atmel_hlcdc_fb_output_poll_changed(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -
> -	drm_fbdev_cma_hotplug_event(dc->fbdev);
> -}
> -
>  struct atmel_hlcdc_dc_commit {
>  	struct work_struct work;
>  	struct drm_device *dev;
> @@ -563,7 +556,7 @@ static int atmel_hlcdc_dc_atomic_commit(struct drm_device *dev,
>  
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = atmel_hlcdc_fb_create,
> -	.output_poll_changed = atmel_hlcdc_fb_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = drm_atomic_helper_check,
>  	.atomic_commit = atmel_hlcdc_dc_atomic_commit,
>  };
> @@ -665,10 +658,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  
>  	platform_set_drvdata(pdev, dev);
>  
> -	dc->fbdev = drm_fbdev_cma_init(dev, 24,
> -			dev->mode_config.num_connector);
> -	if (IS_ERR(dc->fbdev))
> -		dc->fbdev = NULL;
> +	drm_fb_cma_fbdev_init(dev, 24, 0);
>  
>  	drm_kms_helper_poll_init(dev);
>  
> @@ -688,8 +678,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  {
>  	struct atmel_hlcdc_dc *dc = dev->dev_private;
>  
> -	if (dc->fbdev)
> -		drm_fbdev_cma_fini(dc->fbdev);
> +	drm_fb_cma_fbdev_fini(dev);
>  	flush_workqueue(dc->wq);
>  	drm_kms_helper_poll_fini(dev);
>  	drm_mode_config_cleanup(dev);
> @@ -705,13 +694,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	destroy_workqueue(dc->wq);
>  }
>  
> -static void atmel_hlcdc_dc_lastclose(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -
> -	drm_fbdev_cma_restore_mode(dc->fbdev);
> -}
> -
>  static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>  {
>  	struct atmel_hlcdc_dc *dc = dev->dev_private;
> @@ -744,7 +726,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
>  			   DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
> -	.lastclose = atmel_hlcdc_dc_lastclose,
> +	.lastclose = drm_fb_helper_lastclose,
>  	.irq_handler = atmel_hlcdc_dc_irq_handler,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
> index 6833ee253cfa..ab32d5b268d2 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
> @@ -32,6 +32,7 @@
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> @@ -374,7 +375,6 @@ struct atmel_hlcdc_dc {
>  	const struct atmel_hlcdc_dc_desc *desc;
>  	struct dma_pool *dscrpool;
>  	struct atmel_hlcdc *hlcdc;
> -	struct drm_fbdev_cma *fbdev;
>  	struct drm_crtc *crtc;
>  	struct atmel_hlcdc_layer *layers[ATMEL_HLCDC_MAX_LAYERS];
>  	struct workqueue_struct *wq;

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

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

* Re: [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
  2017-11-06  8:54   ` Daniel Vetter
@ 2017-11-06 12:40     ` Noralf Trønnes
  0 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-06 12:40 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre


Den 06.11.2017 09.54, skrev Daniel Vetter:
> On Sat, Nov 04, 2017 at 02:03:55PM +0100, Noralf Trønnes wrote:
>> Make the drm_framebuffer_funcs argument optional for drivers that
>> don't need to set the dirty callback.
>>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Looks like this patch ended up in the wrong patch series? Atm there's not
> much users of this (I guess they're still waiting for acks), and somehow
> I'd expect that there's some drivers which really want this (but I don't
> see any in this patch series). Looks good, but I'm a bit confused.

The purpose of this change is so the driver doesn't have to provide a
fb vtable if it doesn't need to set the dirty calback.

So if I didn't rework the cma helper to get rid of struct drm_fbdev_cma,
I would have followed up with this change:

-static const struct drm_framebuffer_funcs drm_fb_cma_funcs = {
-    .destroy    = drm_gem_fb_destroy,
-    .create_handle    = drm_gem_fb_create_handle,
-};
-
  /**
   * drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct
   * @dev: DRM device
   * @preferred_bpp: Preferred bits per pixel for the device
   * @max_conn_count: Maximum number of connectors
   *
   * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR.
   */
  struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
      unsigned int preferred_bpp, unsigned int max_conn_count)
  {
      return drm_fbdev_cma_init_with_funcs(dev, preferred_bpp,
                           max_conn_count,
  -                         &drm_fb_cma_funcs);
  +                         NULL);
  }
  EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);

Noralf.

> -Daniel
>
>> ---
>>   drivers/gpu/drm/drm_gem_framebuffer_helper.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> index aa8cb9bfa499..4d682a6e8bcb 100644
>> --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
>> @@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
>>    * @sizes: fbdev size description
>>    * @pitch_align: Optional pitch alignment
>>    * @obj: GEM object backing the framebuffer
>> - * @funcs: vtable to be used for the new framebuffer object
>> + * @funcs: Optional vtable to be used for the new framebuffer object when the
>> + *         dirty callback is needed.
>>    *
>>    * This function creates a framebuffer from a &drm_fb_helper_surface_size
>>    * description for use in the &drm_fb_helper_funcs.fb_probe callback.
>> @@ -300,6 +301,9 @@ drm_gem_fbdev_fb_create(struct drm_device *dev,
>>   	if (obj->size < mode_cmd.pitches[0] * mode_cmd.height)
>>   		return ERR_PTR(-EINVAL);
>>   
>> +	if (!funcs)
>> +		funcs = &drm_gem_fb_funcs;
>> +
>>   	return drm_gem_fb_alloc(dev, &mode_cmd, &obj, 1, funcs);
>>   }
>>   EXPORT_SYMBOL(drm_gem_fbdev_fb_create);
>> -- 
>> 2.14.2
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

* Re: [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
  2017-11-06  9:04   ` Daniel Vetter
@ 2017-11-06 12:40     ` Noralf Trønnes
  0 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-06 12:40 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre


Den 06.11.2017 10.04, skrev Daniel Vetter:
> On Sat, Nov 04, 2017 at 02:03:56PM +0100, Noralf Trønnes wrote:
>> Add functions drm_fb_cma_fbdev_init(), drm_fb_cma_fbdev_fini() and
>> drm_fb_cma_fbdev_init_with_funcs(). These functions relies on the fact
>> that the drm_fb_helper struct is stored in dev->drm_fb_helper_private
>> so drivers don't need to store it.
>>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> I guess you've proven me wrong, since at the end of this patch series we
> do have some neat functions that do the same thing an earlier patch series
> did, expect there's a _cma_ in the name. But the function itself is 100%
> generic.
>
> Sry for all the meandering, I guess this once again shows that any problem
> in software can indeed be solved by adding another abstraction layer on
> top. You'll probably be slightly mad, but I'd vote for the patch to drop
> the _cma_ infix again (once everything has landed, no need to respin all
> the patches again).
>

The purpose here is not to add a layer, but to change an existing one.
I want to get rid of struct drm_fbdev_cma and I have 2 options:
- One patch that touches all drivers
- Add new functions, switch over drivers one patch at a time

In effect this is what I do in this patchset:

include/drm/drm_fb_cma_helper.h:

+int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
+    unsigned int preferred_bpp, unsigned int max_conn_count,
+    const struct drm_framebuffer_funcs *funcs);
+int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int 
preferred_bpp,
+              unsigned int max_conn_count);
+void drm_fb_cma_fbdev_fini(struct drm_device *dev);
+

-struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
-    unsigned int preferred_bpp, unsigned int max_conn_count,
-    const struct drm_framebuffer_funcs *funcs);
-struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
-    unsigned int preferred_bpp, unsigned int max_conn_count);
-void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
-

How about this commit message:

drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()

There is no need for drivers to carry a pointer to the the fbdev
emulation structure now that drm_device has one. Currently drivers has
a pointer to struct drm_fbdev_cma in their driver structure. This
pointer is returned by drm_fbdev_cma_init().

In order to get rid of struct drm_fbdev_cma, add functions
drm_fb_cma_fbdev_init(), drm_fb_cma_fbdev_fini() and
drm_fb_cma_fbdev_init_with_funcs(). These functions relies on the fact
that the drm_fb_helper struct is stored in drm_device->fb_helper so
drivers don't need to store it. When drivers have been moved over to
these functions, the old init/fini functions can be removed.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>


Noralf.

>> ---
>>   drivers/gpu/drm/drm_fb_cma_helper.c | 116 +++++++++++++++++++++++++++++++++++-
>>   include/drm/drm_fb_cma_helper.h     |   7 +++
>>   2 files changed, 121 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
>> index 0e3c14174d08..267c04216281 100644
>> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
>> @@ -23,6 +23,7 @@
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>>   #include <drm/drm_fb_cma_helper.h>
>> +#include <drm/drm_print.h>
>>   #include <linux/module.h>
>>   
>>   #define DEFAULT_FBDEFIO_DELAY_MS 50
>> @@ -42,7 +43,7 @@ struct drm_fbdev_cma {
>>    * callback function to create a cma backed framebuffer.
>>    *
>>    * An fbdev framebuffer backed by cma is also available by calling
>> - * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
>> + * drm_fb_cma_fbdev_init(). drm_fb_cma_fbdev_fini() tears it down.
>>    * If the &drm_framebuffer_funcs.dirty callback is set, fb_deferred_io will be
>>    * set up automatically. &drm_framebuffer_funcs.dirty is called by
>>    * drm_fb_helper_deferred_io() in process context (&struct delayed_work).
>> @@ -68,7 +69,7 @@ struct drm_fbdev_cma {
>>    *
>>    * Initialize::
>>    *
>> - *     fbdev = drm_fbdev_cma_init_with_funcs(dev, 16,
>> + *     fbdev = drm_fb_cma_fbdev_init_with_funcs(dev, 16,
>>    *                                           dev->mode_config.num_crtc,
>>    *                                           dev->mode_config.num_connector,
>>    *                                           &driver_fb_funcs);
>> @@ -314,6 +315,117 @@ static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
>>   	.fb_probe = drm_fbdev_cma_create,
>>   };
>>   
>> +/**
>> + * drm_fb_cma_fbdev_init_with_funcs() - Allocate and initialize fbdev emulation
>> + * @dev: DRM device
>> + * @preferred_bpp: Preferred bits per pixel for the device.
>> + *                 @dev->mode_config.preferred_depth is used if this is zero.
>> + * @max_conn_count: Maximum number of connectors.
>> + *                  @dev->mode_config.num_connector is used if this is zero.
>> + * @funcs: Framebuffer functions, in particular a custom dirty() callback.
> With the previous patch this is allowed to be NULL, right? Please
> document.
>
> And since that also explains the patch 1, on both patches:
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> But please get an ack from Laurent too.
> -Daniel
>
>> + *
>> + * Returns:
>> + * Zero on success or negative error code on failure.
>> + */
>> +int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
>> +	unsigned int preferred_bpp, unsigned int max_conn_count,
>> +	const struct drm_framebuffer_funcs *funcs)
>> +{
>> +	struct drm_fbdev_cma *fbdev_cma;
>> +	struct drm_fb_helper *fb_helper;
>> +	int ret;
>> +
>> +	if (!preferred_bpp)
>> +		preferred_bpp = dev->mode_config.preferred_depth;
>> +	if (!preferred_bpp)
>> +		preferred_bpp = 32;
>> +
>> +	if (!max_conn_count)
>> +		max_conn_count = dev->mode_config.num_connector;
>> +
>> +	fbdev_cma = kzalloc(sizeof(*fbdev_cma), GFP_KERNEL);
>> +	if (!fbdev_cma)
>> +		return -ENOMEM;
>> +
>> +	fbdev_cma->fb_funcs = funcs;
>> +	fb_helper = &fbdev_cma->fb_helper;
>> +
>> +	drm_fb_helper_prepare(dev, fb_helper, &drm_fb_cma_helper_funcs);
>> +
>> +	ret = drm_fb_helper_init(dev, fb_helper, max_conn_count);
>> +	if (ret < 0) {
>> +		DRM_DEV_ERROR(dev->dev, "Failed to initialize fbdev helper.\n");
>> +		goto err_free;
>> +	}
>> +
>> +	ret = drm_fb_helper_single_add_all_connectors(fb_helper);
>> +	if (ret < 0) {
>> +		DRM_DEV_ERROR(dev->dev, "Failed to add connectors.\n");
>> +		goto err_drm_fb_helper_fini;
>> +	}
>> +
>> +	ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp);
>> +	if (ret < 0) {
>> +		DRM_DEV_ERROR(dev->dev, "Failed to set fbdev configuration.\n");
>> +		goto err_drm_fb_helper_fini;
>> +	}
>> +
>> +	return 0;
>> +
>> +err_drm_fb_helper_fini:
>> +	drm_fb_helper_fini(fb_helper);
>> +err_free:
>> +	kfree(fbdev_cma);
>> +
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init_with_funcs);
>> +
>> +/**
>> + * drm_fb_cma_fbdev_init() - Allocate and initialize fbdev emulation
>> + * @dev: DRM device
>> + * @preferred_bpp: Preferred bits per pixel for the device.
>> + *                 @dev->mode_config.preferred_depth is used if this is zero.
>> + * @max_conn_count: Maximum number of connectors.
>> + *                  @dev->mode_config.num_connector is used if this is zero.
>> + *
>> + * Returns:
>> + * Zero on success or negative error code on failure.
>> + */
>> +int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
>> +			  unsigned int max_conn_count)
>> +{
>> +	return drm_fb_cma_fbdev_init_with_funcs(dev, preferred_bpp,
>> +						max_conn_count, NULL);
>> +}
>> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_init);
>> +
>> +/**
>> + * drm_fb_cma_fbdev_fini() - Teardown fbdev emulation
>> + * @dev: DRM device
>> + */
>> +void drm_fb_cma_fbdev_fini(struct drm_device *dev)
>> +{
>> +	struct drm_fb_helper *fb_helper = dev->fb_helper;
>> +
>> +	if (!fb_helper)
>> +		return;
>> +
>> +	/* Unregister if it hasn't been done already */
>> +	if (fb_helper->fbdev && fb_helper->fbdev->dev)
>> +		drm_fb_helper_unregister_fbi(fb_helper);
>> +
>> +	if (fb_helper->fbdev)
>> +		drm_fbdev_cma_defio_fini(fb_helper->fbdev);
>> +
>> +	if (fb_helper->fb)
>> +		drm_framebuffer_remove(fb_helper->fb);
>> +
>> +	drm_fb_helper_fini(fb_helper);
>> +	kfree(to_fbdev_cma(fb_helper));
>> +}
>> +EXPORT_SYMBOL_GPL(drm_fb_cma_fbdev_fini);
>> +
>>   /**
>>    * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct
>>    * @dev: DRM device
>> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
>> index 023f052a5873..22be22e641a4 100644
>> --- a/include/drm/drm_fb_cma_helper.h
>> +++ b/include/drm/drm_fb_cma_helper.h
>> @@ -15,6 +15,13 @@ struct drm_mode_fb_cmd2;
>>   struct drm_plane;
>>   struct drm_plane_state;
>>   
>> +int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
>> +	unsigned int preferred_bpp, unsigned int max_conn_count,
>> +	const struct drm_framebuffer_funcs *funcs);
>> +int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp,
>> +			  unsigned int max_conn_count);
>> +void drm_fb_cma_fbdev_fini(struct drm_device *dev);
>> +
>>   struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
>>   	unsigned int preferred_bpp, unsigned int max_conn_count,
>>   	const struct drm_framebuffer_funcs *funcs);
>> -- 
>> 2.14.2
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

* Re: [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-06  9:08   ` Daniel Vetter
@ 2017-11-06 12:48     ` Noralf Trønnes
  0 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-06 12:48 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, alison.wang,
	liviu.dudau, philippe.cornu, dri-devel, z.liuxinliang,
	kong.kongxinwei, tomi.valkeinen, laurent.pinchart, puck.chen,
	zourongrong, shawnguo, maxime.ripard, jsarha, vincent.abriou,
	yannick.fertre


Den 06.11.2017 10.08, skrev Daniel Vetter:
> On Sat, Nov 04, 2017 at 02:03:57PM +0100, Noralf Trønnes wrote:
>> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> This means that the driver doesn't have to keep track of that.
>> Also use the drm_fb_helper functions directly.
>> Remove unused function prototype arcpgu_fbdev_cma_init().
>>
>> Cc: Alexey Brodkin <abrodkin@synopsys.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> ---
>>   drivers/gpu/drm/arc/arcpgu.h     |  4 ----
>>   drivers/gpu/drm/arc/arcpgu_drv.c | 36 +++++++-----------------------------
>>   2 files changed, 7 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
>> index e8fcf3ab1d9a..90ef76b19f8a 100644
>> --- a/drivers/gpu/drm/arc/arcpgu.h
>> +++ b/drivers/gpu/drm/arc/arcpgu.h
>> @@ -20,7 +20,6 @@
>>   struct arcpgu_drm_private {
>>   	void __iomem		*regs;
>>   	struct clk		*clk;
>> -	struct drm_fbdev_cma	*fbdev;
>>   	struct drm_framebuffer	*fb;
>>   	struct drm_crtc		crtc;
>>   	struct drm_plane	*plane;
>> @@ -43,8 +42,5 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
>>   int arc_pgu_setup_crtc(struct drm_device *dev);
>>   int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
>>   int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
>> -struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
>> -	unsigned int preferred_bpp, unsigned int num_crtc,
>> -	unsigned int max_conn_count);
>>   
>>   #endif
>> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
>> index 074fd4ea7ece..f54481ee834c 100644
>> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
>> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
>> @@ -16,6 +16,7 @@
>>   
>>   #include <linux/clk.h>
>>   #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_fb_helper.h>
>>   #include <drm/drm_fb_cma_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> @@ -25,16 +26,9 @@
>>   #include "arcpgu.h"
>>   #include "arcpgu_regs.h"
>>   
>> -static void arcpgu_fb_output_poll_changed(struct drm_device *dev)
>> -{
>> -	struct arcpgu_drm_private *arcpgu = dev->dev_private;
>> -
>> -	drm_fbdev_cma_hotplug_event(arcpgu->fbdev);
>> -}
>> -
>>   static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
>>   	.fb_create  = drm_gem_fb_create,
>> -	.output_poll_changed = arcpgu_fb_output_poll_changed,
>> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>>   	.atomic_check = drm_atomic_helper_check,
>>   	.atomic_commit = drm_atomic_helper_commit,
>>   };
>> @@ -51,13 +45,6 @@ static void arcpgu_setup_mode_config(struct drm_device *drm)
>>   
>>   DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops);
>>   
>> -static void arcpgu_lastclose(struct drm_device *drm)
>> -{
>> -	struct arcpgu_drm_private *arcpgu = drm->dev_private;
>> -
>> -	drm_fbdev_cma_restore_mode(arcpgu->fbdev);
>> -}
>> -
>>   static int arcpgu_load(struct drm_device *drm)
>>   {
>>   	struct platform_device *pdev = to_platform_device(drm->dev);
>> @@ -113,13 +100,9 @@ static int arcpgu_load(struct drm_device *drm)
>>   	drm_mode_config_reset(drm);
>>   	drm_kms_helper_poll_init(drm);
>>   
>> -	arcpgu->fbdev = drm_fbdev_cma_init(drm, 16,
>> -					   drm->mode_config.num_connector);
>> -	if (IS_ERR(arcpgu->fbdev)) {
>> -		ret = PTR_ERR(arcpgu->fbdev);
>> -		arcpgu->fbdev = NULL;
>> -		return -ENODEV;
>> -	}
>> +	ret = drm_fb_cma_fbdev_init(drm, 16, 0);
> s/0/NULL/
>
> Probably applies to other patches too.
>
> Also, why did you merge this new change into the old patch with the
> output_poll/lastclose change? It took me a while to figure out what you're
> doing, because the patches looked familiar, but the cover letter didn't
> mention how stuff evolved, nor the patches here.
>
> Also, you've lost the bunch of acks/r-bs you've gathered already. If
> there's no technical reason to merge the 2 patches I'm kinda leaning
> towards merging them separately, at least the ones that have acks already.
> Just to avoid the pitfall of the continually evolving patch series that
> never lands.

Ah, now I understand some of the confusion.

I have one patchset that converts the drivers that don't use the cma helper:
drm/fb-helper: Add .last_close and .output_poll_changed helpers

And in this patchset I remove the use of struct drm_fbdev_cma which means
I move away from the all the drm_fbdev_cma* functions. This means switching
to the .last_close and .output_poll_changed helpers from the previous
patchset.

Not sure how I can un-confuse this.

Noralf.

> -Daniel
>
>> +	if (ret)
>> +		return ret;
>>   
>>   	platform_set_drvdata(pdev, drm);
>>   	return 0;
>> @@ -127,12 +110,7 @@ static int arcpgu_load(struct drm_device *drm)
>>   
>>   static int arcpgu_unload(struct drm_device *drm)
>>   {
>> -	struct arcpgu_drm_private *arcpgu = drm->dev_private;
>> -
>> -	if (arcpgu->fbdev) {
>> -		drm_fbdev_cma_fini(arcpgu->fbdev);
>> -		arcpgu->fbdev = NULL;
>> -	}
>> +	drm_fb_cma_fbdev_fini(drm);
>>   	drm_kms_helper_poll_fini(drm);
>>   	drm_mode_config_cleanup(drm);
>>   
>> @@ -168,7 +146,7 @@ static int arcpgu_debugfs_init(struct drm_minor *minor)
>>   static struct drm_driver arcpgu_drm_driver = {
>>   	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>>   			   DRIVER_ATOMIC,
>> -	.lastclose = arcpgu_lastclose,
>> +	.lastclose = drm_fb_helper_lastclose,
>>   	.name = "arcpgu",
>>   	.desc = "ARC PGU Controller",
>>   	.date = "20160219",
>> -- 
>> 2.14.2
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

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

* Re: [PATCH 10/22] drm/pl111: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 10/22] drm/pl111: " Noralf Trønnes
@ 2017-11-06 13:18   ` Linus Walleij
  0 siblings, 0 replies; 49+ messages in thread
From: Linus Walleij @ 2017-11-06 13:18 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Marek Vasut,
	Boris BREZILLON, abrodkin, Xinliang Liu, k00278426,
	Tomi Valkeinen, David Lechner, Chenfeng (puck),
	Jyri Sarha, open list:DRM PANEL DRIVERS, Vincent Abriou,
	Huan Wang, Philippe Cornu, Yannick Fertre, Rongrong Zou,
	Maxime Ripard, Shawn Guo

On Sat, Nov 4, 2017 at 2:04 PM, Noralf Trønnes <noralf@tronnes.org> wrote:

> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
>
> Cc: Eric Anholt <eric@anholt.net>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Looks reasonable.

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] 49+ messages in thread

* Re: [PATCH 16/22] drm/tve200: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 16/22] drm/tve200: " Noralf Trønnes
@ 2017-11-06 13:19   ` Linus Walleij
  0 siblings, 0 replies; 49+ messages in thread
From: Linus Walleij @ 2017-11-06 13:19 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Marek Vasut,
	Boris BREZILLON, abrodkin, Xinliang Liu, k00278426,
	Tomi Valkeinen, David Lechner, Chenfeng (puck),
	Jyri Sarha, open list:DRM PANEL DRIVERS, Vincent Abriou,
	Huan Wang, Philippe Cornu, Yannick Fertre, Rongrong Zou,
	Maxime Ripard, Shawn Guo

On Sat, Nov 4, 2017 at 2:04 PM, Noralf Trønnes <noralf@tronnes.org> wrote:

> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

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] 49+ messages in thread

* Re: [PATCH 17/22] drm/vc4: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 17/22] drm/vc4: " Noralf Trønnes
@ 2017-11-06 16:19   ` Eric Anholt
  0 siblings, 0 replies; 49+ messages in thread
From: Eric Anholt @ 2017-11-06 16:19 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 361 bytes --]

Noralf Trønnes <noralf@tronnes.org> writes:

> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.

Reviewed-by: Eric Anholt <eric@anholt.net>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 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] 49+ messages in thread

* Re: [PATCH 13/22] drm/stm: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 13/22] drm/stm: " Noralf Trønnes
@ 2017-11-06 17:32   ` Philippe CORNU
  2017-11-08 15:23     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Philippe CORNU @ 2017-11-06 17:32 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel
  Cc: marex, boris.brezillon, david, narmstrong, liviu.dudau,
	alison.wang, abrodkin, jsarha, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, laurent.pinchart, puck.chen, zourongrong,
	shawnguo, maxime.ripard, Vincent ABRIOU

Hi Noralf,

On 11/04/2017 02:04 PM, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Yannick Fertre <yannick.fertre@st.com>
> Cc: Philippe Cornu <philippe.cornu@st.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Many thanks for this nice cleanup.

I will have to push a small fix to move drm_kms_helper_poll_init() after 
drm_fb_cma_fbdev_init() in order to remove a warning when booting (+ a 
small cleanup as "ldev = ddev->dev_private;" is not used anymore before 
drm_fb_cma_fbdev_init().

Anyway, regarding your patchset for stm:

Acked-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>

Thank you,
Philippe :-)

> ---
>   drivers/gpu/drm/stm/drv.c  | 37 ++++++-------------------------------
>   drivers/gpu/drm/stm/ltdc.h |  1 -
>   2 files changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index c857663eafc2..9a66f5671d4f 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -15,6 +15,7 @@
>   #include <drm/drm_atomic.h>
>   #include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_fb_helper.h>
>   #include <drm/drm_fb_cma_helper.h>
>   #include <drm/drm_gem_cma_helper.h>
>   #include <drm/drm_gem_framebuffer_helper.h>
> @@ -24,35 +25,19 @@
>   #define STM_MAX_FB_WIDTH	2048
>   #define STM_MAX_FB_HEIGHT	2048 /* same as width to handle orientation */
>   
> -static void drv_output_poll_changed(struct drm_device *ddev)
> -{
> -	struct ltdc_device *ldev = ddev->dev_private;
> -
> -	drm_fbdev_cma_hotplug_event(ldev->fbdev);
> -}
> -
>   static const struct drm_mode_config_funcs drv_mode_config_funcs = {
>   	.fb_create = drm_gem_fb_create,
> -	.output_poll_changed = drv_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>   	.atomic_check = drm_atomic_helper_check,
>   	.atomic_commit = drm_atomic_helper_commit,
>   };
>   
> -static void drv_lastclose(struct drm_device *ddev)
> -{
> -	struct ltdc_device *ldev = ddev->dev_private;
> -
> -	DRM_DEBUG("%s\n", __func__);
> -
> -	drm_fbdev_cma_restore_mode(ldev->fbdev);
> -}
> -
>   DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
>   
>   static struct drm_driver drv_driver = {
>   	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>   			   DRIVER_ATOMIC,
> -	.lastclose = drv_lastclose,
> +	.lastclose = drm_fb_helper_lastclose,
>   	.name = "stm",
>   	.desc = "STMicroelectronics SoC DRM",
>   	.date = "20170330",
> @@ -79,7 +64,6 @@ static struct drm_driver drv_driver = {
>   static int drv_load(struct drm_device *ddev)
>   {
>   	struct platform_device *pdev = to_platform_device(ddev->dev);
> -	struct drm_fbdev_cma *fbdev;
>   	struct ltdc_device *ldev;
>   	int ret;
>   
> @@ -113,13 +97,9 @@ static int drv_load(struct drm_device *ddev)
>   
>   	if (ddev->mode_config.num_connector) {
>   		ldev = ddev->dev_private;
> -		fbdev = drm_fbdev_cma_init(ddev, 16,
> -					   ddev->mode_config.num_connector);
> -		if (IS_ERR(fbdev)) {
> +		ret = drm_fb_cma_fbdev_init(ddev, 16, 0);
> +		if (ret)
>   			DRM_DEBUG("Warning: fails to create fbdev\n");
> -			fbdev = NULL;
> -		}
> -		ldev->fbdev = fbdev;
>   	}
>   
>   	platform_set_drvdata(pdev, ddev);
> @@ -132,14 +112,9 @@ static int drv_load(struct drm_device *ddev)
>   
>   static void drv_unload(struct drm_device *ddev)
>   {
> -	struct ltdc_device *ldev = ddev->dev_private;
> -
>   	DRM_DEBUG("%s\n", __func__);
>   
> -	if (ldev->fbdev) {
> -		drm_fbdev_cma_fini(ldev->fbdev);
> -		ldev->fbdev = NULL;
> -	}
> +	drm_fb_cma_fbdev_fini(ddev);
>   	drm_kms_helper_poll_fini(ddev);
>   	ltdc_unload(ddev);
>   	drm_mode_config_cleanup(ddev);
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index ae437557d715..27ac217406be 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -21,7 +21,6 @@ struct ltdc_caps {
>   };
>   
>   struct ltdc_device {
> -	struct drm_fbdev_cma *fbdev;
>   	void __iomem *regs;
>   	struct clk *pixel_clk;	/* lcd pixel clock */
>   	struct mutex err_lock;	/* protecting error_status */
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
  2017-11-04 13:04 ` [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() Noralf Trønnes
@ 2017-11-06 18:05   ` David Lechner
  0 siblings, 0 replies; 49+ messages in thread
From: David Lechner @ 2017-11-06 18:05 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, puck.chen, jsarha, vincent.abriou, alison.wang,
	philippe.cornu, yannick.fertre, zourongrong, maxime.ripard,
	shawnguo

On 11/04/2017 08:04 AM, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init_with_funcs() and drm_fb_cma_fbdev_fini() which
> relies on the fact that drm_device holds a pointer to the drm_fb_helper
> structure. This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> Remove todo entry.
> 
> Cc: David Lechner <david@lechnology.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---

Acked-by: David Lechner <david@lechnology.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 15/22] drm/tilcdc: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 15/22] drm/tilcdc: " Noralf Trønnes
@ 2017-11-07  8:33   ` Jyri Sarha
  0 siblings, 0 replies; 49+ messages in thread
From: Jyri Sarha @ 2017-11-07  8:33 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, vincent.abriou, alison.wang,
	philippe.cornu, yannick.fertre, zourongrong, maxime.ripard,
	shawnguo

On 11/04/17 15:04, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
> 
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Acked-by: Jyri Sarha <jsarha@ti.com>

Let me know if you want me to pick this to my next tilcdc pull request!

Thanks,
Jyri

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 26 +++++---------------------
>  drivers/gpu/drm/tilcdc/tilcdc_drv.h |  2 --
>  2 files changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 72ce063aa0d8..091b1025898e 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -69,12 +69,6 @@ static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev,
>  	return drm_gem_fb_create(dev, file_priv, mode_cmd);
>  }
>  
> -static void tilcdc_fb_output_poll_changed(struct drm_device *dev)
> -{
> -	struct tilcdc_drm_private *priv = dev->dev_private;
> -	drm_fbdev_cma_hotplug_event(priv->fbdev);
> -}
> -
>  static int tilcdc_atomic_check(struct drm_device *dev,
>  			       struct drm_atomic_state *state)
>  {
> @@ -146,7 +140,7 @@ static int tilcdc_commit(struct drm_device *dev,
>  
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = tilcdc_fb_create,
> -	.output_poll_changed = tilcdc_fb_output_poll_changed,
> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>  	.atomic_check = tilcdc_atomic_check,
>  	.atomic_commit = tilcdc_commit,
>  };
> @@ -198,8 +192,7 @@ static void tilcdc_fini(struct drm_device *dev)
>  
>  	drm_kms_helper_poll_fini(dev);
>  
> -	if (priv->fbdev)
> -		drm_fbdev_cma_fini(priv->fbdev);
> +	drm_fb_cma_fbdev_fini(dev);
>  
>  	drm_irq_uninstall(dev);
>  	drm_mode_config_cleanup(dev);
> @@ -405,12 +398,9 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
>  
>  	drm_mode_config_reset(ddev);
>  
> -	priv->fbdev = drm_fbdev_cma_init(ddev, bpp,
> -					 ddev->mode_config.num_connector);
> -	if (IS_ERR(priv->fbdev)) {
> -		ret = PTR_ERR(priv->fbdev);
> +	ret = drm_fb_cma_fbdev_init(ddev, bpp, 0);
> +	if (ret)
>  		goto init_failed;
> -	}
>  
>  	drm_kms_helper_poll_init(ddev);
>  
> @@ -427,12 +417,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
>  	return ret;
>  }
>  
> -static void tilcdc_lastclose(struct drm_device *dev)
> -{
> -	struct tilcdc_drm_private *priv = dev->dev_private;
> -	drm_fbdev_cma_restore_mode(priv->fbdev);
> -}
> -
>  static irqreturn_t tilcdc_irq(int irq, void *arg)
>  {
>  	struct drm_device *dev = arg;
> @@ -538,7 +522,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>  static struct drm_driver tilcdc_driver = {
>  	.driver_features    = (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET |
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
> -	.lastclose          = tilcdc_lastclose,
> +	.lastclose          = drm_fb_helper_lastclose,
>  	.irq_handler        = tilcdc_irq,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
>  	.gem_vm_ops         = &drm_gem_cma_vm_ops,
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> index 8caa11bc7aec..ead512216669 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
> @@ -79,8 +79,6 @@ struct tilcdc_drm_private {
>  
>  	struct workqueue_struct *wq;
>  
> -	struct drm_fbdev_cma *fbdev;
> -
>  	struct drm_crtc *crtc;
>  
>  	unsigned int num_encoders;
> 


-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 12/22] drm/sti: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 12/22] drm/sti: " Noralf Trønnes
@ 2017-11-08 12:21   ` Benjamin Gaignard
  2017-11-08 15:21     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Benjamin Gaignard @ 2017-11-08 12:21 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, liviu.dudau, Laurent Pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kongxinwei (A),
	Tomi Valkeinen, david, Chen Feng, Jyri Sarha, dri-devel,
	Vincent Abriou, Alison Wang, Philippe Cornu, Yannick Fertre,
	Rongrong Zou, Maxime Ripard, Shawn Guo

2017-11-04 14:04 GMT+01:00 Noralf Trønnes <noralf@tronnes.org>:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/sti/sti_drv.c | 25 +++++--------------------
>  drivers/gpu/drm/sti/sti_drv.h |  1 -
>  2 files changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 9e9343101738..d61efef30a82 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -17,6 +17,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_of.h>
>
> @@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
>         return ret;
>  }
>
> -static void sti_output_poll_changed(struct drm_device *ddev)
> -{
> -       struct sti_private *private = ddev->dev_private;
> -
> -       drm_fbdev_cma_hotplug_event(private->fbdev);
> -}
> -
>  static const struct drm_mode_config_funcs sti_mode_config_funcs = {
>         .fb_create = drm_gem_fb_create,
> -       .output_poll_changed = sti_output_poll_changed,
> +       .output_poll_changed = drm_fb_helper_output_poll_changed,
>         .atomic_check = sti_atomic_check,
>         .atomic_commit = drm_atomic_helper_commit,
>  };
> @@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
>  {
>         struct sti_private *private = ddev->dev_private;
>
> -       if (private->fbdev) {
> -               drm_fbdev_cma_fini(private->fbdev);
> -               private->fbdev = NULL;
> -       }
> -
> +       drm_fb_cma_fbdev_fini(ddev);
>         drm_kms_helper_poll_fini(ddev);
>         component_unbind_all(ddev->dev, ddev);
>         kfree(private);
> @@ -245,7 +235,6 @@ static int sti_bind(struct device *dev)
>  {
>         struct drm_device *ddev;
>         struct sti_private *private;
> -       struct drm_fbdev_cma *fbdev;
>         int ret;
>
>         ddev = drm_dev_alloc(&sti_driver, dev);
> @@ -268,13 +257,9 @@ static int sti_bind(struct device *dev)
>
>         private = ddev->dev_private;
>         if (ddev->mode_config.num_connector) {
> -               fbdev = drm_fbdev_cma_init(ddev, 32,
> -                                          ddev->mode_config.num_connector);
> -               if (IS_ERR(fbdev)) {
> +               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
> +               if (ret)
>                         DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
> -                       fbdev = NULL;
> -               }
> -               private->fbdev = fbdev;
>         }

Like for stm driver I think that drm_kms_helper_poll_init() call
should be move after
this block of code.
struct sti_private *private could also be remove of the function.

When testing your patches I have a kernel panic in drm_fbdev_cma_create()
because fbdev_cma->fb_funcs is NULL so using/testing fbdev_cma->fb_funcs->dirty
make kernel crash.
Just adding a test on fbdev_cma->fb_funcs value fix the problem but I
wonder why I'm
the only to report this issue ?

With all these fix I have a fonctionnal frame buffer.

Benjamin
>
>         return 0;
> diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
> index 6502ed2d3351..16c5c9110cb0 100644
> --- a/drivers/gpu/drm/sti/sti_drv.h
> +++ b/drivers/gpu/drm/sti/sti_drv.h
> @@ -24,7 +24,6 @@ struct sti_private {
>         struct sti_compositor *compo;
>         struct drm_property *plane_zorder_property;
>         struct drm_device *drm_dev;
> -       struct drm_fbdev_cma *fbdev;
>  };
>
>  extern struct platform_driver sti_tvout_driver;
> --
> 2.14.2
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 12/22] drm/sti: Use drm_fb_cma_fbdev_init/fini()
  2017-11-08 12:21   ` Benjamin Gaignard
@ 2017-11-08 15:21     ` Noralf Trønnes
  2017-11-09  8:20       ` Daniel Vetter
  0 siblings, 1 reply; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-08 15:21 UTC (permalink / raw)
  To: Benjamin Gaignard
  Cc: narmstrong, liviu.dudau, Laurent Pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kongxinwei (A),
	Tomi Valkeinen, david, Chen Feng, Jyri Sarha, dri-devel,
	Vincent Abriou, Alison Wang, Philippe Cornu, Yannick Fertre,
	Rongrong Zou, Maxime Ripard, Shawn Guo


Den 08.11.2017 13.21, skrev Benjamin Gaignard:
> 2017-11-04 14:04 GMT+01:00 Noralf Trønnes <noralf@tronnes.org>:
>> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> This means that the driver doesn't have to keep track of that.
>> Also use the drm_fb_helper functions directly.
>>
>> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> Cc: Vincent Abriou <vincent.abriou@st.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> ---
>>   drivers/gpu/drm/sti/sti_drv.c | 25 +++++--------------------
>>   drivers/gpu/drm/sti/sti_drv.h |  1 -
>>   2 files changed, 5 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
>> index 9e9343101738..d61efef30a82 100644
>> --- a/drivers/gpu/drm/sti/sti_drv.c
>> +++ b/drivers/gpu/drm/sti/sti_drv.c
>> @@ -17,6 +17,7 @@
>>   #include <drm/drm_crtc_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> +#include <drm/drm_fb_helper.h>
>>   #include <drm/drm_fb_cma_helper.h>
>>   #include <drm/drm_of.h>
>>
>> @@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
>>          return ret;
>>   }
>>
>> -static void sti_output_poll_changed(struct drm_device *ddev)
>> -{
>> -       struct sti_private *private = ddev->dev_private;
>> -
>> -       drm_fbdev_cma_hotplug_event(private->fbdev);
>> -}
>> -
>>   static const struct drm_mode_config_funcs sti_mode_config_funcs = {
>>          .fb_create = drm_gem_fb_create,
>> -       .output_poll_changed = sti_output_poll_changed,
>> +       .output_poll_changed = drm_fb_helper_output_poll_changed,
>>          .atomic_check = sti_atomic_check,
>>          .atomic_commit = drm_atomic_helper_commit,
>>   };
>> @@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
>>   {
>>          struct sti_private *private = ddev->dev_private;
>>
>> -       if (private->fbdev) {
>> -               drm_fbdev_cma_fini(private->fbdev);
>> -               private->fbdev = NULL;
>> -       }
>> -
>> +       drm_fb_cma_fbdev_fini(ddev);
>>          drm_kms_helper_poll_fini(ddev);
>>          component_unbind_all(ddev->dev, ddev);
>>          kfree(private);
>> @@ -245,7 +235,6 @@ static int sti_bind(struct device *dev)
>>   {
>>          struct drm_device *ddev;
>>          struct sti_private *private;
>> -       struct drm_fbdev_cma *fbdev;
>>          int ret;
>>
>>          ddev = drm_dev_alloc(&sti_driver, dev);
>> @@ -268,13 +257,9 @@ static int sti_bind(struct device *dev)
>>
>>          private = ddev->dev_private;
>>          if (ddev->mode_config.num_connector) {
>> -               fbdev = drm_fbdev_cma_init(ddev, 32,
>> -                                          ddev->mode_config.num_connector);
>> -               if (IS_ERR(fbdev)) {
>> +               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
>> +               if (ret)
>>                          DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
>> -                       fbdev = NULL;
>> -               }
>> -               private->fbdev = fbdev;
>>          }
> Like for stm driver I think that drm_kms_helper_poll_init() call
> should be move after
> this block of code.

I fail to see how this patchset affects output polling.
What kind of problem are you seeing?

I think we need to understand what's happening here because more
drivers call drm_kms_helper_poll_init() before fbdev init.

These are the various call sequences in the cma helper drivers:

arc, hdlcd, kirin, mxsfb, rcar-du, stm, zte:

drm_mode_config_reset()
drm_kms_helper_poll_init()
drm_fbdev_cma_init()
drm_dev_register()


atmel-hlcdc, imx, meson, pl111, sun4i, tilcdc, tve200:

drm_mode_config_reset()
drm_fbdev_cma_init()
drm_kms_helper_poll_init()
drm_dev_register()


sti:

drm_kms_helper_poll_init()
drm_dev_register()
drm_mode_config_reset()
drm_fbdev_cma_init()


vc4:

drm_dev_register()
drm_mode_config_reset()
drm_fbdev_cma_init()
drm_kms_helper_poll_init()

> struct sti_private *private could also be remove of the function.

Will do.

> When testing your patches I have a kernel panic in drm_fbdev_cma_create()
> because fbdev_cma->fb_funcs is NULL so using/testing fbdev_cma->fb_funcs->dirty
> make kernel crash.

Sorry about this, I was certain that I had tested this on the vc4 driver,
but it's clear that I haven't :/

Thanks for catching this!

Noralf.

> Just adding a test on fbdev_cma->fb_funcs value fix the problem but I
> wonder why I'm
> the only to report this issue ?
>
> With all these fix I have a fonctionnal frame buffer.
>
> Benjamin
>>          return 0;
>> diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
>> index 6502ed2d3351..16c5c9110cb0 100644
>> --- a/drivers/gpu/drm/sti/sti_drv.h
>> +++ b/drivers/gpu/drm/sti/sti_drv.h
>> @@ -24,7 +24,6 @@ struct sti_private {
>>          struct sti_compositor *compo;
>>          struct drm_property *plane_zorder_property;
>>          struct drm_device *drm_dev;
>> -       struct drm_fbdev_cma *fbdev;
>>   };
>>
>>   extern struct platform_driver sti_tvout_driver;
>> --
>> 2.14.2
>>
>
>

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

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

* Re: [PATCH 13/22] drm/stm: Use drm_fb_cma_fbdev_init/fini()
  2017-11-06 17:32   ` Philippe CORNU
@ 2017-11-08 15:23     ` Noralf Trønnes
  0 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-08 15:23 UTC (permalink / raw)
  To: Philippe CORNU, dri-devel
  Cc: marex, boris.brezillon, david, narmstrong, liviu.dudau,
	alison.wang, abrodkin, jsarha, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, laurent.pinchart, puck.chen, zourongrong,
	shawnguo, maxime.ripard, Vincent ABRIOU


Den 06.11.2017 18.32, skrev Philippe CORNU:
> Hi Noralf,
>
> On 11/04/2017 02:04 PM, Noralf Trønnes wrote:
>> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> This means that the driver doesn't have to keep track of that.
>> Also use the drm_fb_helper functions directly.
>>
>> Cc: Yannick Fertre <yannick.fertre@st.com>
>> Cc: Philippe Cornu <philippe.cornu@st.com>
>> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> Cc: Vincent Abriou <vincent.abriou@st.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Many thanks for this nice cleanup.
>
> I will have to push a small fix to move drm_kms_helper_poll_init() after
> drm_fb_cma_fbdev_init() in order to remove a warning when booting (+ a
> small cleanup as "ldev = ddev->dev_private;" is not used anymore before
> drm_fb_cma_fbdev_init().

I can remove ldev in the next version.
Please take part in the conversation with Benjamin about polling in the 
sti patch.

Noralf.

> Anyway, regarding your patchset for stm:
>
> Acked-by: Philippe Cornu <philippe.cornu@st.com>
> Tested-by: Philippe Cornu <philippe.cornu@st.com>
>
> Thank you,
> Philippe :-)
>
>> ---
>>    drivers/gpu/drm/stm/drv.c  | 37 ++++++-------------------------------
>>    drivers/gpu/drm/stm/ltdc.h |  1 -
>>    2 files changed, 6 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
>> index c857663eafc2..9a66f5671d4f 100644
>> --- a/drivers/gpu/drm/stm/drv.c
>> +++ b/drivers/gpu/drm/stm/drv.c
>> @@ -15,6 +15,7 @@
>>    #include <drm/drm_atomic.h>
>>    #include <drm/drm_atomic_helper.h>
>>    #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_fb_helper.h>
>>    #include <drm/drm_fb_cma_helper.h>
>>    #include <drm/drm_gem_cma_helper.h>
>>    #include <drm/drm_gem_framebuffer_helper.h>
>> @@ -24,35 +25,19 @@
>>    #define STM_MAX_FB_WIDTH	2048
>>    #define STM_MAX_FB_HEIGHT	2048 /* same as width to handle orientation */
>>    
>> -static void drv_output_poll_changed(struct drm_device *ddev)
>> -{
>> -	struct ltdc_device *ldev = ddev->dev_private;
>> -
>> -	drm_fbdev_cma_hotplug_event(ldev->fbdev);
>> -}
>> -
>>    static const struct drm_mode_config_funcs drv_mode_config_funcs = {
>>    	.fb_create = drm_gem_fb_create,
>> -	.output_poll_changed = drv_output_poll_changed,
>> +	.output_poll_changed = drm_fb_helper_output_poll_changed,
>>    	.atomic_check = drm_atomic_helper_check,
>>    	.atomic_commit = drm_atomic_helper_commit,
>>    };
>>    
>> -static void drv_lastclose(struct drm_device *ddev)
>> -{
>> -	struct ltdc_device *ldev = ddev->dev_private;
>> -
>> -	DRM_DEBUG("%s\n", __func__);
>> -
>> -	drm_fbdev_cma_restore_mode(ldev->fbdev);
>> -}
>> -
>>    DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
>>    
>>    static struct drm_driver drv_driver = {
>>    	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>>    			   DRIVER_ATOMIC,
>> -	.lastclose = drv_lastclose,
>> +	.lastclose = drm_fb_helper_lastclose,
>>    	.name = "stm",
>>    	.desc = "STMicroelectronics SoC DRM",
>>    	.date = "20170330",
>> @@ -79,7 +64,6 @@ static struct drm_driver drv_driver = {
>>    static int drv_load(struct drm_device *ddev)
>>    {
>>    	struct platform_device *pdev = to_platform_device(ddev->dev);
>> -	struct drm_fbdev_cma *fbdev;
>>    	struct ltdc_device *ldev;
>>    	int ret;
>>    
>> @@ -113,13 +97,9 @@ static int drv_load(struct drm_device *ddev)
>>    
>>    	if (ddev->mode_config.num_connector) {
>>    		ldev = ddev->dev_private;
>> -		fbdev = drm_fbdev_cma_init(ddev, 16,
>> -					   ddev->mode_config.num_connector);
>> -		if (IS_ERR(fbdev)) {
>> +		ret = drm_fb_cma_fbdev_init(ddev, 16, 0);
>> +		if (ret)
>>    			DRM_DEBUG("Warning: fails to create fbdev\n");
>> -			fbdev = NULL;
>> -		}
>> -		ldev->fbdev = fbdev;
>>    	}
>>    
>>    	platform_set_drvdata(pdev, ddev);
>> @@ -132,14 +112,9 @@ static int drv_load(struct drm_device *ddev)
>>    
>>    static void drv_unload(struct drm_device *ddev)
>>    {
>> -	struct ltdc_device *ldev = ddev->dev_private;
>> -
>>    	DRM_DEBUG("%s\n", __func__);
>>    
>> -	if (ldev->fbdev) {
>> -		drm_fbdev_cma_fini(ldev->fbdev);
>> -		ldev->fbdev = NULL;
>> -	}
>> +	drm_fb_cma_fbdev_fini(ddev);
>>    	drm_kms_helper_poll_fini(ddev);
>>    	ltdc_unload(ddev);
>>    	drm_mode_config_cleanup(ddev);
>> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
>> index ae437557d715..27ac217406be 100644
>> --- a/drivers/gpu/drm/stm/ltdc.h
>> +++ b/drivers/gpu/drm/stm/ltdc.h
>> @@ -21,7 +21,6 @@ struct ltdc_caps {
>>    };
>>    
>>    struct ltdc_device {
>> -	struct drm_fbdev_cma *fbdev;
>>    	void __iomem *regs;
>>    	struct clk *pixel_clk;	/* lcd pixel clock */
>>    	struct mutex err_lock;	/* protecting error_status */
>>

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

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

* Re: [PATCH 12/22] drm/sti: Use drm_fb_cma_fbdev_init/fini()
  2017-11-08 15:21     ` Noralf Trønnes
@ 2017-11-09  8:20       ` Daniel Vetter
  2017-11-09  9:20         ` Benjamin Gaignard
  0 siblings, 1 reply; 49+ messages in thread
From: Daniel Vetter @ 2017-11-09  8:20 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: marex, boris.brezillon, david, narmstrong, abrodkin, dri-devel,
	Alison Wang, liviu.dudau, Philippe Cornu, Jyri Sarha,
	z.liuxinliang, kongxinwei (A),
	Tomi Valkeinen, Laurent Pinchart, Chen Feng, Rongrong Zou,
	Shawn Guo, Maxime Ripard, Vincent Abriou, Yannick Fertre

On Wed, Nov 08, 2017 at 04:21:04PM +0100, Noralf Trønnes wrote:
> 
> Den 08.11.2017 13.21, skrev Benjamin Gaignard:
> > 2017-11-04 14:04 GMT+01:00 Noralf Trønnes <noralf@tronnes.org>:
> > > Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> > > the fact that drm_device holds a pointer to the drm_fb_helper structure.
> > > This means that the driver doesn't have to keep track of that.
> > > Also use the drm_fb_helper functions directly.
> > > 
> > > Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> > > Cc: Vincent Abriou <vincent.abriou@st.com>
> > > Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> > > ---
> > >   drivers/gpu/drm/sti/sti_drv.c | 25 +++++--------------------
> > >   drivers/gpu/drm/sti/sti_drv.h |  1 -
> > >   2 files changed, 5 insertions(+), 21 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> > > index 9e9343101738..d61efef30a82 100644
> > > --- a/drivers/gpu/drm/sti/sti_drv.c
> > > +++ b/drivers/gpu/drm/sti/sti_drv.c
> > > @@ -17,6 +17,7 @@
> > >   #include <drm/drm_crtc_helper.h>
> > >   #include <drm/drm_gem_cma_helper.h>
> > >   #include <drm/drm_gem_framebuffer_helper.h>
> > > +#include <drm/drm_fb_helper.h>
> > >   #include <drm/drm_fb_cma_helper.h>
> > >   #include <drm/drm_of.h>
> > > 
> > > @@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
> > >          return ret;
> > >   }
> > > 
> > > -static void sti_output_poll_changed(struct drm_device *ddev)
> > > -{
> > > -       struct sti_private *private = ddev->dev_private;
> > > -
> > > -       drm_fbdev_cma_hotplug_event(private->fbdev);
> > > -}
> > > -
> > >   static const struct drm_mode_config_funcs sti_mode_config_funcs = {
> > >          .fb_create = drm_gem_fb_create,
> > > -       .output_poll_changed = sti_output_poll_changed,
> > > +       .output_poll_changed = drm_fb_helper_output_poll_changed,
> > >          .atomic_check = sti_atomic_check,
> > >          .atomic_commit = drm_atomic_helper_commit,
> > >   };
> > > @@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
> > >   {
> > >          struct sti_private *private = ddev->dev_private;
> > > 
> > > -       if (private->fbdev) {
> > > -               drm_fbdev_cma_fini(private->fbdev);
> > > -               private->fbdev = NULL;
> > > -       }
> > > -
> > > +       drm_fb_cma_fbdev_fini(ddev);
> > >          drm_kms_helper_poll_fini(ddev);
> > >          component_unbind_all(ddev->dev, ddev);
> > >          kfree(private);
> > > @@ -245,7 +235,6 @@ static int sti_bind(struct device *dev)
> > >   {
> > >          struct drm_device *ddev;
> > >          struct sti_private *private;
> > > -       struct drm_fbdev_cma *fbdev;
> > >          int ret;
> > > 
> > >          ddev = drm_dev_alloc(&sti_driver, dev);
> > > @@ -268,13 +257,9 @@ static int sti_bind(struct device *dev)
> > > 
> > >          private = ddev->dev_private;
> > >          if (ddev->mode_config.num_connector) {
> > > -               fbdev = drm_fbdev_cma_init(ddev, 32,
> > > -                                          ddev->mode_config.num_connector);
> > > -               if (IS_ERR(fbdev)) {
> > > +               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
> > > +               if (ret)
> > >                          DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
> > > -                       fbdev = NULL;
> > > -               }
> > > -               private->fbdev = fbdev;
> > >          }
> > Like for stm driver I think that drm_kms_helper_poll_init() call
> > should be move after
> > this block of code.
> 
> I fail to see how this patchset affects output polling.
> What kind of problem are you seeing?
> 
> I think we need to understand what's happening here because more
> drivers call drm_kms_helper_poll_init() before fbdev init.

That's kinda how you should be doing it - fbdev init needs to probe the
outputs, if your poll work doesn't work yet then that's not going to pan
out well. Now afaiui most of the current drivers need polling for fun
stuff like TV-out or vga, so no one notices.

And it might very well be that it's all 100% cargo-culted and people just
put it there because everyone else does, not because they actually need
output polling.
> 
> These are the various call sequences in the cma helper drivers:
> 
> arc, hdlcd, kirin, mxsfb, rcar-du, stm, zte:
> 
> drm_mode_config_reset()
> drm_kms_helper_poll_init()
> drm_fbdev_cma_init()
> drm_dev_register()

This looks reasonable.
> 
> 
> atmel-hlcdc, imx, meson, pl111, sun4i, tilcdc, tve200:
> 
> drm_mode_config_reset()
> drm_fbdev_cma_init()
> drm_kms_helper_poll_init()
> drm_dev_register()

Probably they don't really need polling.
> 
> 
> sti:
> 
> drm_kms_helper_poll_init()
> drm_dev_register()
> drm_mode_config_reset()
> drm_fbdev_cma_init()

drm_dev_register should be last. Otherwise even looks correct.

> vc4:
> 
> drm_dev_register()
> drm_mode_config_reset()
> drm_fbdev_cma_init()
> drm_kms_helper_poll_init()

Very confusing. Hm I thought I've once checked the vc4 conversion to
explicit register/unregister, I guess not carefully enough.
-Daniel

> > struct sti_private *private could also be remove of the function.
> 
> Will do.
> 
> > When testing your patches I have a kernel panic in drm_fbdev_cma_create()
> > because fbdev_cma->fb_funcs is NULL so using/testing fbdev_cma->fb_funcs->dirty
> > make kernel crash.
> 
> Sorry about this, I was certain that I had tested this on the vc4 driver,
> but it's clear that I haven't :/
> 
> Thanks for catching this!
> 
> Noralf.
> 
> > Just adding a test on fbdev_cma->fb_funcs value fix the problem but I
> > wonder why I'm
> > the only to report this issue ?
> > 
> > With all these fix I have a fonctionnal frame buffer.
> > 
> > Benjamin
> > >          return 0;
> > > diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
> > > index 6502ed2d3351..16c5c9110cb0 100644
> > > --- a/drivers/gpu/drm/sti/sti_drv.h
> > > +++ b/drivers/gpu/drm/sti/sti_drv.h
> > > @@ -24,7 +24,6 @@ struct sti_private {
> > >          struct sti_compositor *compo;
> > >          struct drm_property *plane_zorder_property;
> > >          struct drm_device *drm_dev;
> > > -       struct drm_fbdev_cma *fbdev;
> > >   };
> > > 
> > >   extern struct platform_driver sti_tvout_driver;
> > > --
> > > 2.14.2
> > > 
> > 
> > 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 12/22] drm/sti: Use drm_fb_cma_fbdev_init/fini()
  2017-11-09  8:20       ` Daniel Vetter
@ 2017-11-09  9:20         ` Benjamin Gaignard
  0 siblings, 0 replies; 49+ messages in thread
From: Benjamin Gaignard @ 2017-11-09  9:20 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Marek Vašut, boris.brezillon, David Lechner, dri-devel,
	narmstrong, abrodkin, Tomi Valkeinen, Alison Wang, Liviu Dudau,
	Philippe Cornu, Jyri Sarha, z.liuxinliang, kongxinwei (A),
	Laurent Pinchart, Chen Feng, Rongrong Zou, Shawn Guo,
	Maxime Ripard, Vincent Abriou, Yannick Fertre

2017-11-09 9:20 GMT+01:00 Daniel Vetter <daniel@ffwll.ch>:
> On Wed, Nov 08, 2017 at 04:21:04PM +0100, Noralf Trønnes wrote:
>>
>> Den 08.11.2017 13.21, skrev Benjamin Gaignard:
>> > 2017-11-04 14:04 GMT+01:00 Noralf Trønnes <noralf@tronnes.org>:
>> > > Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> > > the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> > > This means that the driver doesn't have to keep track of that.
>> > > Also use the drm_fb_helper functions directly.
>> > >
>> > > Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> > > Cc: Vincent Abriou <vincent.abriou@st.com>
>> > > Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> > > ---
>> > >   drivers/gpu/drm/sti/sti_drv.c | 25 +++++--------------------
>> > >   drivers/gpu/drm/sti/sti_drv.h |  1 -
>> > >   2 files changed, 5 insertions(+), 21 deletions(-)
>> > >
>> > > diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
>> > > index 9e9343101738..d61efef30a82 100644
>> > > --- a/drivers/gpu/drm/sti/sti_drv.c
>> > > +++ b/drivers/gpu/drm/sti/sti_drv.c
>> > > @@ -17,6 +17,7 @@
>> > >   #include <drm/drm_crtc_helper.h>
>> > >   #include <drm/drm_gem_cma_helper.h>
>> > >   #include <drm/drm_gem_framebuffer_helper.h>
>> > > +#include <drm/drm_fb_helper.h>
>> > >   #include <drm/drm_fb_cma_helper.h>
>> > >   #include <drm/drm_of.h>
>> > >
>> > > @@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
>> > >          return ret;
>> > >   }
>> > >
>> > > -static void sti_output_poll_changed(struct drm_device *ddev)
>> > > -{
>> > > -       struct sti_private *private = ddev->dev_private;
>> > > -
>> > > -       drm_fbdev_cma_hotplug_event(private->fbdev);
>> > > -}
>> > > -
>> > >   static const struct drm_mode_config_funcs sti_mode_config_funcs = {
>> > >          .fb_create = drm_gem_fb_create,
>> > > -       .output_poll_changed = sti_output_poll_changed,
>> > > +       .output_poll_changed = drm_fb_helper_output_poll_changed,
>> > >          .atomic_check = sti_atomic_check,
>> > >          .atomic_commit = drm_atomic_helper_commit,
>> > >   };
>> > > @@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
>> > >   {
>> > >          struct sti_private *private = ddev->dev_private;
>> > >
>> > > -       if (private->fbdev) {
>> > > -               drm_fbdev_cma_fini(private->fbdev);
>> > > -               private->fbdev = NULL;
>> > > -       }
>> > > -
>> > > +       drm_fb_cma_fbdev_fini(ddev);
>> > >          drm_kms_helper_poll_fini(ddev);
>> > >          component_unbind_all(ddev->dev, ddev);
>> > >          kfree(private);
>> > > @@ -245,7 +235,6 @@ static int sti_bind(struct device *dev)
>> > >   {
>> > >          struct drm_device *ddev;
>> > >          struct sti_private *private;
>> > > -       struct drm_fbdev_cma *fbdev;
>> > >          int ret;
>> > >
>> > >          ddev = drm_dev_alloc(&sti_driver, dev);
>> > > @@ -268,13 +257,9 @@ static int sti_bind(struct device *dev)
>> > >
>> > >          private = ddev->dev_private;
>> > >          if (ddev->mode_config.num_connector) {
>> > > -               fbdev = drm_fbdev_cma_init(ddev, 32,
>> > > -                                          ddev->mode_config.num_connector);
>> > > -               if (IS_ERR(fbdev)) {
>> > > +               ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
>> > > +               if (ret)
>> > >                          DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
>> > > -                       fbdev = NULL;
>> > > -               }
>> > > -               private->fbdev = fbdev;
>> > >          }
>> > Like for stm driver I think that drm_kms_helper_poll_init() call
>> > should be move after
>> > this block of code.
>>
>> I fail to see how this patchset affects output polling.
>> What kind of problem are you seeing?
>>
>> I think we need to understand what's happening here because more
>> drivers call drm_kms_helper_poll_init() before fbdev init.
>
> That's kinda how you should be doing it - fbdev init needs to probe the
> outputs, if your poll work doesn't work yet then that's not going to pan
> out well. Now afaiui most of the current drivers need polling for fun
> stuff like TV-out or vga, so no one notices.
>
> And it might very well be that it's all 100% cargo-culted and people just
> put it there because everyone else does, not because they actually need
> output polling.
>>
>> These are the various call sequences in the cma helper drivers:
>>
>> arc, hdlcd, kirin, mxsfb, rcar-du, stm, zte:
>>
>> drm_mode_config_reset()
>> drm_kms_helper_poll_init()
>> drm_fbdev_cma_init()
>> drm_dev_register()
>
> This looks reasonable.
>>
>>
>> atmel-hlcdc, imx, meson, pl111, sun4i, tilcdc, tve200:
>>
>> drm_mode_config_reset()
>> drm_fbdev_cma_init()
>> drm_kms_helper_poll_init()
>> drm_dev_register()
>
> Probably they don't really need polling.
>>
>>
>> sti:
>>
>> drm_kms_helper_poll_init()
>> drm_dev_register()
>> drm_mode_config_reset()
>> drm_fbdev_cma_init()
>
> drm_dev_register should be last. Otherwise even looks correct.

I have redo the test, current ordering is working even with the Noralf patches,
no need to change drm_kms_helper_poll_init() location.

Benjamin

>
>> vc4:
>>
>> drm_dev_register()
>> drm_mode_config_reset()
>> drm_fbdev_cma_init()
>> drm_kms_helper_poll_init()
>
> Very confusing. Hm I thought I've once checked the vc4 conversion to
> explicit register/unregister, I guess not carefully enough.
> -Daniel
>
>> > struct sti_private *private could also be remove of the function.
>>
>> Will do.
>>
>> > When testing your patches I have a kernel panic in drm_fbdev_cma_create()
>> > because fbdev_cma->fb_funcs is NULL so using/testing fbdev_cma->fb_funcs->dirty
>> > make kernel crash.
>>
>> Sorry about this, I was certain that I had tested this on the vc4 driver,
>> but it's clear that I haven't :/
>>
>> Thanks for catching this!
>>
>> Noralf.
>>
>> > Just adding a test on fbdev_cma->fb_funcs value fix the problem but I
>> > wonder why I'm
>> > the only to report this issue ?
>> >
>> > With all these fix I have a fonctionnal frame buffer.
>> >
>> > Benjamin
>> > >          return 0;
>> > > diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
>> > > index 6502ed2d3351..16c5c9110cb0 100644
>> > > --- a/drivers/gpu/drm/sti/sti_drv.h
>> > > +++ b/drivers/gpu/drm/sti/sti_drv.h
>> > > @@ -24,7 +24,6 @@ struct sti_private {
>> > >          struct sti_compositor *compo;
>> > >          struct drm_property *plane_zorder_property;
>> > >          struct drm_device *drm_dev;
>> > > -       struct drm_fbdev_cma *fbdev;
>> > >   };
>> > >
>> > >   extern struct platform_driver sti_tvout_driver;
>> > > --
>> > > 2.14.2
>> > >
>> >
>> >
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 20/22] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
  2017-11-04 13:04 ` [PATCH 20/22] drm/fsl-dcu: " Noralf Trønnes
@ 2017-11-10 17:01   ` Stefan Agner
  2017-11-10 17:59     ` Noralf Trønnes
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Agner @ 2017-11-10 17:01 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: narmstrong, liviu.dudau, dri-devel, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo

On 2017-11-04 14:04, Noralf Trønnes wrote:
> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
> the fact that drm_device holds a pointer to the drm_fb_helper structure.
> This means that the driver doesn't have to keep track of that.
> Also use the drm_fb_helper functions directly.

With the suspend/resume helper and this patchset applied I get:

[    0.788177] Unable to handle kernel NULL pointer dereference at
virtual address 00000008
[    0.796341] pgd = 80004000
[    0.799074] [00000008] *pgd=00000000
[    0.802687] Internal error: Oops: 5 [#1] ARM
[    0.806981] Modules linked in:
[    0.810070] CPU: 0 PID: 1 Comm: swapper Not tainted
4.14.0-rc3-00048-gea604dafe5ec-dirty #732
[    0.818635] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
[    0.825100] task: 8e444000 task.stack: 8e442000
[    0.829673] PC is at drm_fbdev_cma_create+0x148/0x268
[    0.834747] LR is at 0x10
[    0.837388] pc : [<804867b4>]    lr : [<00000010>]    psr: 80000053
[    0.843678] sp : 8e443b98  ip : 00000000  fp : 8e443bd4
[    0.848926] r10: 8e620400  r9 : 8e623a00  r8 : 8e617240
[    0.854179] r7 : 8e617180  r6 : 000e1000  r5 : 8e443bd8  r4 :
8e620c00
[    0.860733] r3 : 00000000  r2 : 8ed00000  r1 : 00000000  r0 :
00000003
[    0.867288] Flags: Nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM 
Segment none
[    0.874549] Control: 10c5387d  Table: 80004059  DAC: 00000051
[    0.880318] Process swapper (pid: 1, stack limit = 0x8e442208)
[    0.886177] Stack: (0x8e443b98 to 0x8e444000)
[    0.890560] 3b80:                                                    
  00000000 00000018
[    0.898782] 3ba0: 8e625240 00000003 80c39ecc 8e617180 00000018
8e620400 80c20428 00000001
[    0.907009] 3bc0: 8e6250a8 00000000 8e443c1c 8e443bd8 80485c00
80486678 00000280 000001e0
[    0.915235] 3be0: 00000280 000001e0 00000018 00000018 8e617210
8e617180 00000018 00000000
[    0.923463] 3c00: 8e617180 00000000 8e618700 00000000 8e443c34
8e443c20 80485e18 80485a30
[    0.931690] 3c20: 00000018 8e620400 8e443cfc 8e443c38 80486518
80485de8 00000000 00000000
[    0.939915] 3c40: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    0.948133] 3c60: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    0.956352] 3c80: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    0.964570] 3ca0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    0.972790] 3cc0: 00000000 00000000 00000000 00000000 00000000
00000000 8e443d0c 8e620400
[    0.981018] 3ce0: 80c20878 8e61c810 80c208d8 00000000 8e443d0c
8e443d00 8048654c 8048637c
[    0.989245] 3d00: 8e443d2c 8e443d10 804ae0f4 80486544 8e620400
00000000 00000000 80c208d8
[    0.997472] 3d20: 8e443d64 8e443d30 8048da94 804ae070 00000000
809b0410 8e443d64 8e443d48
[    1.005699] 3d40: 8e61c810 8e4b7a10 8e4b7a00 8e620400 00000000
809b0410 8e443dcc 8e443d68
[    1.013925] 3d60: 804ae350 8048d960 9004e054 00000000 00000008
00000010 00000000 00000001
[    1.022153] 3d80: 30756364 7669645f 7869705f 8e443d00 802417c8
8023ded4 8e4b7a10 00000000
[    1.030380] 3da0: 8e4b7a18 8e4b7a10 ffffffed 80c2088c fffffdfb
80c2088c 00000000 00000000
[    1.038607] 3dc0: 8e443dec 8e443dd0 804b90b4 804ae178 8e4b7a10
80c5b410 80c5b414 00000000
[    1.046835] 3de0: 8e443e1c 8e443df0 804b7578 804b9068 00000000
8e4b7a10 80c2088c 8e4b7a44
[    1.055061] 3e00: 00000000 000000c2 80b0061c 00000007 8e443e3c
8e443e20 804b76b0 804b730c
[    1.063289] 3e20: 00000000 80c2088c 804b75f0 00000000 8e443e64
8e443e40 804b5878 804b75fc
[    1.071516] 3e40: 8e403f4c 8e4b63b0 8e6128b4 80c2088c 8e612880
80c20ee8 8e443e74 8e443e68
[    1.079743] 3e60: 804b6eb8 804b5814 8e443e9c 8e443e78 804b6930
804b6ea0 809b9bcc 8e443e88
[    1.087970] 3e80: 80c2088c 80b1b304 00000000 80b2d830 8e443eb4
8e443ea0 804b802c 804b6834
[    1.096197] 3ea0: 80c20ee8 80b1b304 8e443ecc 8e443eb8 804b9010
804b7fb8 ffffe000 80b1b304
[    1.104424] 3ec0: 8e443edc 8e443ed0 80b1b320 804b8fd4 8e443f4c
8e443ee0 8010190c 80b1b310
[    1.112651] 3ee0: 8e443f4c 8e443ef0 80134300 80b00628 8096fbd0
8096fbb0 8096fbfc 8096fb88
[    1.120878] 3f00: 80977cc4 00000006 00000006 00000000 80a351fc
809cdb30 8fdffc04 8fdffc0d
[    1.129105] 3f20: 00000000 80c37800 80c37800 80c37800 80c37800
80b38adc 000000c2 80b0061c
[    1.137332] 3f40: 8e443f94 8e443f50 80b00e88 801018cc 00000006
00000006 00000000 80b0061c
[    1.145558] 3f60: 00000000 80a351fc 00000000 00000000 80792c48
00000000 00000000 00000000
[    1.153777] 3f80: 00000000 00000000 8e443fac 8e443f98 80792c58
80b00d5c 00000000 80792c48
[    1.162004] 3fa0: 00000000 8e443fb0 80107cb0 80792c54 00000000
00000000 00000000 00000000
[    1.170230] 3fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    1.178449] 3fe0: 00000000 00000000 00000000 00000000 00000013
00000000 5aefffff 7deefbff
[    1.186662] Backtrace:
[    1.189151] [<8048666c>] (drm_fbdev_cma_create) from [<80485c00>]
(__drm_fb_helper_initial_config_and_unlock+0x1dc/0x3b8)
[    1.200164]  r10:00000000 r9:8e6250a8 r8:00000001 r7:80c20428
r6:8e620400 r5:00000018
[    1.208030]  r4:8e617180
[    1.210598] [<80485a24>] (__drm_fb_helper_initial_config_and_unlock)
from [<80485e18>] (drm_fb_helper_initial_config+0x3c/0x40)
[    1.222126]  r10:00000000 r9:8e618700 r8:00000000 r7:8e617180
r6:00000000 r5:00000018
[    1.229986]  r4:8e617180
[    1.232553] [<80485ddc>] (drm_fb_helper_initial_config) from
[<80486518>] (drm_fb_cma_fbdev_init_with_funcs+0x1a8/0x1c8)
[    1.243464]  r5:8e620400 r4:00000018
[    1.247072] [<80486370>] (drm_fb_cma_fbdev_init_with_funcs) from
[<8048654c>] (drm_fb_cma_fbdev_init+0x14/0x18)
[    1.257208]  r8:00000000 r7:80c208d8 r6:8e61c810 r5:80c20878
r4:8e620400
[    1.263951] [<80486538>] (drm_fb_cma_fbdev_init) from [<804ae0f4>]
(fsl_dcu_load+0x90/0x108)
[    1.272446] [<804ae064>] (fsl_dcu_load) from [<8048da94>]
(drm_dev_register+0x140/0x1d8)
[    1.280581]  r7:80c208d8 r6:00000000 r5:00000000 r4:8e620400
[    1.286277] [<8048d954>] (drm_dev_register) from [<804ae350>]
(fsl_dcu_drm_probe+0x1e4/0x2e4)
[    1.294854]  r9:809b0410 r8:00000000 r7:8e620400 r6:8e4b7a00
r5:8e4b7a10 r4:8e61c810
[    1.302652] [<804ae16c>] (fsl_dcu_drm_probe) from [<804b90b4>]
(platform_drv_probe+0x58/0xb8)
[    1.311222]  r10:00000000 r9:00000000 r8:80c2088c r7:fffffdfb
r6:80c2088c r5:ffffffed
[    1.319087]  r4:8e4b7a10
[    1.321653] [<804b905c>] (platform_drv_probe) from [<804b7578>]
(driver_probe_device+0x278/0x2f0)
[    1.330570]  r7:00000000 r6:80c5b414 r5:80c5b410 r4:8e4b7a10
[    1.336262] [<804b7300>] (driver_probe_device) from [<804b76b0>]
(__driver_attach+0xc0/0xc4)
[    1.344745]  r10:00000007 r9:80b0061c r8:000000c2 r7:00000000
r6:8e4b7a44 r5:80c2088c
[    1.352613]  r4:8e4b7a10 r3:00000000
[    1.356228] [<804b75f0>] (__driver_attach) from [<804b5878>]
(bus_for_each_dev+0x70/0xa4)
[    1.364449]  r7:00000000 r6:804b75f0 r5:80c2088c r4:00000000
[    1.370145] [<804b5808>] (bus_for_each_dev) from [<804b6eb8>]
(driver_attach+0x24/0x28)
[    1.378193]  r6:80c20ee8 r5:8e612880 r4:80c2088c
[    1.382845] [<804b6e94>] (driver_attach) from [<804b6930>]
(bus_add_driver+0x108/0x214)
[    1.390895] [<804b6828>] (bus_add_driver) from [<804b802c>]
(driver_register+0x80/0xfc)
[    1.398945]  r7:80b2d830 r6:00000000 r5:80b1b304 r4:80c2088c
[    1.404640] [<804b7fac>] (driver_register) from [<804b9010>]
(__platform_driver_register+0x48/0x50)
[    1.413721]  r5:80b1b304 r4:80c20ee8
[    1.417346] [<804b8fc8>] (__platform_driver_register) from
[<80b1b320>] (fsl_dcu_drm_platform_driver_init+0x1c/0x20)
[    1.427914]  r5:80b1b304 r4:ffffe000
[    1.431530] [<80b1b304>] (fsl_dcu_drm_platform_driver_init) from
[<8010190c>] (do_one_initcall+0x4c/0x170)
[    1.441241] [<801018c0>] (do_one_initcall) from [<80b00e88>]
(kernel_init_freeable+0x138/0x1c8)
[    1.449986]  r9:80b0061c r8:000000c2 r6:80b38adc r5:80c37800
r4:80c37800
[    1.456737] [<80b00d50>] (kernel_init_freeable) from [<80792c58>]
(kernel_init+0x10/0x10c)
[    1.465052]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
r6:00000000 r5:80792c48
[    1.472919]  r4:00000000
[    1.475491] [<80792c48>] (kernel_init) from [<80107cb0>]
(ret_from_fork+0x14/0x24)
[    1.483093]  r5:80792c48 r4:00000000
[    1.486697] Code: e58460d8 e0823003 e58430d4 e59730ac (e5935008)
[    1.492895] ---[ end trace 95d88c85f82f6379 ]---
[    1.497604] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x0000000b

I did not yet look further into this, maybe you have an idea?

--
Stefan


> 
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Alison Wang <alison.wang@freescale.com>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++--------------------
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>  2 files changed, 6 insertions(+), 21 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 1a9ee657bbac..45a44bb7a2e4 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -11,7 +11,6 @@
>  
>  #include <linux/clk.h>
>  #include <linux/clk-provider.h>
> -#include <linux/console.h>
>  #include <linux/io.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/mm.h>
> @@ -25,6 +24,7 @@
>  #include <drm/drmP.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_modeset_helper.h>
> @@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev,
> unsigned long flags)
>  			"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
>  		legacyfb_depth = 24;
>  	}
> -	fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
> -	if (IS_ERR(fsl_dev->fbdev)) {
> -		ret = PTR_ERR(fsl_dev->fbdev);
> -		fsl_dev->fbdev = NULL;
> +	ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1);
> +	if (ret)
>  		goto done;
> -	}
>  
>  	return 0;
>  done:
>  	drm_kms_helper_poll_fini(dev);
>  
> -	if (fsl_dev->fbdev)
> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
> +	drm_fb_cma_fbdev_fini(dev);
>  
>  	drm_mode_config_cleanup(dev);
>  	drm_irq_uninstall(dev);
> @@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev,
> unsigned long flags)
>  
>  static void fsl_dcu_unload(struct drm_device *dev)
>  {
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
>  	drm_atomic_helper_shutdown(dev);
>  	drm_kms_helper_poll_fini(dev);
>  
> -	if (fsl_dev->fbdev)
> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
> +	drm_fb_cma_fbdev_fini(dev);
>  
>  	drm_mode_config_cleanup(dev);
>  	drm_irq_uninstall(dev);
> @@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> -static void fsl_dcu_drm_lastclose(struct drm_device *dev)
> -{
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -
> -	drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>  
>  static struct drm_driver fsl_dcu_drm_driver = {
>  	.driver_features	= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
>  				| DRIVER_PRIME | DRIVER_ATOMIC,
> -	.lastclose		= fsl_dcu_drm_lastclose,
> +	.lastclose		= drm_fb_helper_lastclose,
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
>  	.irq_handler		= fsl_dcu_drm_irq,
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> index 93bfb98012d4..cb87bb74cb87 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> @@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
>  	/*protects hardware register*/
>  	spinlock_t irq_lock;
>  	struct drm_device *drm;
> -	struct drm_fbdev_cma *fbdev;
>  	struct drm_crtc crtc;
>  	struct drm_encoder encoder;
>  	struct fsl_dcu_drm_connector connector;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 20/22] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
  2017-11-10 17:01   ` Stefan Agner
@ 2017-11-10 17:59     ` Noralf Trønnes
  0 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-10 17:59 UTC (permalink / raw)
  To: Stefan Agner
  Cc: narmstrong, liviu.dudau, dri-devel, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo


Den 10.11.2017 18.01, skrev Stefan Agner:
> On 2017-11-04 14:04, Noralf Trønnes wrote:
>> Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
>> the fact that drm_device holds a pointer to the drm_fb_helper structure.
>> This means that the driver doesn't have to keep track of that.
>> Also use the drm_fb_helper functions directly.
> With the suspend/resume helper and this patchset applied I get:
>
> [    0.788177] Unable to handle kernel NULL pointer dereference at
> virtual address 00000008

Sorry about this, Benjamin caught this as well. I will send a new 
version this
weekend.

This is the solution:
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0c73957d7aad..6abb0ab4e7ca 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -294,7 +294,7 @@ drm_fbdev_cma_create(struct drm_fb_helper *helper,
         fbi->screen_size = size;
         fbi->fix.smem_len = size;

-       if (fbdev_cma->fb_funcs->dirty) {
+       if (fb->funcs->dirty) {
                 ret = drm_fbdev_cma_defio_init(fbi, obj);
                 if (ret)
                         goto err_cma_destroy;



> [    0.796341] pgd = 80004000
> [    0.799074] [00000008] *pgd=00000000
> [    0.802687] Internal error: Oops: 5 [#1] ARM
> [    0.806981] Modules linked in:
> [    0.810070] CPU: 0 PID: 1 Comm: swapper Not tainted
> 4.14.0-rc3-00048-gea604dafe5ec-dirty #732
> [    0.818635] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
> [    0.825100] task: 8e444000 task.stack: 8e442000
> [    0.829673] PC is at drm_fbdev_cma_create+0x148/0x268
> [    0.834747] LR is at 0x10
> [    0.837388] pc : [<804867b4>]    lr : [<00000010>]    psr: 80000053
> [    0.843678] sp : 8e443b98  ip : 00000000  fp : 8e443bd4
> [    0.848926] r10: 8e620400  r9 : 8e623a00  r8 : 8e617240
> [    0.854179] r7 : 8e617180  r6 : 000e1000  r5 : 8e443bd8  r4 :
> 8e620c00
> [    0.860733] r3 : 00000000  r2 : 8ed00000  r1 : 00000000  r0 :
> 00000003
> [    0.867288] Flags: Nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM
> Segment none
> [    0.874549] Control: 10c5387d  Table: 80004059  DAC: 00000051
> [    0.880318] Process swapper (pid: 1, stack limit = 0x8e442208)
> [    0.886177] Stack: (0x8e443b98 to 0x8e444000)
> [    0.890560] 3b80:
>    00000000 00000018
> [    0.898782] 3ba0: 8e625240 00000003 80c39ecc 8e617180 00000018
> 8e620400 80c20428 00000001
> [    0.907009] 3bc0: 8e6250a8 00000000 8e443c1c 8e443bd8 80485c00
> 80486678 00000280 000001e0
> [    0.915235] 3be0: 00000280 000001e0 00000018 00000018 8e617210
> 8e617180 00000018 00000000
> [    0.923463] 3c00: 8e617180 00000000 8e618700 00000000 8e443c34
> 8e443c20 80485e18 80485a30
> [    0.931690] 3c20: 00000018 8e620400 8e443cfc 8e443c38 80486518
> 80485de8 00000000 00000000
> [    0.939915] 3c40: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    0.948133] 3c60: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    0.956352] 3c80: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    0.964570] 3ca0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    0.972790] 3cc0: 00000000 00000000 00000000 00000000 00000000
> 00000000 8e443d0c 8e620400
> [    0.981018] 3ce0: 80c20878 8e61c810 80c208d8 00000000 8e443d0c
> 8e443d00 8048654c 8048637c
> [    0.989245] 3d00: 8e443d2c 8e443d10 804ae0f4 80486544 8e620400
> 00000000 00000000 80c208d8
> [    0.997472] 3d20: 8e443d64 8e443d30 8048da94 804ae070 00000000
> 809b0410 8e443d64 8e443d48
> [    1.005699] 3d40: 8e61c810 8e4b7a10 8e4b7a00 8e620400 00000000
> 809b0410 8e443dcc 8e443d68
> [    1.013925] 3d60: 804ae350 8048d960 9004e054 00000000 00000008
> 00000010 00000000 00000001
> [    1.022153] 3d80: 30756364 7669645f 7869705f 8e443d00 802417c8
> 8023ded4 8e4b7a10 00000000
> [    1.030380] 3da0: 8e4b7a18 8e4b7a10 ffffffed 80c2088c fffffdfb
> 80c2088c 00000000 00000000
> [    1.038607] 3dc0: 8e443dec 8e443dd0 804b90b4 804ae178 8e4b7a10
> 80c5b410 80c5b414 00000000
> [    1.046835] 3de0: 8e443e1c 8e443df0 804b7578 804b9068 00000000
> 8e4b7a10 80c2088c 8e4b7a44
> [    1.055061] 3e00: 00000000 000000c2 80b0061c 00000007 8e443e3c
> 8e443e20 804b76b0 804b730c
> [    1.063289] 3e20: 00000000 80c2088c 804b75f0 00000000 8e443e64
> 8e443e40 804b5878 804b75fc
> [    1.071516] 3e40: 8e403f4c 8e4b63b0 8e6128b4 80c2088c 8e612880
> 80c20ee8 8e443e74 8e443e68
> [    1.079743] 3e60: 804b6eb8 804b5814 8e443e9c 8e443e78 804b6930
> 804b6ea0 809b9bcc 8e443e88
> [    1.087970] 3e80: 80c2088c 80b1b304 00000000 80b2d830 8e443eb4
> 8e443ea0 804b802c 804b6834
> [    1.096197] 3ea0: 80c20ee8 80b1b304 8e443ecc 8e443eb8 804b9010
> 804b7fb8 ffffe000 80b1b304
> [    1.104424] 3ec0: 8e443edc 8e443ed0 80b1b320 804b8fd4 8e443f4c
> 8e443ee0 8010190c 80b1b310
> [    1.112651] 3ee0: 8e443f4c 8e443ef0 80134300 80b00628 8096fbd0
> 8096fbb0 8096fbfc 8096fb88
> [    1.120878] 3f00: 80977cc4 00000006 00000006 00000000 80a351fc
> 809cdb30 8fdffc04 8fdffc0d
> [    1.129105] 3f20: 00000000 80c37800 80c37800 80c37800 80c37800
> 80b38adc 000000c2 80b0061c
> [    1.137332] 3f40: 8e443f94 8e443f50 80b00e88 801018cc 00000006
> 00000006 00000000 80b0061c
> [    1.145558] 3f60: 00000000 80a351fc 00000000 00000000 80792c48
> 00000000 00000000 00000000
> [    1.153777] 3f80: 00000000 00000000 8e443fac 8e443f98 80792c58
> 80b00d5c 00000000 80792c48
> [    1.162004] 3fa0: 00000000 8e443fb0 80107cb0 80792c54 00000000
> 00000000 00000000 00000000
> [    1.170230] 3fc0: 00000000 00000000 00000000 00000000 00000000
> 00000000 00000000 00000000
> [    1.178449] 3fe0: 00000000 00000000 00000000 00000000 00000013
> 00000000 5aefffff 7deefbff
> [    1.186662] Backtrace:
> [    1.189151] [<8048666c>] (drm_fbdev_cma_create) from [<80485c00>]
> (__drm_fb_helper_initial_config_and_unlock+0x1dc/0x3b8)
> [    1.200164]  r10:00000000 r9:8e6250a8 r8:00000001 r7:80c20428
> r6:8e620400 r5:00000018
> [    1.208030]  r4:8e617180
> [    1.210598] [<80485a24>] (__drm_fb_helper_initial_config_and_unlock)
> from [<80485e18>] (drm_fb_helper_initial_config+0x3c/0x40)
> [    1.222126]  r10:00000000 r9:8e618700 r8:00000000 r7:8e617180
> r6:00000000 r5:00000018
> [    1.229986]  r4:8e617180
> [    1.232553] [<80485ddc>] (drm_fb_helper_initial_config) from
> [<80486518>] (drm_fb_cma_fbdev_init_with_funcs+0x1a8/0x1c8)
> [    1.243464]  r5:8e620400 r4:00000018
> [    1.247072] [<80486370>] (drm_fb_cma_fbdev_init_with_funcs) from
> [<8048654c>] (drm_fb_cma_fbdev_init+0x14/0x18)
> [    1.257208]  r8:00000000 r7:80c208d8 r6:8e61c810 r5:80c20878
> r4:8e620400
> [    1.263951] [<80486538>] (drm_fb_cma_fbdev_init) from [<804ae0f4>]
> (fsl_dcu_load+0x90/0x108)
> [    1.272446] [<804ae064>] (fsl_dcu_load) from [<8048da94>]
> (drm_dev_register+0x140/0x1d8)
> [    1.280581]  r7:80c208d8 r6:00000000 r5:00000000 r4:8e620400
> [    1.286277] [<8048d954>] (drm_dev_register) from [<804ae350>]
> (fsl_dcu_drm_probe+0x1e4/0x2e4)
> [    1.294854]  r9:809b0410 r8:00000000 r7:8e620400 r6:8e4b7a00
> r5:8e4b7a10 r4:8e61c810
> [    1.302652] [<804ae16c>] (fsl_dcu_drm_probe) from [<804b90b4>]
> (platform_drv_probe+0x58/0xb8)
> [    1.311222]  r10:00000000 r9:00000000 r8:80c2088c r7:fffffdfb
> r6:80c2088c r5:ffffffed
> [    1.319087]  r4:8e4b7a10
> [    1.321653] [<804b905c>] (platform_drv_probe) from [<804b7578>]
> (driver_probe_device+0x278/0x2f0)
> [    1.330570]  r7:00000000 r6:80c5b414 r5:80c5b410 r4:8e4b7a10
> [    1.336262] [<804b7300>] (driver_probe_device) from [<804b76b0>]
> (__driver_attach+0xc0/0xc4)
> [    1.344745]  r10:00000007 r9:80b0061c r8:000000c2 r7:00000000
> r6:8e4b7a44 r5:80c2088c
> [    1.352613]  r4:8e4b7a10 r3:00000000
> [    1.356228] [<804b75f0>] (__driver_attach) from [<804b5878>]
> (bus_for_each_dev+0x70/0xa4)
> [    1.364449]  r7:00000000 r6:804b75f0 r5:80c2088c r4:00000000
> [    1.370145] [<804b5808>] (bus_for_each_dev) from [<804b6eb8>]
> (driver_attach+0x24/0x28)
> [    1.378193]  r6:80c20ee8 r5:8e612880 r4:80c2088c
> [    1.382845] [<804b6e94>] (driver_attach) from [<804b6930>]
> (bus_add_driver+0x108/0x214)
> [    1.390895] [<804b6828>] (bus_add_driver) from [<804b802c>]
> (driver_register+0x80/0xfc)
> [    1.398945]  r7:80b2d830 r6:00000000 r5:80b1b304 r4:80c2088c
> [    1.404640] [<804b7fac>] (driver_register) from [<804b9010>]
> (__platform_driver_register+0x48/0x50)
> [    1.413721]  r5:80b1b304 r4:80c20ee8
> [    1.417346] [<804b8fc8>] (__platform_driver_register) from
> [<80b1b320>] (fsl_dcu_drm_platform_driver_init+0x1c/0x20)
> [    1.427914]  r5:80b1b304 r4:ffffe000
> [    1.431530] [<80b1b304>] (fsl_dcu_drm_platform_driver_init) from
> [<8010190c>] (do_one_initcall+0x4c/0x170)
> [    1.441241] [<801018c0>] (do_one_initcall) from [<80b00e88>]
> (kernel_init_freeable+0x138/0x1c8)
> [    1.449986]  r9:80b0061c r8:000000c2 r6:80b38adc r5:80c37800
> r4:80c37800
> [    1.456737] [<80b00d50>] (kernel_init_freeable) from [<80792c58>]
> (kernel_init+0x10/0x10c)
> [    1.465052]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
> r6:00000000 r5:80792c48
> [    1.472919]  r4:00000000
> [    1.475491] [<80792c48>] (kernel_init) from [<80107cb0>]
> (ret_from_fork+0x14/0x24)
> [    1.483093]  r5:80792c48 r4:00000000
> [    1.486697] Code: e58460d8 e0823003 e58430d4 e59730ac (e5935008)
> [    1.492895] ---[ end trace 95d88c85f82f6379 ]---
> [    1.497604] Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x0000000b
>
> I did not yet look further into this, maybe you have an idea?
>
> --
> Stefan
>
>
>> Cc: Stefan Agner <stefan@agner.ch>
>> Cc: Alison Wang <alison.wang@freescale.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> ---
>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++--------------------
>>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>>   2 files changed, 6 insertions(+), 21 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 1a9ee657bbac..45a44bb7a2e4 100644
>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
>> @@ -11,7 +11,6 @@
>>   
>>   #include <linux/clk.h>
>>   #include <linux/clk-provider.h>
>> -#include <linux/console.h>
>>   #include <linux/io.h>
>>   #include <linux/mfd/syscon.h>
>>   #include <linux/mm.h>
>> @@ -25,6 +24,7 @@
>>   #include <drm/drmP.h>
>>   #include <drm/drm_atomic_helper.h>
>>   #include <drm/drm_crtc_helper.h>
>> +#include <drm/drm_fb_helper.h>
>>   #include <drm/drm_fb_cma_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_modeset_helper.h>
>> @@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev,
>> unsigned long flags)
>>   			"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
>>   		legacyfb_depth = 24;
>>   	}
>> -	fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
>> -	if (IS_ERR(fsl_dev->fbdev)) {
>> -		ret = PTR_ERR(fsl_dev->fbdev);
>> -		fsl_dev->fbdev = NULL;
>> +	ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1);
>> +	if (ret)
>>   		goto done;
>> -	}
>>   
>>   	return 0;
>>   done:
>>   	drm_kms_helper_poll_fini(dev);
>>   
>> -	if (fsl_dev->fbdev)
>> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
>> +	drm_fb_cma_fbdev_fini(dev);
>>   
>>   	drm_mode_config_cleanup(dev);
>>   	drm_irq_uninstall(dev);
>> @@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev,
>> unsigned long flags)
>>   
>>   static void fsl_dcu_unload(struct drm_device *dev)
>>   {
>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>> -
>>   	drm_atomic_helper_shutdown(dev);
>>   	drm_kms_helper_poll_fini(dev);
>>   
>> -	if (fsl_dev->fbdev)
>> -		drm_fbdev_cma_fini(fsl_dev->fbdev);
>> +	drm_fb_cma_fbdev_fini(dev);
>>   
>>   	drm_mode_config_cleanup(dev);
>>   	drm_irq_uninstall(dev);
>> @@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
>>   	return IRQ_HANDLED;
>>   }
>>   
>> -static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>> -{
>> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
>> -
>> -	drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
>> -}
>> -
>>   DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>>   
>>   static struct drm_driver fsl_dcu_drm_driver = {
>>   	.driver_features	= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
>>   				| DRIVER_PRIME | DRIVER_ATOMIC,
>> -	.lastclose		= fsl_dcu_drm_lastclose,
>> +	.lastclose		= drm_fb_helper_lastclose,
>>   	.load			= fsl_dcu_load,
>>   	.unload			= fsl_dcu_unload,
>>   	.irq_handler		= fsl_dcu_drm_irq,
>> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>> index 93bfb98012d4..cb87bb74cb87 100644
>> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
>> @@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
>>   	/*protects hardware register*/
>>   	spinlock_t irq_lock;
>>   	struct drm_device *drm;
>> -	struct drm_fbdev_cma *fbdev;
>>   	struct drm_crtc crtc;
>>   	struct drm_encoder encoder;
>>   	struct fsl_dcu_drm_connector connector;

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

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

* Re: [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions
  2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
                   ` (21 preceding siblings ...)
  2017-11-04 13:04 ` [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
@ 2017-11-10 18:12 ` Noralf Trønnes
  22 siblings, 0 replies; 49+ messages in thread
From: Noralf Trønnes @ 2017-11-10 18:12 UTC (permalink / raw)
  To: dri-devel
  Cc: narmstrong, liviu.dudau, laurent.pinchart, marex,
	boris.brezillon, abrodkin, z.liuxinliang, kong.kongxinwei,
	tomi.valkeinen, david, puck.chen, jsarha, vincent.abriou,
	alison.wang, philippe.cornu, yannick.fertre, zourongrong,
	maxime.ripard, shawnguo



Den 04.11.2017 14.03, skrev Noralf Trønnes:
> This patchset adds drm_fb_cma_fbdev_init/fini() functions that replaces
> drm_fbdev_cma_init/fini(). The reason for doing so is to get rid of
> struct drm_fbdev_cma and it's wrapper functions. The final piece will
> happen when tinydrm moves away from the cma helper and we can remove the
> struct.

This patchset is broken on anything but tinydrm, will resend a new version.

This is the fix:
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0c73957d7aad..6abb0ab4e7ca 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -294,7 +294,7 @@ drm_fbdev_cma_create(struct drm_fb_helper *helper,
         fbi->screen_size = size;
         fbi->fix.smem_len = size;

-       if (fbdev_cma->fb_funcs->dirty) {
+       if (fb->funcs->dirty) {
                 ret = drm_fbdev_cma_defio_init(fbi, obj);
                 if (ret)
                         goto err_cma_destroy;


Sorry about this. I was certain I had tested it on vc4, but clearly I 
hadn't :/

Noralf.

> Note:
> Patches 19-22 depends on patchset:
> drm/: Add simple modeset suspend/resume helpers
>
> Noralf.
>
> Noralf Trønnes (22):
>    drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional
>    drm/cma-helper: Add drm_fb_cma_fbdev_init/fini()
>    drm/arc: Use drm_fb_cma_fbdev_init/fini()
>    drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
>    drm/atmel-hlcdc: Use drm_fb_cma_fbdev_init/fini()
>    drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini()
>    drm/imx: Use drm_fb_cma_fbdev_init/fini()
>    drm/meson: Use drm_fb_cma_fbdev_init/fini()
>    drm/mxsfb: Use drm_fb_cma_fbdev_init/fini()
>    drm/pl111: Use drm_fb_cma_fbdev_init/fini()
>    drm/rcar-du: Use drm_fb_cma_fbdev_init/fini()
>    drm/sti: Use drm_fb_cma_fbdev_init/fini()
>    drm/stm: Use drm_fb_cma_fbdev_init/fini()
>    drm/sun4i: Use drm_fb_cma_fbdev_init/fini()
>    drm/tilcdc: Use drm_fb_cma_fbdev_init/fini()
>    drm/tve200: Use drm_fb_cma_fbdev_init/fini()
>    drm/vc4: Use drm_fb_cma_fbdev_init/fini()
>    drm/zte: Use drm_fb_cma_fbdev_init/fini()
>    drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
>    drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
>    drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
>    drm/cma-helper: Remove drm_fbdev_cma* functions
>
>   Documentation/gpu/todo.rst                      |   5 -
>   drivers/gpu/drm/arc/arcpgu.h                    |   4 -
>   drivers/gpu/drm/arc/arcpgu_drv.c                |  36 +----
>   drivers/gpu/drm/arm/hdlcd_drv.c                 |  37 +----
>   drivers/gpu/drm/arm/hdlcd_drv.h                 |   1 -
>   drivers/gpu/drm/arm/malidp_drv.c                |  39 +----
>   drivers/gpu/drm/arm/malidp_drv.h                |   1 -
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    |  26 +---
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h    |   2 +-
>   drivers/gpu/drm/drm_fb_cma_helper.c             | 188 +++++++++---------------
>   drivers/gpu/drm/drm_gem_framebuffer_helper.c    |   6 +-
>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       |  26 +---
>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h       |   1 -
>   drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  35 +----
>   drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |   4 -
>   drivers/gpu/drm/imx/imx-drm-core.c              |  33 +----
>   drivers/gpu/drm/imx/imx-drm.h                   |   1 -
>   drivers/gpu/drm/meson/meson_drv.c               |  20 +--
>   drivers/gpu/drm/meson/meson_drv.h               |   1 -
>   drivers/gpu/drm/mxsfb/mxsfb_drv.c               |  21 +--
>   drivers/gpu/drm/mxsfb/mxsfb_drv.h               |   1 -
>   drivers/gpu/drm/pl111/pl111_drm.h               |   1 -
>   drivers/gpu/drm/pl111/pl111_drv.c               |  16 +-
>   drivers/gpu/drm/rcar-du/rcar_du_drv.c           |  13 +-
>   drivers/gpu/drm/rcar-du/rcar_du_drv.h           |   2 -
>   drivers/gpu/drm/rcar-du/rcar_du_kms.c           |  20 +--
>   drivers/gpu/drm/sti/sti_drv.c                   |  25 +---
>   drivers/gpu/drm/sti/sti_drv.h                   |   1 -
>   drivers/gpu/drm/stm/drv.c                       |  37 +----
>   drivers/gpu/drm/stm/ltdc.h                      |   1 -
>   drivers/gpu/drm/sun4i/sun4i_drv.c               |  14 +-
>   drivers/gpu/drm/sun4i/sun4i_drv.h               |   2 -
>   drivers/gpu/drm/sun4i/sun4i_framebuffer.c       |  18 +--
>   drivers/gpu/drm/sun4i/sun4i_framebuffer.h       |   2 +-
>   drivers/gpu/drm/tilcdc/tilcdc_drv.c             |  26 +---
>   drivers/gpu/drm/tilcdc/tilcdc_drv.h             |   2 -
>   drivers/gpu/drm/tinydrm/core/tinydrm-core.c     |  37 +----
>   drivers/gpu/drm/tinydrm/mi0283qt.c              |   3 +-
>   drivers/gpu/drm/tinydrm/st7586.c                |   3 +-
>   drivers/gpu/drm/tve200/tve200_drm.h             |   1 -
>   drivers/gpu/drm/tve200/tve200_drv.c             |  16 +-
>   drivers/gpu/drm/vc4/vc4_drv.c                   |  13 +-
>   drivers/gpu/drm/vc4/vc4_drv.h                   |   2 -
>   drivers/gpu/drm/vc4/vc4_kms.c                   |  18 +--
>   drivers/gpu/drm/zte/zx_drm_drv.c                |  48 +-----
>   include/drm/drm_fb_cma_helper.h                 |  29 +---
>   include/drm/tinydrm/tinydrm.h                   |   3 -
>   47 files changed, 196 insertions(+), 645 deletions(-)
>

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

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

end of thread, other threads:[~2017-11-10 18:12 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-04 13:03 [PATCH 00/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
2017-11-04 13:03 ` [PATCH 01/22] drm/gem-fb-helper: drm_gem_fbdev_fb_create() make funcs optional Noralf Trønnes
2017-11-06  8:54   ` Daniel Vetter
2017-11-06 12:40     ` Noralf Trønnes
2017-11-04 13:03 ` [PATCH 02/22] drm/cma-helper: Add drm_fb_cma_fbdev_init/fini() Noralf Trønnes
2017-11-06  9:04   ` Daniel Vetter
2017-11-06 12:40     ` Noralf Trønnes
2017-11-04 13:03 ` [PATCH 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini() Noralf Trønnes
2017-11-06  9:08   ` Daniel Vetter
2017-11-06 12:48     ` Noralf Trønnes
2017-11-04 13:03 ` [PATCH 04/22] drm/arm/hdlcd: " Noralf Trønnes
2017-11-05 14:27   ` Liviu Dudau
2017-11-04 13:03 ` [PATCH 05/22] drm/atmel-hlcdc: " Noralf Trønnes
2017-11-06 10:16   ` Boris Brezillon
2017-11-04 13:04 ` [PATCH 06/22] drm/hisilicon/kirin: " Noralf Trønnes
2017-11-04 13:04 ` [PATCH 07/22] drm/imx: " Noralf Trønnes
2017-11-06  9:59   ` Philipp Zabel
2017-11-04 13:04 ` [PATCH 08/22] drm/meson: " Noralf Trønnes
2017-11-04 13:04 ` [PATCH 09/22] drm/mxsfb: " Noralf Trønnes
2017-11-04 13:04 ` [PATCH 10/22] drm/pl111: " Noralf Trønnes
2017-11-06 13:18   ` Linus Walleij
2017-11-04 13:04 ` [PATCH 11/22] drm/rcar-du: " Noralf Trønnes
2017-11-04 13:04 ` [PATCH 12/22] drm/sti: " Noralf Trønnes
2017-11-08 12:21   ` Benjamin Gaignard
2017-11-08 15:21     ` Noralf Trønnes
2017-11-09  8:20       ` Daniel Vetter
2017-11-09  9:20         ` Benjamin Gaignard
2017-11-04 13:04 ` [PATCH 13/22] drm/stm: " Noralf Trønnes
2017-11-06 17:32   ` Philippe CORNU
2017-11-08 15:23     ` Noralf Trønnes
2017-11-04 13:04 ` [PATCH 14/22] drm/sun4i: " Noralf Trønnes
2017-11-06  7:51   ` Maxime Ripard
2017-11-04 13:04 ` [PATCH 15/22] drm/tilcdc: " Noralf Trønnes
2017-11-07  8:33   ` Jyri Sarha
2017-11-04 13:04 ` [PATCH 16/22] drm/tve200: " Noralf Trønnes
2017-11-06 13:19   ` Linus Walleij
2017-11-04 13:04 ` [PATCH 17/22] drm/vc4: " Noralf Trønnes
2017-11-06 16:19   ` Eric Anholt
2017-11-04 13:04 ` [PATCH 18/22] drm/zte: " Noralf Trønnes
2017-11-04 13:04 ` [PATCH 19/22] drm/arm/mali: " Noralf Trønnes
2017-11-05 14:31   ` Liviu Dudau
2017-11-04 13:04 ` [PATCH 20/22] drm/fsl-dcu: " Noralf Trønnes
2017-11-10 17:01   ` Stefan Agner
2017-11-10 17:59     ` Noralf Trønnes
2017-11-04 13:04 ` [PATCH 21/22] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() Noralf Trønnes
2017-11-06 18:05   ` David Lechner
2017-11-04 13:04 ` [PATCH 22/22] drm/cma-helper: Remove drm_fbdev_cma* functions Noralf Trønnes
2017-11-06  9:09   ` Daniel Vetter
2017-11-10 18:12 ` [PATCH 00/22] " Noralf Trønnes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.