Commit 8e86dee0 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/fb-helper: Remove drm_fb_helper_defio_init() and update docs

There are no users of drm_fb_helper_defio_init(), so we can remove
it. The documentation around defio support is a bit misleading and
should mention compatibility issues with SHMEM helpers. Clarify this.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191025092759.13069-2-tzimmermann@suse.de
parent 588b9828
...@@ -92,9 +92,12 @@ static DEFINE_MUTEX(kernel_fb_helper_lock); ...@@ -92,9 +92,12 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
* *
* Drivers that support a dumb buffer with a virtual address and mmap support, * Drivers that support a dumb buffer with a virtual address and mmap support,
* should try out the generic fbdev emulation using drm_fbdev_generic_setup(). * should try out the generic fbdev emulation using drm_fbdev_generic_setup().
* It will automatically set up deferred I/O if the driver requires a shadow
* buffer.
* *
* Setup fbdev emulation by calling drm_fb_helper_fbdev_setup() and tear it * For other drivers, setup fbdev emulation by calling
* down by calling drm_fb_helper_fbdev_teardown(). * 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 * At runtime drivers should restore the fbdev console by using
* drm_fb_helper_lastclose() as their &drm_driver.lastclose callback. * drm_fb_helper_lastclose() as their &drm_driver.lastclose callback.
...@@ -127,8 +130,10 @@ static DEFINE_MUTEX(kernel_fb_helper_lock); ...@@ -127,8 +130,10 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
* always run in process context since the fb_*() function could be running in * always run in process context since the fb_*() function could be running in
* atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io
* callback it will also schedule dirty_work with the damage collected from the * callback it will also schedule dirty_work with the damage collected from the
* mmap page writes. Drivers can use drm_fb_helper_defio_init() to setup * mmap page writes.
* deferred I/O (coupled with drm_fb_helper_fbdev_teardown()). *
* Deferred I/O is not compatible with SHMEM. Such drivers should request an
* fbdev shadow buffer and call drm_fbdev_generic_setup() instead.
*/ */
static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
...@@ -679,49 +684,6 @@ void drm_fb_helper_deferred_io(struct fb_info *info, ...@@ -679,49 +684,6 @@ void drm_fb_helper_deferred_io(struct fb_info *info,
} }
EXPORT_SYMBOL(drm_fb_helper_deferred_io); EXPORT_SYMBOL(drm_fb_helper_deferred_io);
/**
* drm_fb_helper_defio_init - fbdev deferred I/O initialization
* @fb_helper: driver-allocated fbdev helper
*
* This function allocates &fb_deferred_io, sets callback to
* drm_fb_helper_deferred_io(), delay to 50ms and calls fb_deferred_io_init().
* It should be called from the &drm_fb_helper_funcs->fb_probe callback.
* drm_fb_helper_fbdev_teardown() cleans up deferred I/O.
*
* NOTE: A copy of &fb_ops is made and assigned to &info->fbops. This is done
* because fb_deferred_io_cleanup() clears &fbops->fb_mmap and would thereby
* affect other instances of that &fb_ops.
*
* Returns:
* 0 on success or a negative error code on failure.
*/
int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
{
struct fb_info *info = fb_helper->fbdev;
struct fb_deferred_io *fbdefio;
struct fb_ops *fbops;
fbdefio = kzalloc(sizeof(*fbdefio), GFP_KERNEL);
fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
if (!fbdefio || !fbops) {
kfree(fbdefio);
kfree(fbops);
return -ENOMEM;
}
info->fbdefio = fbdefio;
fbdefio->delay = msecs_to_jiffies(50);
fbdefio->deferred_io = drm_fb_helper_deferred_io;
*fbops = *info->fbops;
info->fbops = fbops;
fb_deferred_io_init(info);
return 0;
}
EXPORT_SYMBOL(drm_fb_helper_defio_init);
/** /**
* drm_fb_helper_sys_read - wrapper around fb_sys_read * drm_fb_helper_sys_read - wrapper around fb_sys_read
* @info: fb_info struct pointer * @info: fb_info struct pointer
...@@ -2356,7 +2318,10 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = { ...@@ -2356,7 +2318,10 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = {
* *
* Drivers that set the dirty callback on their framebuffer will get a shadow * Drivers that set the dirty callback on their framebuffer will get a shadow
* fbdev buffer that is blitted onto the real buffer. This is done in order to * fbdev buffer that is blitted onto the real buffer. This is done in order to
* make deferred I/O work with all kinds of buffers. * make deferred I/O work with all kinds of buffers. A shadow buffer can be
* requested explicitly by setting struct drm_mode_config.prefer_shadow or
* struct drm_mode_config.prefer_shadow_fbdev to true beforehand. This is
* required to use generic fbdev emulation with SHMEM helpers.
* *
* This function is safe to call even when there are no connectors present. * This function is safe to call even when there are no connectors present.
* Setup will be retried on the next hotplug event. * Setup will be retried on the next hotplug event.
......
...@@ -235,7 +235,6 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper); ...@@ -235,7 +235,6 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);
void drm_fb_helper_deferred_io(struct fb_info *info, void drm_fb_helper_deferred_io(struct fb_info *info,
struct list_head *pagelist); struct list_head *pagelist);
int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper);
ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf, ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment