Skip to contentSkip to conversation

Remove drm_fb_helper_fbdev_{setup,teardown}()

PATCH Superseded Thomas Zimmermann 2 participants 5 messages Oct 29, 2019 – Oct 30, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

cover Remove drm_fb_helper_fbdev_{setup,teardown}()

Both functions are unused. Update TODO item and remove them.

Thomas Zimmermann (2):
drm/todo: Convert drivers to generic fbdev emulation drm/fb-helper: Remove drm_fb_helper_fbdev_{setup,teardown}()

 Documentation/gpu/todo.rst      |  15 ++---
 drivers/gpu/drm/drm_fb_helper.c | 109 +-------------------------------
 include/drm/drm_fb_helper.h     |  25 --------
 3 files changed, 8 insertions(+), 141 deletions(-)

--
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#1 lore raw

PATCH 1/2 drm/todo: Convert drivers to generic fbdev emulation

This replaces the orignal TODO item for drm_fb_helper_fbdev_setup() and _teardown(), which are deprecated.

---
 Documentation/gpu/todo.rst | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
Documentation/gpu/todo.rst +7 -8
index 6792fa9b6b6b..4aa767461e0e 100644
@@ -171,10 +171,10 @@ Contact: Maintainer of the driver you plan to convert
 
 Level: Intermediate
 
-Convert drivers to use drm_fb_helper_fbdev_setup/teardown()
------------------------------------------------------------
+Convert drivers to use drm_fbdev_generic_setup()
+------------------------------------------------
 
-Most drivers can use drm_fb_helper_fbdev_setup() except maybe:
+Most drivers can use drm_fbdev_generic_setup() except maybe:
 
 - amdgpu which has special logic to decide whether to call
   drm_helper_disable_unused_functions()
@@ -184,8 +184,10 @@ Most drivers can use drm_fb_helper_fbdev_setup() except maybe:
 
 - i915 which calls drm_fb_helper_initial_config() in a worker
 
-Drivers that use drm_framebuffer_remove() to clean up the fbdev framebuffer can
-probably use drm_fb_helper_fbdev_teardown().
+Current generic fbdev emulation expects the framebuffer in system
+memory (or system-like memory). This might be a problem for certain
+drivers. Generic fbdev emulation should have a way of operating on
+I/O memory.
 
 Contact: Maintainer of the driver you plan to convert
 
@@ -328,9 +330,6 @@ drm_fb_helper tasks
   these igt tests need to be fixed: kms_fbcon_fbt@psr and
   kms_fbcon_fbt@psr-suspend.
 
-- The max connector argument for drm_fb_helper_init() and
-  drm_fb_helper_fbdev_setup() isn't used anymore and can be removed.
-
 - The helper doesn't keep an array of connectors anymore so these can be
   removed: drm_fb_helper_single_add_all_connectors(),
   drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH 1/2] drm/todo: Convert drivers to generic fbdev emulation

Den 29.10.2019 08.06, skrev Thomas Zimmermann:

Quoted 29 lines

This replaces the orignal TODO item for drm_fb_helper_fbdev_setup() and _teardown(), which are deprecated.

---
 Documentation/gpu/todo.rst | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
Documentation/gpu/todo.rst +3 -3
index 6792fa9b6b6b..4aa767461e0e 100644
@@ -171,10 +171,10 @@ Contact: Maintainer of the driver you plan to convert
 
 Level: Intermediate
 
-Convert drivers to use drm_fb_helper_fbdev_setup/teardown()
------------------------------------------------------------
+Convert drivers to use drm_fbdev_generic_setup()
+------------------------------------------------
 
-Most drivers can use drm_fb_helper_fbdev_setup() except maybe:
+Most drivers can use drm_fbdev_generic_setup() except maybe:
 
 - amdgpu which has special logic to decide whether to call
   drm_helper_disable_unused_functions()
@@ -184,8 +184,10 @@ Most drivers can use drm_fb_helper_fbdev_setup() except maybe:
 
 - i915 which calls drm_fb_helper_initial_config() in a worker

Documentation/gpu/todo.rst Most drivers can use drm_fb_helper_fbdev_setup() except maybe: · line 193

Quoted 10 lines
Documentation/gpu/todo.rst +4 -2
 
