dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/armada: Convert fbdev to DRM client
@ 2023-03-30  7:30 Thomas Zimmermann
  2023-03-30  7:30 ` [PATCH 1/4] drm/armada: Include <linux/of.h> Thomas Zimmermann
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2023-03-30  7:30 UTC (permalink / raw)
  To: linux, javierm, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Convert armada's fbdev code to struct drm_client. Replaces the current
ad-hoc integration. The conversion includes a number of cleanups. As
with most other driver's fbdev emulation, fbdev in armada is now just
another DRM client that runs after the DRM device has been registered.

Once all drivers' fbdev emulation has been converted to struct drm_client,
we can attempt to add additional in-kernel clients. A DRM-based dmesg
log or a bootsplash are commonly mentioned. DRM can then switch easily
among the existing clients if/when required.

I did the conversion from similar experience with other drivers. But I
don't have the hardware to test this. Any testing is welcome.

Thomas Zimmermann (4):
  drm/armada: Include <linux/of.h>
  drm/armada: Hide fbdev support behind config option
  drm/armada: Initialize fbdev DRM client
  drm/armada: Implement fbdev emulation as in-kernel client

 drivers/gpu/drm/armada/Makefile       |   3 +-
 drivers/gpu/drm/armada/armada_drm.h   |  10 ++-
 drivers/gpu/drm/armada/armada_drv.c   |  12 +--
 drivers/gpu/drm/armada/armada_fb.c    |   1 -
 drivers/gpu/drm/armada/armada_fbdev.c | 119 +++++++++++++++++++-------
 5 files changed, 98 insertions(+), 47 deletions(-)

-- 
2.40.0


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

* [PATCH 1/4] drm/armada: Include <linux/of.h>
  2023-03-30  7:30 [PATCH 0/4] drm/armada: Convert fbdev to DRM client Thomas Zimmermann
@ 2023-03-30  7:30 ` Thomas Zimmermann
  2023-03-30 11:44   ` [1/4] " Sui Jingfeng
  2023-03-30  7:30 ` [PATCH 2/4] drm/armada: Hide fbdev support behind config option Thomas Zimmermann
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-03-30  7:30 UTC (permalink / raw)
  To: linux, javierm, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Include <linux/of.h> to get declarations of of_node_put() and
of_device_is_available(). No functional changes.

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

diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 0643887800b4..fd9842740a08 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -6,6 +6,7 @@
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
 
-- 
2.40.0


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

