Skip to contentSkip to conversation

drm/tegra: Convert fbdev to DRM client

PATCH Applied Thomas Zimmermann 3 participants 15 messages Mar 30, 2023 – Apr 5, 2023

Subsystems (3)

v1 of 8 Applied Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover drm/tegra: Convert fbdev to DRM client

Convert tegra's fbdev code to struct drm_client. Replaces the current ad-hoc integration. The conversion includes a number of cleanups. As with most other drivers' fbdev emulation, fbdev in tegra 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 (7):
drm/tegra: Include <linux/of.h>
drm/tegra: Include <linux/i2c.h>
drm/tegra: Removed fb from struct tegra_fbdev drm/tegra: Remove struct tegra_fbdev
drm/tegra: Hide fbdev support behind config option drm/tegra: Initialize fbdev DRM client drm/tegra: Implement fbdev emulation as in-kernel client

 drivers/gpu/drm/tegra/Makefile |   2 +
 drivers/gpu/drm/tegra/drm.c    |  23 +---
 drivers/gpu/drm/tegra/drm.h    |  27 ++--
 drivers/gpu/drm/tegra/fb.c     | 242 +--------------------------------
 drivers/gpu/drm/tegra/fbdev.c  | 240 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/tegra/output.c |   3 +
 drivers/gpu/drm/tegra/rgb.c    |   1 +
 7 files changed, 265 insertions(+), 273 deletions(-)
 create mode 100644 drivers/gpu/drm/tegra/fbdev.c
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/7 drm/tegra: Include <linux/of.h>

Include <linux/of.h> to get the contained declarations. No functional changes.

---
 drivers/gpu/drm/tegra/output.c | 2 ++
 drivers/gpu/drm/tegra/rgb.c    | 1 +
 2 files changed, 3 insertions(+)
drivers/gpu/drm/tegra/output.c +2 -0
index a8925dcd7edd..d31c87f48da0 100644
@@ -4,6 +4,8 @@
  * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <linux/of.h>
+
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
drivers/gpu/drm/tegra/rgb.c +1 -0
index ff8fce36d2aa..3f060282cd8d 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/of.h>
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge_connector.h>
Signature · 1 line
2.40.0
Reviewed-by on v1 1/7
#2 lore raw

Re: [1/7] drm/tegra: Include <linux/of.h>

Reviewed-by Sui Jingfeng <[email protected] <mailto:[email protected]>>
Quoted 34 lines · Thomas Zimmermann

Include <linux/of.h> to get the contained declarations. No functional changes.

---
  drivers/gpu/drm/tegra/output.c | 2 ++
  drivers/gpu/drm/tegra/rgb.c    | 1 +
  2 files changed, 3 insertions(+)
drivers/gpu/drm/tegra/output.c +2 -0
index a8925dcd7edd..d31c87f48da0 100644
@@ -4,6 +4,8 @@
   * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
   */
 
+#include <linux/of.h>
+
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_of.h>
  #include <drm/drm_panel.h>
drivers/gpu/drm/tegra/rgb.c +1 -0
index ff8fce36d2aa..3f060282cd8d 100644
@@ -5,6 +5,7 @@
   */
 
  #include <linux/clk.h>
+#include <linux/of.h>
 
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_bridge_connector.h>
#3 lore raw

Re: [1/7] drm/tegra: Include <linux/of.h>

Am 30.03.23 um 14:51 schrieb Sui Jingfeng:

Quoted 2 lines
Reviewed-by Sui Jingfeng <[email protected] <mailto:[email protected]>>

Thanks a lot.

Quoted 34 lines · Thomas Zimmermann
Quoted 31 lines

Include <linux/of.h> to get the contained declarations. No functional changes.

---
  drivers/gpu/drm/tegra/output.c | 2 ++
  drivers/gpu/drm/tegra/rgb.c    | 1 +

  2 files changed, 3 insertions(+)
drivers/gpu/drm/tegra/output.c +2 -0
index a8925dcd7edd..d31c87f48da0 100644
@@ -4,6 +4,8 @@
    * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
    */
+#include <linux/of.h>
+
   #include <drm/drm_atomic_helper.h>
   #include <drm/drm_of.h>
   #include <drm/drm_panel.h>
drivers/gpu/drm/tegra/rgb.c +1 -0
index ff8fce36d2aa..3f060282cd8d 100644
@@ -5,6 +5,7 @@
    */
   #include <linux/clk.h>
+#include <linux/of.h>
   #include <drm/drm_atomic_helper.h>
   #include <drm/drm_bridge_connector.h>
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Reviewed-by
#4 lore raw

Re: [1/7] drm/tegra: Include <linux/of.h>

Hi,

Quoted 8 lines · Thomas Zimmermann

Am 30.03.23 um 14:51 schrieb Sui Jingfeng:

Quoted 2 lines
Reviewed-by Sui Jingfeng <[email protected] <mailto:[email protected]>>

Thanks a lot.

I send my mail with Thunderbird mail client, don't know this does this look like this.

Sorry about that. It should be:

Please correct it manually, others patches also look good to me.

Yet, it beyond my ability to review, I still digging  your patch and learning from it. :)

Quoted 35 lines
Quoted 34 lines · Thomas Zimmermann
Quoted 31 lines

Include <linux/of.h> to get the contained declarations. No functional changes.

---
  drivers/gpu/drm/tegra/output.c | 2 ++
  drivers/gpu/drm/tegra/rgb.c    | 1 +

  2 files changed, 3 insertions(+)
drivers/gpu/drm/tegra/output.c +2 -0
index a8925dcd7edd..d31c87f48da0 100644
@@ -4,6 +4,8 @@
    * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
    */
+#include <linux/of.h>
+
   #include <drm/drm_atomic_helper.h>
   #include <drm/drm_of.h>
   #include <drm/drm_panel.h>
drivers/gpu/drm/tegra/rgb.c +1 -0
index ff8fce36d2aa..3f060282cd8d 100644
@@ -5,6 +5,7 @@
    */
   #include <linux/clk.h>
+#include <linux/of.h>
   #include <drm/drm_atomic_helper.h>
   #include <drm/drm_bridge_connector.h>
#5 lore raw

PATCH 2/7 drm/tegra: Include <linux/i2c.h>

In reply to Thomas Zimmermann

Include <linux/i2c.h> to get the contained declarations. No functional changes.

---
 drivers/gpu/drm/tegra/output.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/output.c +1 -0
index d31c87f48da0..dc2dcb5ca1c8 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <linux/i2c.h>
 #include <linux/of.h>
 
 #include <drm/drm_atomic_helper.h>
Signature · 1 line
2.40.0
Reviewed-by on v1 2/7
#6 lore raw

Re: [2/7] drm/tegra: Include <linux/i2c.h>

Reviewed-by Sui Jingfeng <[email protected] <mailto:[email protected]>>
Quoted 20 lines · Thomas Zimmermann

Include <linux/i2c.h> to get the contained declarations. No functional changes.

---
  drivers/gpu/drm/tegra/output.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/output.c +1 -0
index d31c87f48da0..dc2dcb5ca1c8 100644
@@ -4,6 +4,7 @@
   * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
   */
 
+#include <linux/i2c.h>
  #include <linux/of.h>
 
  #include <drm/drm_atomic_helper.h>
#7 lore raw

PATCH 3/7 drm/tegra: Removed fb from struct tegra_fbdev

In reply to Thomas Zimmermann

Fbdev's struct fb_helper stores a pointer to the framebuffer. Remove struct tegra_fbdev.fb, which contains the same value. No functional changes.

---
 drivers/gpu/drm/tegra/drm.h |  1 -
 drivers/gpu/drm/tegra/fb.c  | 23 ++++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/tegra/drm.h +0 -1
index 845e60f144c7..8f8e5cda78da 100644
@@ -32,7 +32,6 @@ struct reset_control;
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 struct tegra_fbdev {
 	struct drm_fb_helper base;
-	struct drm_framebuffer *fb;
 };
 #endif
 
drivers/gpu/drm/tegra/fb.c +12 -11
index bfebe2786d61..1ee4771b77d3 100644
@@ -217,7 +217,6 @@ static const struct fb_ops tegra_fb_ops = {
 static int tegra_fbdev_probe(struct drm_fb_helper *helper,
 			     struct drm_fb_helper_surface_size *sizes)
 {
-	struct tegra_fbdev *fbdev = to_tegra_fbdev(helper);
 	struct tegra_drm *tegra = helper->dev->dev_private;
 	struct drm_device *drm = helper->dev;
 	struct drm_mode_fb_cmd2 cmd = { 0 };
@@ -252,16 +251,15 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
 		return PTR_ERR(info);
 	}
 
-	fbdev->fb = tegra_fb_alloc(drm, &cmd, &bo, 1);
-	if (IS_ERR(fbdev->fb)) {
-		err = PTR_ERR(fbdev->fb);
+	fb = tegra_fb_alloc(drm, &cmd, &bo, 1);
+	if (IS_ERR(fb)) {
+		err = PTR_ERR(fb);
 		dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n",
 			err);
 		drm_gem_object_put(&bo->gem);
-		return PTR_ERR(fbdev->fb);
+		return PTR_ERR(fb);
 	}
 
-	fb = fbdev->fb;
 	helper->fb = fb;
 	helper->info = info;
 
@@ -349,10 +347,13 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,
 
 static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
 {
-	drm_fb_helper_unregister_info(&fbdev->base);
+	struct drm_fb_helper *helper = &fbdev->base;
+	struct drm_framebuffer *fb = helper->fb;
 
-	if (fbdev->fb) {
-		struct tegra_bo *bo = tegra_fb_get_plane(fbdev->fb, 0);
+	drm_fb_helper_unregister_info(helper);
+
+	if (fb) {
+		struct tegra_bo *bo = tegra_fb_get_plane(fb, 0);
 
 		/* Undo the special mapping we made in fbdev probe. */
 		if (bo && bo->pages) {
@@ -360,10 +361,10 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
 			bo->vaddr = NULL;
 		}
 
-		drm_framebuffer_remove(fbdev->fb);
+		drm_framebuffer_remove(fb);
 	}
 
-	drm_fb_helper_fini(&fbdev->base);
+	drm_fb_helper_fini(helper);
 	tegra_fbdev_free(fbdev);
 }
 #endif
Signature · 1 line
2.40.0
#8 lore raw

PATCH 4/7 drm/tegra: Remove struct tegra_fbdev

In reply to Thomas Zimmermann

Remove struct tegra_fbdev, which is an empty wrapper around struct drm_fb_helper. Use the latter directly. No functional changes.

---
 drivers/gpu/drm/tegra/drm.h | 10 -------
 drivers/gpu/drm/tegra/fb.c  | 59 ++++++++++++++-----------------------
 2 files changed, 22 insertions(+), 47 deletions(-)
drivers/gpu/drm/tegra/drm.h +0 -10
index 8f8e5cda78da..593a60b03189 100644
@@ -29,12 +29,6 @@
 
 struct reset_control;
 
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-struct tegra_fbdev {
-	struct drm_fb_helper base;
-};
-#endif
-
 struct tegra_drm {
 	struct drm_device *drm;
 
@@ -52,10 +46,6 @@ struct tegra_drm {
 	struct mutex clients_lock;
 	struct list_head clients;
 
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-	struct tegra_fbdev *fbdev;
-#endif
-
 	unsigned int hmask, vmask;
 	unsigned int pitch_align;
 	unsigned int num_crtcs;
drivers/gpu/drm/tegra/fb.c +22 -37

135 lines not on this page · raw message

Signature · 1 line
2.40.0
#9 lore raw

PATCH 5/7 drm/tegra: Hide fbdev support behind config option

In reply to Thomas Zimmermann

Only build tegra's fbdev emulation if CONFIG_DRM_FBDEV_EMULATION has been enabled. As part of this change, move the code into its own source file. No functional changes.

---
 drivers/gpu/drm/tegra/Makefile |   2 +
 drivers/gpu/drm/tegra/drm.h    |  20 +++
 drivers/gpu/drm/tegra/fb.c     | 228 +--------------------------------
 drivers/gpu/drm/tegra/fbdev.c  | 226 ++++++++++++++++++++++++++++++++
 4 files changed, 252 insertions(+), 224 deletions(-)
 create mode 100644 drivers/gpu/drm/tegra/fbdev.c
drivers/gpu/drm/tegra/Makefile +2 -0
index bb0d2c144b55..6fc4b504e786 100644
@@ -29,4 +29,6 @@ tegra-drm-y := \
 
 tegra-drm-y += trace.o
 
+tegra-drm-$(CONFIG_DRM_FBDEV_EMULATION) += fbdev.o
+
 obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
drivers/gpu/drm/tegra/drm.h +20 -0
index 593a60b03189..576f03b8434e 100644
@@ -185,13 +185,33 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
 bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer);
 int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
 			struct tegra_bo_tiling *tiling);
+struct drm_framebuffer *tegra_fb_alloc(struct drm_device *drm,
+				       const struct drm_mode_fb_cmd2 *mode_cmd,
+				       struct tegra_bo **planes,
+				       unsigned int num_planes);
 struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
 					struct drm_file *file,
 					const struct drm_mode_fb_cmd2 *cmd);
+
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 int tegra_drm_fb_prepare(struct drm_device *drm);
 void tegra_drm_fb_free(struct drm_device *drm);
 int tegra_drm_fb_init(struct drm_device *drm);
 void tegra_drm_fb_exit(struct drm_device *drm);
+#else
+static inline int tegra_drm_fb_prepare(struct drm_device *drm)
+{
+	return 0;
+}
+static inline void tegra_drm_fb_free(struct drm_device *drm)
+{ }
+static inline int tegra_drm_fb_init(struct drm_device *drm)
+{
+	return 0;
+}
+static inline void tegra_drm_fb_exit(struct drm_device *drm)
+{ }
+#endif
 
 extern struct platform_driver tegra_display_hub_driver;
 extern struct platform_driver tegra_dc_driver;
drivers/gpu/drm/tegra/fb.c +4 -224

237 lines not on this page · raw message

drivers/gpu/drm/tegra/fbdev.c new file +226 -0

226 lines not on this page · raw message

Signature · 1 line
2.40.0
#10 lore raw

PATCH 6/7 drm/tegra: Initialize fbdev DRM client

In reply to Thomas Zimmermann

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.

---
 drivers/gpu/drm/tegra/fbdev.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/fbdev.c +32 -1
index 2400d42f82e4..31a95a955efb 100644
@@ -125,6 +125,30 @@ static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = {
 	.fb_probe = tegra_fbdev_probe,
 };
 
+/*
+ * struct drm_client
+ */
+
+static void tegra_fbdev_client_unregister(struct drm_client_dev *client)
+{ }
+
+static int tregra_fbdev_client_restore(struct drm_client_dev *client)
+{
+	return 0;
+}
+
+static int tegra_fbdev_client_hotplug(struct drm_client_dev *client)
+{
+	return 0;
+}
+
+static const struct drm_client_funcs tegra_fbdev_client_funcs = {
+	.owner		= THIS_MODULE,
+	.unregister	= tegra_fbdev_client_unregister,
+	.restore	= tegra_fbdev_client_restore,
+	.hotplug	= tegra_fbdev_client_hotplug,
+};
+
 static struct drm_fb_helper *tegra_fbdev_create(struct drm_device *drm)
 {
 	struct drm_fb_helper *helper;
@@ -151,11 +175,15 @@ static int tegra_fbdev_init(struct drm_fb_helper *helper,
 	struct drm_device *drm = helper->dev;
 	int err;
 
+	err = drm_client_init(dev, &helper->client, "fbdev", &tegra_fbdev_client_funcs);
+	if (err)
+		return err;
+
 	err = drm_fb_helper_init(drm, helper);
 	if (err < 0) {
 		dev_err(drm->dev, "failed to initialize DRM FB helper: %d\n",
 			err);
-		return err;
+		goto err_drm_client_release;
 	}
 
 	err = drm_fb_helper_initial_config(helper);
@@ -169,6 +197,8 @@ static int tegra_fbdev_init(struct drm_fb_helper *helper,
 
 fini:
 	drm_fb_helper_fini(helper);
+err_drm_client_release:
+	drm_client_release(&helper->client);
 	return err;
 }
 
@@ -191,6 +221,7 @@ static void tegra_fbdev_exit(struct drm_fb_helper *helper)
 	}
 
 	drm_fb_helper_fini(helper);
+	drm_client_release(&helper->client);
 	tegra_fbdev_free(helper);
 }
 
Signature · 1 line
2.40.0
#11 lore raw

PATCH 7/7 drm/tegra: Implement fbdev emulation as in-kernel client

In reply to Thomas Zimmermann

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 tegra_fbdev_setup() after tegra has registered its DRM device. As in most drivers, tegra'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 tegra. 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.

---
 drivers/gpu/drm/tegra/drm.c   |  23 +----
 drivers/gpu/drm/tegra/drm.h   |  18 +---
 drivers/gpu/drm/tegra/fbdev.c | 177 +++++++++++++++-------------------
 3 files changed, 86 insertions(+), 132 deletions(-)
drivers/gpu/drm/tegra/drm.c +4 -19
index 6ca9f396e55b..85ba96cddd51 100644
@@ -56,9 +56,6 @@ static int tegra_atomic_check(struct drm_device *drm,
 
 static const struct drm_mode_config_funcs tegra_drm_mode_config_funcs = {
 	.fb_create = tegra_fb_create,
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-	.output_poll_changed = drm_fb_helper_output_poll_changed,
-#endif
 	.atomic_check = tegra_atomic_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
@@ -885,7 +882,6 @@ static const struct drm_driver tegra_drm_driver = {
 			   DRIVER_ATOMIC | DRIVER_RENDER | DRIVER_SYNCOBJ,
 	.open = tegra_drm_open,
 	.postclose = tegra_drm_postclose,
-	.lastclose = drm_fb_helper_lastclose,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = tegra_debugfs_init,
@@ -1185,15 +1181,11 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	drm->mode_config.funcs = &tegra_drm_mode_config_funcs;
 	drm->mode_config.helper_private = &tegra_drm_mode_config_helpers;
 
-	err = tegra_drm_fb_prepare(drm);
-	if (err < 0)
-		goto config;
-
 	drm_kms_helper_poll_init(drm);
 
 	err = host1x_device_init(dev);
 	if (err < 0)
-		goto fbdev;
+		goto poll;
 
 	/*
 	 * Now that all display controller have been initialized, the maximum
@@ -1256,18 +1248,14 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	if (err < 0)
 		goto hub;
 
-	err = tegra_drm_fb_init(drm);
+	err = drm_dev_register(drm, 0);
 	if (err < 0)
 		goto hub;
 
-	err = drm_dev_register(drm, 0);
-	if (err < 0)
-		goto fb;
+	tegra_fbdev_setup(drm);
 
 	return 0;
 
-fb:
-	tegra_drm_fb_exit(drm);
 hub:
 	if (tegra->hub)
 		tegra_display_hub_cleanup(tegra->hub);
@@ -1280,10 +1268,8 @@ static int host1x_drm_probe(struct host1x_device *dev)
 	}
 
 	host1x_device_exit(dev);
-fbdev:
+poll:
 	drm_kms_helper_poll_fini(drm);
-	tegra_drm_fb_free(drm);
-config:
 	drm_mode_config_cleanup(drm);
 domain:
 	if (tegra->domain)
@@ -1304,7 +1290,6 @@ static int host1x_drm_remove(struct host1x_device *dev)
 	drm_dev_unregister(drm);
 
 	drm_kms_helper_poll_fini(drm);
-	tegra_drm_fb_exit(drm);
 	drm_atomic_helper_shutdown(drm);
 	drm_mode_config_cleanup(drm);
 
drivers/gpu/drm/tegra/drm.h +2 -16
index 576f03b8434e..f9d18e8cf6ab 100644
@@ -15,7 +15,6 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_fixed.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/tegra_drm.h>
@@ -194,22 +193,9 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
 					const struct drm_mode_fb_cmd2 *cmd);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-int tegra_drm_fb_prepare(struct drm_device *drm);
-void tegra_drm_fb_free(struct drm_device *drm);
-int tegra_drm_fb_init(struct drm_device *drm);
-void tegra_drm_fb_exit(struct drm_device *drm);
+void tegra_fbdev_setup(struct drm_device *drm);
 #else
-static inline int tegra_drm_fb_prepare(struct drm_device *drm)
-{
-	return 0;
-}
-static inline void tegra_drm_fb_free(struct drm_device *drm)
-{ }
-static inline int tegra_drm_fb_init(struct drm_device *drm)
-{
-	return 0;
-}
-static inline void tegra_drm_fb_exit(struct drm_device *drm)
+static inline void tegra_fbdev_setup(struct drm_device *drm)
 { }
 #endif
 
drivers/gpu/drm/tegra/fbdev.c +80 -97

223 lines not on this page · raw message

Signature · 1 line
2.40.0
#12 lore raw
In reply to Thomas Zimmermann
Quoted 22 lines · Thomas Zimmermann

Convert tegra's fbdev code to struct drm_client. Replaces the current ad-hoc integration. The conversion includes a number of cleanups. As with most other drivers' fbdev emulation, fbdev in tegra 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 (7):
drm/tegra: Include <linux/of.h>
drm/tegra: Include <linux/i2c.h>
drm/tegra: Removed fb from struct tegra_fbdev drm/tegra: Remove struct tegra_fbdev
drm/tegra: Hide fbdev support behind config option drm/tegra: Initialize fbdev DRM client drm/tegra: Implement fbdev emulation as in-kernel client

Quoted 9 lines
 drivers/gpu/drm/tegra/Makefile |   2 +
 drivers/gpu/drm/tegra/drm.c    |  23 +---
 drivers/gpu/drm/tegra/drm.h    |  27 ++--
 drivers/gpu/drm/tegra/fb.c     | 242 +--------------------------------
 drivers/gpu/drm/tegra/fbdev.c  | 240 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/tegra/output.c |   3 +
 drivers/gpu/drm/tegra/rgb.c    |   1 +
 7 files changed, 265 insertions(+), 273 deletions(-)
 create mode 100644 drivers/gpu/drm/tegra/fbdev.c

Seems to be working just fine. Applied, thanks.

Thierry

#13 lore raw

Am 05.04.23 um 16:55 schrieb Thierry Reding:

Quoted 33 lines · Thomas Zimmermann
Quoted 30 lines

Convert tegra's fbdev code to struct drm_client. Replaces the current ad-hoc integration. The conversion includes a number of cleanups. As with most other drivers' fbdev emulation, fbdev in tegra 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 (7):
drm/tegra: Include <linux/of.h>
drm/tegra: Include <linux/i2c.h>
drm/tegra: Removed fb from struct tegra_fbdev drm/tegra: Remove struct tegra_fbdev
drm/tegra: Hide fbdev support behind config option drm/tegra: Initialize fbdev DRM client drm/tegra: Implement fbdev emulation as in-kernel client

  drivers/gpu/drm/tegra/Makefile |   2 +
  drivers/gpu/drm/tegra/drm.c    |  23 +---
  drivers/gpu/drm/tegra/drm.h    |  27 ++--
  drivers/gpu/drm/tegra/fb.c     | 242 +--------------------------------
  drivers/gpu/drm/tegra/fbdev.c  | 240 ++++++++++++++++++++++++++++++++
  drivers/gpu/drm/tegra/output.c |   3 +
  drivers/gpu/drm/tegra/rgb.c    |   1 +
  7 files changed, 265 insertions(+), 273 deletions(-)
Quoted 1 line

create mode 100644 drivers/gpu/drm/tegra/fbdev.c

Quoted 1 line

Seems to be working just fine. Applied, thanks.

Thanks a lot!

Quoted 2 lines

Thierry

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#14 lore raw
In reply to Thomas Zimmermann

From: Thierry Reding <[email protected]>

Quoted 11 lines · Thomas Zimmermann

Convert tegra's fbdev code to struct drm_client. Replaces the current ad-hoc integration. The conversion includes a number of cleanups. As with most other drivers' fbdev emulation, fbdev in tegra 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.

[...]

Applied, thanks!

[1/7] drm/tegra: Include <linux/of.h>

      commit: 162b2ae95e0887ea75883bc419d55dd714b8fbf5
[2/7] drm/tegra: Include <linux/i2c.h>
      commit: 0e4ec6d97a2c6e96a5ec8d0edc00aa658238ed3f
[3/7] drm/tegra: Removed fb from struct tegra_fbdev
      commit: 5705d5b6a21e75c095df29deec8a13aa6b59f83c
[4/7] drm/tegra: Remove struct tegra_fbdev
      commit: fc5646b848222601d8be78b66b6498130437abe1
[5/7] drm/tegra: Hide fbdev support behind config option
      commit: 63ab4848d1d2eda1658ae82a3cb6eb7e03d28cec
[6/7] drm/tegra: Initialize fbdev DRM client
      commit: d9d1e306e70db905f29d05952c1499fd3c6ef6ef
[7/7] drm/tegra: Implement fbdev emulation as in-kernel client
      commit: 8e5113c627334ed32748d95ababd548171d2333d

Best regards,

Signature · 1 line
Thierry Reding <[email protected]>