Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191025092759.13069-2-tzimmermann@suse.de

+13 -49
+13 -48
drivers/gpu/drm/drm_fb_helper.c
··· 92 92 * 93 93 * Drivers that support a dumb buffer with a virtual address and mmap support, 94 94 * should try out the generic fbdev emulation using drm_fbdev_generic_setup(). 95 + * It will automatically set up deferred I/O if the driver requires a shadow 96 + * buffer. 95 97 * 96 - * Setup fbdev emulation by calling drm_fb_helper_fbdev_setup() and tear it 97 - * down by calling drm_fb_helper_fbdev_teardown(). 98 + * For other drivers, setup fbdev emulation by calling 99 + * drm_fb_helper_fbdev_setup() and tear it down by calling 100 + * drm_fb_helper_fbdev_teardown(). 98 101 * 99 102 * At runtime drivers should restore the fbdev console by using 100 103 * drm_fb_helper_lastclose() as their &drm_driver.lastclose callback. ··· 130 127 * always run in process context since the fb_*() function could be running in 131 128 * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io 132 129 * callback it will also schedule dirty_work with the damage collected from the 133 - * mmap page writes. Drivers can use drm_fb_helper_defio_init() to setup 134 - * deferred I/O (coupled with drm_fb_helper_fbdev_teardown()). 130 + * mmap page writes. 131 + * 132 + * Deferred I/O is not compatible with SHMEM. Such drivers should request an 133 + * fbdev shadow buffer and call drm_fbdev_generic_setup() instead. 135 134 */ 136 135 137 136 static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) ··· 683 678 } 684 679 } 685 680 EXPORT_SYMBOL(drm_fb_helper_deferred_io); 686 - 687 - /** 688 - * drm_fb_helper_defio_init - fbdev deferred I/O initialization 689 - * @fb_helper: driver-allocated fbdev helper 690 - * 691 - * This function allocates &fb_deferred_io, sets callback to 692 - * drm_fb_helper_deferred_io(), delay to 50ms and calls fb_deferred_io_init(). 693 - * It should be called from the &drm_fb_helper_funcs->fb_probe callback. 694 - * drm_fb_helper_fbdev_teardown() cleans up deferred I/O. 695 - * 696 - * NOTE: A copy of &fb_ops is made and assigned to &info->fbops. This is done 697 - * because fb_deferred_io_cleanup() clears &fbops->fb_mmap and would thereby 698 - * affect other instances of that &fb_ops. 699 - * 700 - * Returns: 701 - * 0 on success or a negative error code on failure. 702 - */ 703 - int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper) 704 - { 705 - struct fb_info *info = fb_helper->fbdev; 706 - struct fb_deferred_io *fbdefio; 707 - struct fb_ops *fbops; 708 - 709 - fbdefio = kzalloc(sizeof(*fbdefio), GFP_KERNEL); 710 - fbops = kzalloc(sizeof(*fbops), GFP_KERNEL); 711 - if (!fbdefio || !fbops) { 712 - kfree(fbdefio); 713 - kfree(fbops); 714 - return -ENOMEM; 715 - } 716 - 717 - info->fbdefio = fbdefio; 718 - fbdefio->delay = msecs_to_jiffies(50); 719 - fbdefio->deferred_io = drm_fb_helper_deferred_io; 720 - 721 - *fbops = *info->fbops; 722 - info->fbops = fbops; 723 - 724 - fb_deferred_io_init(info); 725 - 726 - return 0; 727 - } 728 - EXPORT_SYMBOL(drm_fb_helper_defio_init); 729 681 730 682 /** 731 683 * drm_fb_helper_sys_read - wrapper around fb_sys_read ··· 2318 2356 * 2319 2357 * Drivers that set the dirty callback on their framebuffer will get a shadow 2320 2358 * fbdev buffer that is blitted onto the real buffer. This is done in order to 2321 - * make deferred I/O work with all kinds of buffers. 2359 + * make deferred I/O work with all kinds of buffers. A shadow buffer can be 2360 + * requested explicitly by setting struct drm_mode_config.prefer_shadow or 2361 + * struct drm_mode_config.prefer_shadow_fbdev to true beforehand. This is 2362 + * required to use generic fbdev emulation with SHMEM helpers. 2322 2363 * 2323 2364 * This function is safe to call even when there are no connectors present. 2324 2365 * Setup will be retried on the next hotplug event.
-1
include/drm/drm_fb_helper.h
··· 235 235 236 236 void drm_fb_helper_deferred_io(struct fb_info *info, 237 237 struct list_head *pagelist); 238 - int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper); 239 238 240 239 ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf, 241 240 size_t count, loff_t *ppos);