* [PATCH 2/4] drm/armada: Hide fbdev support behind config option
  2023-03-30  7:30 [PATCH 0/4] drm/armada: Convert fbdev to DRM client Thomas Zimmermann
  2023-03-30  7:30 ` [PATCH 1/4] drm/armada: Include <linux/of.h> Thomas Zimmermann
@ 2023-03-30  7:30 ` Thomas Zimmermann
  2023-03-30 12:21   ` [2/4] " Sui Jingfeng
  2023-03-30  7:30 ` [PATCH 3/4] drm/armada: Initialize fbdev DRM client Thomas Zimmermann
  2023-03-30  7:30 ` [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client Thomas Zimmermann
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-03-30  7:30 UTC (permalink / raw)
  To: linux, javierm, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Only build armada's fbdev emulation if CONFIG_DRM_FBDEV_EMULATION
has been enabled. No functional changes, but allows to build armada
without fbdev.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/armada/Makefile     |  3 ++-
 drivers/gpu/drm/armada/armada_drm.h | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/armada/Makefile b/drivers/gpu/drm/armada/Makefile
index 9bc3c3213724..dc75a7db9ed3 100644
--- a/drivers/gpu/drm/armada/Makefile
+++ b/drivers/gpu/drm/armada/Makefile
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-armada-y	:= armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \
+armada-y	:= armada_crtc.o armada_drv.o armada_fb.o \
 		   armada_gem.o armada_overlay.o armada_plane.o armada_trace.o
 armada-y	+= armada_510.o
 armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
+armada-$(CONFIG_DRM_FBDEV_EMULATION) += armada_fbdev.o
 
 obj-$(CONFIG_DRM_ARMADA) := armada.o
diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h
index 6a5a87932576..1475146b1c47 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -75,8 +75,18 @@ struct armada_private {
 
 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
 
-int armada_fbdev_init(struct drm_device *);
-void armada_fbdev_fini(struct drm_device *);
+#if defined(CONFIG_DRM_FBDEV_EMULATION)
+int armada_fbdev_init(struct drm_device *dev);
+void armada_fbdev_fini(struct drm_device *dev);
+#else
+static inline int armada_fbdev_init(struct drm_device *dev)
+{
+	return 0;
+}
+
+static inline void armada_fbdev_fini(struct drm_device *dev)
+{ }
+#endif
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
 
-- 
2.40.0


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

* [PATCH 3/4] drm/armada: Initialize fbdev DRM client
  2023-03-30  7:30 [PATCH 0/4] drm/armada: Convert fbdev to DRM client Thomas Zimmermann
  2023-03-30  7:30 ` [PATCH 1/4] drm/armada: Include <linux/of.h> Thomas Zimmermann
  2023-03-30  7:30 ` [PATCH 2/4] drm/armada: Hide fbdev support behind config option Thomas Zimmermann
@ 2023-03-30  7:30 ` Thomas Zimmermann
  2023-04-17 14:04   ` Javier Martinez Canillas
  2023-03-30  7:30 ` [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client Thomas Zimmermann
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-03-30  7:30 UTC (permalink / raw)
  To: linux, javierm, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Initialize the fbdev client in the fbdev code with empty helper
functions. Also clean up the client. The helpers will later
implement various functionality of the DRM client. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/armada/armada_fbdev.c | 43 ++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 0e44f53e9fa4..303c55704225 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -117,6 +117,32 @@ static const struct drm_fb_helper_funcs armada_fb_helper_funcs = {
 	.fb_probe	= armada_fb_probe,
 };
 
+/*
+ * Fbdev client and struct drm_client_funcs
+ */
+
+static void armada_fbdev_client_unregister(struct drm_client_dev *client)
+{ }
+
+static int armada_fbdev_client_restore(struct drm_client_dev *client)
+{
+	drm_fb_helper_lastclose(client->dev);
+
+	return 0;
+}
+
+static int armada_fbdev_client_hotplug(struct drm_client_dev *client)
+{
+	return 0;
+}
+
+static const struct drm_client_funcs armada_fbdev_client_funcs = {
+	.owner		= THIS_MODULE,
+	.unregister	= armada_fbdev_client_unregister,
+	.restore	= armada_fbdev_client_restore,
+	.hotplug	= armada_fbdev_client_hotplug,
+};
+
 int armada_fbdev_init(struct drm_device *dev)
 {
 	struct armada_private *priv = drm_to_armada_dev(dev);
@@ -131,22 +157,30 @@ int armada_fbdev_init(struct drm_device *dev)
 
 	drm_fb_helper_prepare(dev, fbh, 32, &armada_fb_helper_funcs);
 
+	ret = drm_client_init(dev, &fbh->client, "armada-fbdev",
+			      &armada_fbdev_client_funcs);
+	if (ret)
+		goto err_drm_fb_helper_unprepare;
+
 	ret = drm_fb_helper_init(dev, fbh);
 	if (ret) {
 		DRM_ERROR("failed to initialize drm fb helper\n");
-		goto err_fb_helper;
+		goto err_drm_client_release;
 	}
 
 	ret = drm_fb_helper_initial_config(fbh);
 	if (ret) {
 		DRM_ERROR("failed to set initial config\n");
-		goto err_fb_setup;
+		goto err_drm_fb_helper_fini;
 	}
 
 	return 0;
- err_fb_setup:
+
+err_drm_fb_helper_fini:
 	drm_fb_helper_fini(fbh);
- err_fb_helper:
+err_drm_client_release:
+	drm_client_release(&fbh->client);
+err_drm_fb_helper_unprepare:
 	drm_fb_helper_unprepare(fbh);
 	priv->fbdev = NULL;
 	return ret;
@@ -161,6 +195,7 @@ void armada_fbdev_fini(struct drm_device *dev)
 		drm_fb_helper_unregister_info(fbh);
 
 		drm_fb_helper_fini(fbh);
+		drm_client_release(&fbh->client);
 
 		if (fbh->fb)
 			fbh->fb->funcs->destroy(fbh->fb);
-- 
2.40.0


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

* [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client
  2023-03-30  7:30 [PATCH 0/4] drm/armada: Convert fbdev to DRM client Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2023-03-30  7:30 ` [PATCH 3/4] drm/armada: Initialize fbdev DRM client Thomas Zimmermann
@ 2023-03-30  7:30 ` Thomas Zimmermann
  2023-04-17 14:11   ` Javier Martinez Canillas
  3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-03-30  7:30 UTC (permalink / raw)
  To: linux, javierm, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Move code from ad-hoc fbdev callbacks into DRM client functions
and remove the old callbacks. The functions instruct the client
to poll for changed output or restore the display. The DRM core
calls both, the old callbacks and the new client helpers, from
the same places. The new functions perform the same operation as
before, so there's no change in functionality.

Replace all code that initializes or releases fbdev emulation
throughout the driver. Instead initialize the fbdev client by a
single call to armada_fbdev_setup() after armada has registered its
DRM device. As in most drivers, aramda's fbdev emulation now acts
like a regular DRM client.

The fbdev client setup consists of the initial preparation and the
hot-plugging of the display. The latter creates the fbdev device
and sets up the fbdev framebuffer. The setup performs display
hot-plugging once. If no display can be detected, DRM probe helpers
re-run the detection on each hotplug event.

A call to drm_dev_unregister() releases the client automatically.
No further action is required within armada. If the fbdev framebuffer
has been fully set up, struct fb_ops.fb_destroy implements the
release. For partially initialized emulation, the fbdev client
reverts the initial setup.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/armada/armada_drm.h   |  12 +--
 drivers/gpu/drm/armada/armada_drv.c   |  11 +--
 drivers/gpu/drm/armada/armada_fb.c    |   1 -
 drivers/gpu/drm/armada/armada_fbdev.c | 118 +++++++++++++++-----------
 4 files changed, 73 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h
index 1475146b1c47..c303e8c7ff6c 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -16,7 +16,6 @@ struct armada_crtc;
 struct armada_gem_object;
 struct clk;
 struct drm_display_mode;
-struct drm_fb_helper;
 
 static inline void
 armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
@@ -55,7 +54,6 @@ extern const struct armada_variant armada510_ops;
 
 struct armada_private {
 	struct drm_device	drm;
-	struct drm_fb_helper	*fbdev;
 	struct armada_crtc	*dcrtc[2];
 	struct drm_mm		linear; /* protected by linear_lock */
 	struct mutex		linear_lock;
@@ -76,15 +74,9 @@ struct armada_private {
 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
 
 #if defined(CONFIG_DRM_FBDEV_EMULATION)
-int armada_fbdev_init(struct drm_device *dev);
-void armada_fbdev_fini(struct drm_device *dev);
+void armada_fbdev_setup(struct drm_device *dev);
 #else
-static inline int armada_fbdev_init(struct drm_device *dev)
-{
-	return 0;
-}
-
-static inline void armada_fbdev_fini(struct drm_device *dev)
+static inline void armada_fbdev_setup(struct drm_device *dev)
 { }
 #endif
 
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index fd9842740a08..4d7ca9d461e4 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -17,7 +17,6 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_prime.h>
 #include <drm/drm_probe_helper.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_vblank.h>
 
@@ -38,7 +37,6 @@ static const struct drm_ioctl_desc armada_ioctls[] = {
 DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 
 static const struct drm_driver armada_drm_driver = {
-	.lastclose		= drm_fb_helper_lastclose,
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
 	.gem_prime_import	= armada_gem_prime_import,
@@ -56,7 +54,6 @@ static const struct drm_driver armada_drm_driver = {
 
 static const struct drm_mode_config_funcs armada_drm_mode_config_funcs = {
 	.fb_create		= armada_fb_create,
-	.output_poll_changed	= drm_fb_helper_output_poll_changed,
 	.atomic_check		= drm_atomic_helper_check,
 	.atomic_commit		= drm_atomic_helper_commit,
 };
@@ -133,10 +130,6 @@ static int armada_drm_bind(struct device *dev)
 
 	drm_mode_config_reset(&priv->drm);
 
-	ret = armada_fbdev_init(&priv->drm);
-	if (ret)
-		goto err_comp;
-
 	drm_kms_helper_poll_init(&priv->drm);
 
 	ret = drm_dev_register(&priv->drm, 0);
@@ -147,11 +140,12 @@ static int armada_drm_bind(struct device *dev)
 	armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
+	armada_fbdev_setup(&priv->drm);
+
 	return 0;
 
  err_poll:
 	drm_kms_helper_poll_fini(&priv->drm);
-	armada_fbdev_fini(&priv->drm);
  err_comp:
 	component_unbind_all(dev, &priv->drm);
  err_kms:
@@ -166,7 +160,6 @@ static void armada_drm_unbind(struct device *dev)
 	struct armada_private *priv = drm_to_armada_dev(drm);
 
 	drm_kms_helper_poll_fini(&priv->drm);
-	armada_fbdev_fini(&priv->drm);
 
 	drm_dev_unregister(&priv->drm);
 
diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c
index b87c71703c85..cf2e88218dc0 100644
--- a/drivers/gpu/drm/armada/armada_fb.c
+++ b/drivers/gpu/drm/armada/armada_fb.c
@@ -4,7 +4,6 @@
  */
 
 #include <drm/drm_modeset_helper.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 303c55704225..0a5fd1aa86eb 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -8,6 +8,8 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fourcc.h>
 
@@ -16,6 +18,19 @@
 #include "armada_fb.h"
 #include "armada_gem.h"
 
+static void armada_fbdev_fb_destroy(struct fb_info *info)
+{
+	struct drm_fb_helper *fbh = info->par;
+
+	drm_fb_helper_fini(fbh);
+
+	fbh->fb->funcs->destroy(fbh->fb);
+
+	drm_client_release(&fbh->client);
+	drm_fb_helper_unprepare(fbh);
+	kfree(fbh);
+}
+
 static const struct fb_ops armada_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
@@ -24,6 +39,7 @@ static const struct fb_ops armada_fb_ops = {
 	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
 	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
 	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_destroy	= armada_fbdev_fb_destroy,
 };
 
 static int armada_fbdev_create(struct drm_fb_helper *fbh,
@@ -122,7 +138,17 @@ static const struct drm_fb_helper_funcs armada_fb_helper_funcs = {
  */
 
 static void armada_fbdev_client_unregister(struct drm_client_dev *client)
-{ }
+{
+	struct drm_fb_helper *fbh = drm_fb_helper_from_client(client);
+
+	if (fbh->info) {
+		drm_fb_helper_unregister_info(fbh);
+	} else {
+		drm_client_release(&fbh->client);
+		drm_fb_helper_unprepare(fbh);
+		kfree(fbh);
+	}
+}
 
 static int armada_fbdev_client_restore(struct drm_client_dev *client)
 {
@@ -133,7 +159,31 @@ static int armada_fbdev_client_restore(struct drm_client_dev *client)
 
 static int armada_fbdev_client_hotplug(struct drm_client_dev *client)
 {
+	struct drm_fb_helper *fbh = drm_fb_helper_from_client(client);
+	struct drm_device *dev = client->dev;
+	int ret;
+
+	if (dev->fb_helper)
+		return drm_fb_helper_hotplug_event(dev->fb_helper);
+
+	ret = drm_fb_helper_init(dev, fbh);
+	if (ret)
+		goto err_drm_err;
+
+	if (!drm_drv_uses_atomic_modeset(dev))
+		drm_helper_disable_unused_functions(dev);
+
+	ret = drm_fb_helper_initial_config(fbh);
+	if (ret)
+		goto err_drm_fb_helper_fini;
+
 	return 0;
+
+err_drm_fb_helper_fini:
+	drm_fb_helper_fini(fbh);
+err_drm_err:
+	drm_err(dev, "armada: Failed to setup fbdev emulation (ret=%d)\n", ret);
+	return ret;
 }
 
 static const struct drm_client_funcs armada_fbdev_client_funcs = {
@@ -143,65 +193,35 @@ static const struct drm_client_funcs armada_fbdev_client_funcs = {
 	.hotplug	= armada_fbdev_client_hotplug,
 };
 
-int armada_fbdev_init(struct drm_device *dev)
+void armada_fbdev_setup(struct drm_device *dev)
 {
-	struct armada_private *priv = drm_to_armada_dev(dev);
 	struct drm_fb_helper *fbh;
 	int ret;
 
-	fbh = devm_kzalloc(dev->dev, sizeof(*fbh), GFP_KERNEL);
-	if (!fbh)
-		return -ENOMEM;
-
-	priv->fbdev = fbh;
+	drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
+	drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
 
+	fbh = kzalloc(sizeof(*fbh), GFP_KERNEL);
+	if (!fbh)
+		return;
 	drm_fb_helper_prepare(dev, fbh, 32, &armada_fb_helper_funcs);
 
-	ret = drm_client_init(dev, &fbh->client, "armada-fbdev",
-			      &armada_fbdev_client_funcs);
-	if (ret)
-		goto err_drm_fb_helper_unprepare;
-
-	ret = drm_fb_helper_init(dev, fbh);
+	ret = drm_client_init(dev, &fbh->client, "fbdev", &armada_fbdev_client_funcs);
 	if (ret) {
-		DRM_ERROR("failed to initialize drm fb helper\n");
-		goto err_drm_client_release;
+		drm_err(dev, "Failed to register client: %d\n", ret);
+		goto err_drm_client_init;
 	}
 
-	ret = drm_fb_helper_initial_config(fbh);
-	if (ret) {
-		DRM_ERROR("failed to set initial config\n");
-		goto err_drm_fb_helper_fini;
-	}
-
-	return 0;
-
-err_drm_fb_helper_fini:
-	drm_fb_helper_fini(fbh);
-err_drm_client_release:
-	drm_client_release(&fbh->client);
-err_drm_fb_helper_unprepare:
-	drm_fb_helper_unprepare(fbh);
-	priv->fbdev = NULL;
-	return ret;
-}
-
-void armada_fbdev_fini(struct drm_device *dev)
-{
-	struct armada_private *priv = drm_to_armada_dev(dev);
-	struct drm_fb_helper *fbh = priv->fbdev;
-
-	if (fbh) {
-		drm_fb_helper_unregister_info(fbh);
+	ret = armada_fbdev_client_hotplug(&fbh->client);
+	if (ret)
+		drm_dbg_kms(dev, "client hotplug ret=%d\n", ret);
 
-		drm_fb_helper_fini(fbh);
-		drm_client_release(&fbh->client);
+	drm_client_register(&fbh->client);
 
-		if (fbh->fb)
-			fbh->fb->funcs->destroy(fbh->fb);
+	return;
 
-		drm_fb_helper_unprepare(fbh);
-
-		priv->fbdev = NULL;
-	}
+err_drm_client_init:
+	drm_fb_helper_unprepare(fbh);
+	kfree(fbh);
+	return;
 }
-- 
2.40.0


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

* Re: [1/4] drm/armada: Include <linux/of.h>
  2023-03-30  7:30 ` [PATCH 1/4] drm/armada: Include <linux/of.h> Thomas Zimmermann
@ 2023-03-30 11:44   ` Sui Jingfeng
  0 siblings, 0 replies; 9+ messages in thread
From: Sui Jingfeng @ 2023-03-30 11:44 UTC (permalink / raw)
  To: Thomas Zimmermann, linux, javierm, airlied, daniel; +Cc: dri-devel

Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

On 2023/3/30 15:30, Thomas Zimmermann wrote:
> Include <linux/of.h> to get declarations of of_node_put() and
> of_device_is_available(). No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/gpu/drm/armada/armada_drv.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 0643887800b4..fd9842740a08 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -6,6 +6,7 @@
>   #include <linux/clk.h>
>   #include <linux/component.h>
>   #include <linux/module.h>
> +#include <linux/of.h>
>   #include <linux/of_graph.h>
>   #include <linux/platform_device.h>
>   

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

* Re: [2/4] drm/armada: Hide fbdev support behind config option
  2023-03-30  7:30 ` [PATCH 2/4] drm/armada: Hide fbdev support behind config option Thomas Zimmermann
@ 2023-03-30 12:21   ` Sui Jingfeng
  0 siblings, 0 replies; 9+ messages in thread
From: Sui Jingfeng @ 2023-03-30 12:21 UTC (permalink / raw)
  To: Thomas Zimmermann, linux, javierm, airlied, daniel; +Cc: dri-devel

Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

On 2023/3/30 15:30, Thomas Zimmermann wrote:
> Only build armada's fbdev emulation if CONFIG_DRM_FBDEV_EMULATION
> has been enabled. No functional changes, but allows to build armada
> without fbdev.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/gpu/drm/armada/Makefile     |  3 ++-
>   drivers/gpu/drm/armada/armada_drm.h | 14 ++++++++++++--
>   2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/Makefile b/drivers/gpu/drm/armada/Makefile
> index 9bc3c3213724..dc75a7db9ed3 100644
> --- a/drivers/gpu/drm/armada/Makefile
> +++ b/drivers/gpu/drm/armada/Makefile
> @@ -1,7 +1,8 @@
>   # SPDX-License-Identifier: GPL-2.0
> -armada-y	:= armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \
> +armada-y	:= armada_crtc.o armada_drv.o armada_fb.o \
>   		   armada_gem.o armada_overlay.o armada_plane.o armada_trace.o
>   armada-y	+= armada_510.o
>   armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
> +armada-$(CONFIG_DRM_FBDEV_EMULATION) += armada_fbdev.o
>   
>   obj-$(CONFIG_DRM_ARMADA) := armada.o
> diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h
> index 6a5a87932576..1475146b1c47 100644
> --- a/drivers/gpu/drm/armada/armada_drm.h
> +++ b/drivers/gpu/drm/armada/armada_drm.h
> @@ -75,8 +75,18 @@ struct armada_private {
>   
>   #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
>   
> -int armada_fbdev_init(struct drm_device *);
> -void armada_fbdev_fini(struct drm_device *);
> +#if defined(CONFIG_DRM_FBDEV_EMULATION)
> +int armada_fbdev_init(struct drm_device *dev);
> +void armada_fbdev_fini(struct drm_device *dev);
> +#else
> +static inline int armada_fbdev_init(struct drm_device *dev)
> +{
> +	return 0;
> +}
> +
> +static inline void armada_fbdev_fini(struct drm_device *dev)
> +{ }
> +#endif
>   
>   int armada_overlay_plane_create(struct drm_device *, unsigned long);
>   

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

* Re: [PATCH 3/4] drm/armada: Initialize fbdev DRM client
  2023-03-30  7:30 ` [PATCH 3/4] drm/armada: Initialize fbdev DRM client Thomas Zimmermann
@ 2023-04-17 14:04   ` Javier Martinez Canillas
  0 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2023-04-17 14:04 UTC (permalink / raw)
  To: Thomas Zimmermann, linux, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel


Hello Thomas,

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Initialize the fbdev client in the fbdev code with empty helper
> functions. Also clean up the client. The helpers will later
> implement various functionality of the DRM client. No functional
> changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client
  2023-03-30  7:30 ` [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client Thomas Zimmermann
@ 2023-04-17 14:11   ` Javier Martinez Canillas
  0 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2023-04-17 14:11 UTC (permalink / raw)
  To: Thomas Zimmermann, linux, airlied, daniel; +Cc: Thomas Zimmermann, dri-devel

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Move code from ad-hoc fbdev callbacks into DRM client functions
> and remove the old callbacks. The functions instruct the client
> to poll for changed output or restore the display. The DRM core
> calls both, the old callbacks and the new client helpers, from
> the same places. The new functions perform the same operation as
> before, so there's no change in functionality.
>
> Replace all code that initializes or releases fbdev emulation
> throughout the driver. Instead initialize the fbdev client by a
> single call to armada_fbdev_setup() after armada has registered its
> DRM device. As in most drivers, aramda's fbdev emulation now acts
> like a regular DRM client.
>
> The fbdev client setup consists of the initial preparation and the
> hot-plugging of the display. The latter creates the fbdev device
> and sets up the fbdev framebuffer. The setup performs display
> hot-plugging once. If no display can be detected, DRM probe helpers
> re-run the detection on each hotplug event.
>
> A call to drm_dev_unregister() releases the client automatically.
> No further action is required within armada. If the fbdev framebuffer
> has been fully set up, struct fb_ops.fb_destroy implements the
> release. For partially initialized emulation, the fbdev client
> reverts the initial setup.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

end of thread, other threads:[~2023-04-17 14:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  7:30 [PATCH 0/4] drm/armada: Convert fbdev to DRM client Thomas Zimmermann
2023-03-30  7:30 ` [PATCH 1/4] drm/armada: Include <linux/of.h> Thomas Zimmermann
2023-03-30 11:44   ` [1/4] " Sui Jingfeng
2023-03-30  7:30 ` [PATCH 2/4] drm/armada: Hide fbdev support behind config option Thomas Zimmermann
2023-03-30 12:21   ` [2/4] " Sui Jingfeng
2023-03-30  7:30 ` [PATCH 3/4] drm/armada: Initialize fbdev DRM client Thomas Zimmermann
2023-04-17 14:04   ` Javier Martinez Canillas
2023-03-30  7:30 ` [PATCH 4/4] drm/armada: Implement fbdev emulation as in-kernel client Thomas Zimmermann
2023-04-17 14:11   ` Javier Martinez Canillas

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