-Drivers that use drm_framebuffer_remove() to clean up the fbdev framebuffer can
-probably use drm_fb_helper_fbdev_teardown().
+Current generic fbdev emulation expects the framebuffer in system
+memory (or system-like memory). This might be a problem for certain
+drivers. Generic fbdev emulation should have a way of operating on
+I/O memory.
 
 Contact: Maintainer of the driver you plan to convert
 

I think you can just delete the entire _setup/_teardown entry including the list of drivers. Many more drivers have issues with the generic emulation so no point in listing individual drivers at this early stage. You can add that the driver has to be atomic and that it needs to support prime vmap/mmap. Maybe also the current shadow buffer performance penalty for shmem backed buffers.

Documentation/gpu/todo.rst drm_fb_helper tasks · line 333

Quoted 7 lines
Documentation/gpu/todo.rst +0 -3
@@ -328,9 +330,6 @@ drm_fb_helper tasks
   these igt tests need to be fixed: kms_fbcon_fbt@psr and
   kms_fbcon_fbt@psr-suspend.
 
-- The max connector argument for drm_fb_helper_init() and
-  drm_fb_helper_fbdev_setup() isn't used anymore and can be removed.
-

This entry is still valid for drm_fb_helper_init().

Noralf.

Documentation/gpu/todo.rst drm_fb_helper tasks · line 335

Quoted 4 lines
Documentation/gpu/todo.rst +0 -0
 - The helper doesn't keep an array of connectors anymore so these can be
   removed: drm_fb_helper_single_add_all_connectors(),
   drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#3 lore raw

PATCH 2/2 drm/fb-helper: Remove drm_fb_helper_fbdev_{setup, teardown}()

In reply to Thomas Zimmermann

Both functions are unused and can be removed. Drivers should use drm_fbdev_generic_setup() instead.

---
 drivers/gpu/drm/drm_fb_helper.c | 109 +-------------------------------
 include/drm/drm_fb_helper.h     |  25 --------
 2 files changed, 1 insertion(+), 133 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +1 -108
index 8ebeccdeed23..1038a2f0639e 100644
@@ -95,10 +95,6 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * It will automatically set up deferred I/O if the driver requires a shadow
  * buffer.
  *
- * For other drivers, setup fbdev emulation by calling
- * drm_fb_helper_fbdev_setup() and tear it down by calling
- * drm_fb_helper_fbdev_teardown().
- *
  * At runtime drivers should restore the fbdev console by using
  * drm_fb_helper_lastclose() as their &drm_driver.lastclose callback.
  * They should also notify the fb helper code from updates to the output
@@ -1919,108 +1915,6 @@ int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
 
-/**
- * drm_fb_helper_fbdev_setup() - Setup fbdev emulation
- * @dev: DRM device
- * @fb_helper: fbdev helper structure to set up
- * @funcs: fbdev helper functions
- * @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 (not used)
- *
- * This function sets up fbdev emulation and registers fbdev for access by
- * userspace. If all connectors are disconnected, setup is deferred to the next
- * time drm_fb_helper_hotplug_event() is called.
- * The caller must to provide a &drm_fb_helper_funcs->fb_probe callback
- * function.
- *
- * Use drm_fb_helper_fbdev_teardown() to destroy the fbdev.
- *
- * See also: drm_fb_helper_initial_config(), drm_fbdev_generic_setup().
- *
- * Returns:
- * Zero on success or negative error code on failure.
- */
-int drm_fb_helper_fbdev_setup(struct drm_device *dev,
-			      struct drm_fb_helper *fb_helper,
-			      const struct drm_fb_helper_funcs *funcs,
-			      unsigned int preferred_bpp,
-			      unsigned int max_conn_count)
-{
-	int ret;
-
-	if (!preferred_bpp)
-		preferred_bpp = dev->mode_config.preferred_depth;
-	if (!preferred_bpp)
-		preferred_bpp = 32;
-
-	drm_fb_helper_prepare(dev, fb_helper, funcs);
-
-	ret = drm_fb_helper_init(dev, fb_helper, 0);
-	if (ret < 0) {
-		DRM_DEV_ERROR(dev->dev, "fbdev: Failed to initialize (ret=%d)\n", ret);
-		return ret;
-	}
-
-	if (!drm_drv_uses_atomic_modeset(dev))
-		drm_helper_disable_unused_functions(dev);
-
-	ret = drm_fb_helper_initial_config(fb_helper, preferred_bpp);
-	if (ret < 0) {
-		DRM_DEV_ERROR(dev->dev, "fbdev: Failed to set configuration (ret=%d)\n", ret);
-		goto err_drm_fb_helper_fini;
-	}
-
-	return 0;
-
-err_drm_fb_helper_fini:
-	drm_fb_helper_fbdev_teardown(dev);
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_fb_helper_fbdev_setup);
-
-/**
- * drm_fb_helper_fbdev_teardown - Tear down fbdev emulation
- * @dev: DRM device
- *
- * This function unregisters fbdev if not already done and cleans up the
- * associated resources including the &drm_framebuffer.
- * The driver is responsible for freeing the &drm_fb_helper structure which is
- * stored in &drm_device->fb_helper. Do note that this pointer has been cleared
- * when this function returns.
- *
- * In order to support device removal/unplug while file handles are still open,
- * drm_fb_helper_unregister_fbi() should be called on device removal and
- * drm_fb_helper_fbdev_teardown() in the &drm_driver->release callback when
- * file handles are closed.
- */
-void drm_fb_helper_fbdev_teardown(struct drm_device *dev)
-{
-	struct drm_fb_helper *fb_helper = dev->fb_helper;
-	struct fb_ops *fbops = NULL;
-
-	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 && fb_helper->fbdev->fbdefio) {
-		fb_deferred_io_cleanup(fb_helper->fbdev);
-		kfree(fb_helper->fbdev->fbdefio);
-		fbops = fb_helper->fbdev->fbops;
-	}
-
-	drm_fb_helper_fini(fb_helper);
-	kfree(fbops);
-
-	if (fb_helper->fb)
-		drm_framebuffer_remove(fb_helper->fb);
-}
-EXPORT_SYMBOL(drm_fb_helper_fbdev_teardown);
-
 /**
  * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation
  * @dev: DRM device
@@ -2309,8 +2203,7 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = {
  *                 @dev->mode_config.preferred_depth is used if this is zero.
  *
  * This function sets up generic fbdev emulation for drivers that supports
- * dumb buffers with a virtual address and that can be mmap'ed. If the driver
- * does not support these functions, it could use drm_fb_helper_fbdev_setup().
+ * dumb buffers with a virtual address and that can be mmap'ed.
  *
  * Restore, hotplug events and teardown are all taken care of. Drivers that do
  * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
include/drm/drm_fb_helper.h +0 -25
index 2338e9f94a03..e3a75ff07390 100644
@@ -269,13 +269,6 @@ int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
 int drm_fb_helper_debug_enter(struct fb_info *info);
 int drm_fb_helper_debug_leave(struct fb_info *info);
 
-int drm_fb_helper_fbdev_setup(struct drm_device *dev,
-			      struct drm_fb_helper *fb_helper,
-			      const struct drm_fb_helper_funcs *funcs,
-			      unsigned int preferred_bpp,
-			      unsigned int max_conn_count);
-void drm_fb_helper_fbdev_teardown(struct drm_device *dev);
-
 void drm_fb_helper_lastclose(struct drm_device *dev);
 void drm_fb_helper_output_poll_changed(struct drm_device *dev);
 
@@ -452,24 +445,6 @@ static inline int drm_fb_helper_debug_leave(struct fb_info *info)
 	return 0;
 }
 
-static inline int
-drm_fb_helper_fbdev_setup(struct drm_device *dev,
-			  struct drm_fb_helper *fb_helper,
-			  const struct drm_fb_helper_funcs *funcs,
-			  unsigned int preferred_bpp,
-			  unsigned int max_conn_count)
-{
-	/* So drivers can use it to free the struct */
-	dev->fb_helper = fb_helper;
-
-	return 0;
-}
-
-static inline void drm_fb_helper_fbdev_teardown(struct drm_device *dev)
-{
-	dev->fb_helper = NULL;
-}
-
 static inline void drm_fb_helper_lastclose(struct drm_device *dev)
 {
 }
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/fb-helper: Remove drm_fb_helper_fbdev_{setup,teardown}()

Den 29.10.2019 08.06, skrev Thomas Zimmermann:

Quoted 9 lines

Both functions are unused and can be removed. Drivers should use drm_fbdev_generic_setup() instead.

---
 drivers/gpu/drm/drm_fb_helper.c | 109 +-------------------------------
 include/drm/drm_fb_helper.h     |  25 --------
 2 files changed, 1 insertion(+), 133 deletions(-)

Thanks for the cleanup:

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel