drm/udl: Replace fbdev by generic emulation
Subsystems (5)
Thomas Zimmermann
maintainerv3 cover drm/udl: Replace fbdev by generic emulation
The udl driver can use the generic fbdev emulation. After conversion, a number of cleanups can be applied.
Patch 1 prepares the prefered defaults. 32 bpp work well with driver, console and X11. The fbdev conversion is in patch 2. The original fbdev code in udl mapped the framebuffer's GEM object memory unconditionally, and unmapped the memory in the object's free() function. The respective code in free() can now be removed (Patch 3). And as udl was the only remaining external user of unlink_framebuffer(), that function now becomes an internal interface of the fbdev code (Patches 4 + 5).
The patchset has been tested by running the console, X11 and Weston on a DisplayLink adapter.
v3:
* use 32 bpp by default
* use defaults for several callback functions
* remove all fb module parameters
* remove udl_fbdev_init()
v2:
* converted udl to SHMEM and recreated fbdev patchset on top
Thomas Zimmermann (5):
drm/udl: Set default color depth to 32 bpp drm/udl: Replace fbdev code with generic emulation drm/udl: Remove udl implementation of GEM's free_object() drm/fb-helper: Remove drm_fb_helper_unlink_fbi()
fbdev: Unexport unlink_framebuffer()
drivers/gpu/drm/drm_fb_helper.c | 16 +- drivers/gpu/drm/udl/udl_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.h | 6 - drivers/gpu/drm/udl/udl_fb.c | 282 ------------------------------ drivers/gpu/drm/udl/udl_gem.c | 18 +- drivers/gpu/drm/udl/udl_main.c | 5 +- drivers/gpu/drm/udl/udl_modeset.c | 3 +- drivers/video/fbdev/core/fbmem.c | 3 +- include/drm/drm_fb_helper.h | 6 - include/linux/fb.h | 1 - 10 files changed, 6 insertions(+), 335 deletions(-)
--
2.23.0
Thomas Zimmermann
maintainerPATCH v3 1/5 drm/udl: Set default color depth to 32 bpp
The udl driver only supports color depths that are powers of two. Change prefered default to 32 bpp.
--- drivers/gpu/drm/udl/udl_modeset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_modeset.c +1 -1
@@ -437,7 +437,7 @@ int udl_modeset_init(struct drm_device *dev) dev->mode_config.max_height =2048 ; dev->mode_config.prefer_shadow =0 ; - dev->mode_config.preferred_depth =24 ; + dev->mode_config.preferred_depth =32 ; dev->mode_config.funcs = &udl_mode_funcs;
Signature · 1 line
2.23.0
Thomas Zimmermann
maintainerPATCH v3 2/5 drm/udl: Replace fbdev code with generic emulation
In reply to Thomas ZimmermannThe udl driver can use the generic fbdev implementation. Convert it.
v3:
* remove module parameter fb_bpp in favor of fbdev's video
* call drm_fbdev_generic_setup() directly; remove udl_fbdev_init()
* use default for struct drm_mode_config_funcs.output_poll_changed
* use default for struct drm_driver.lastclose
--- drivers/gpu/drm/udl/udl_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.h | 6 - drivers/gpu/drm/udl/udl_fb.c | 282 ------------------------------ drivers/gpu/drm/udl/udl_main.c | 5 +- drivers/gpu/drm/udl/udl_modeset.c | 1 - 5 files changed, 2 insertions(+), 293 deletions(-)
drivers/gpu/drm/udl/udl_drv.c +0 -1
@@ -119,7 +119,6 @@ static void udl_usb_disconnect(struct usb_interface *interface)struct drm_device *dev =usb_get_intfdata (interface);drm_kms_helper_poll_disable (dev); -udl_fbdev_unplug (dev);udl_drop_usb (dev);drm_dev_unplug (dev);drm_dev_put (dev);
drivers/gpu/drm/udl/udl_drv.h +0 -6
@@ -47,8 +47,6 @@ struct urb_list {size_t size; }; -struct udl_fbdev ; -struct udl_device {struct drm_device drm;struct device *dev;
@@ -62,7 +60,6 @@ struct udl_device {struct urb_list urbs;atomic_t lost_pixels;/* 1 = a render op failed. Need screen refresh */ -struct udl_fbdev *fbdev;char mode_buf[1024 ];uint32_t mode_buf_len;atomic_t bytes_rendered;/* raw pixel-bytes driver asked to render */
@@ -97,9 +94,6 @@ void udl_urb_completion(struct urb *urb);int udl_init (struct udl_device *udl);void udl_fini (struct drm_device *dev); -int udl_fbdev_init (struct drm_device *dev); -void udl_fbdev_cleanup (struct drm_device *dev); -void udl_fbdev_unplug (struct drm_device *dev);struct drm_framebuffer * udl_fb_user_fb_create(struct drm_device *dev, struct drm_file *file,
drivers/gpu/drm/udl/udl_fb.c +0 -281
305 lines not on this page · raw message
drivers/gpu/drm/udl/udl_main.c +2 -3
@@ -9,6 +9,7 @@*/ #include <drm/drm.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_print.h> #include <drm/drm_probe_helper.h>
@@ -338,7 +339,7 @@ int udl_init(struct udl_device *udl)if (ret) goto err; - ret =udl_fbdev_init (dev); + ret =drm_fbdev_generic_setup (dev,0 );if (ret) goto err;
@@ -367,6 +368,4 @@ void udl_fini(struct drm_device *dev)if (udl->urbs.count)udl_free_urb_list (dev); - -udl_fbdev_cleanup (dev); }
drivers/gpu/drm/udl/udl_modeset.c +0 -1
@@ -422,7 +422,6 @@ static int udl_crtc_init(struct drm_device *dev)static const struct drm_mode_config_funcs udl_mode_funcs = { .fb_create = udl_fb_user_fb_create, - .output_poll_changed =NULL , };int udl_modeset_init (struct drm_device *dev)
Signature · 1 line
2.23.0
Thomas Zimmermann
maintainerPATCH v3 3/5 drm/udl: Remove udl implementation of GEM's free_object()
In reply to Thomas ZimmermannUdl used to have a custom implementation for free_object() of struct drm_gem_object_funcs. It unmapped the memory buffer of the fbdev emulation. With the switch to generic fbdev emulation, this is now handled by the fbdev code internally.
--- drivers/gpu/drm/udl/udl_gem.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/gpu/drm/udl/udl_gem.c +1 -17
@@ -17,22 +17,6 @@* GEM object funcs */ -static void udl_gem_object_free_object (struct drm_gem_object *obj) -{ -struct drm_gem_shmem_object *shmem =to_drm_gem_shmem_obj (obj); - -/* Fbdev emulation vmaps the buffer. Unmap it here for consistency -* with the original udl GEM code. -* -* TODO: Switch to generic fbdev emulation and release the -* GEM object with drm_gem_shmem_free_object(). -*/ -if (shmem->vaddr) -drm_gem_shmem_vunmap (obj, shmem->vaddr); - -drm_gem_shmem_free_object (obj); -} -static int udl_gem_object_mmap (struct drm_gem_object *obj,struct vm_area_struct *vma) {
@@ -91,7 +75,7 @@ static void *udl_gem_object_vmap(struct drm_gem_object *obj) }static const struct drm_gem_object_funcs udl_gem_object_funcs = { - .free = udl_gem_object_free_object, + .free = drm_gem_shmem_free_object, .print_info = drm_gem_shmem_print_info, .pin = drm_gem_shmem_pin, .unpin = drm_gem_shmem_unpin,
Signature · 1 line
2.23.0
Thomas Zimmermann
maintainerPATCH v3 4/5 drm/fb-helper: Remove drm_fb_helper_unlink_fbi()
In reply to Thomas ZimmermannThere are no callers of drm_fb_helper_unlink_fbi() left. Remove the function.
--- drivers/gpu/drm/drm_fb_helper.c | 16 +--------------- include/drm/drm_fb_helper.h | 6 ------ 2 files changed, 1 insertion(+), 21 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +1 -15
@@ -563,8 +563,7 @@ EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);* drm_fb_helper_fini - finialize a &struct drm_fb_helper * @fb_helper: driver-allocated fbdev helper, can be NULL * -* This cleans up all remaining resources associated with @fb_helper. Must be -* called after drm_fb_helper_unlink_fbi() was called. +* This cleans up all remaining resources associated with @fb_helper. */ void drm_fb_helper_fini (struct drm_fb_helper *fb_helper) {
@@ -604,19 +603,6 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper) }EXPORT_SYMBOL (drm_fb_helper_fini); -/** -* drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer -* @fb_helper: driver-allocated fbdev helper, can be NULL -* -* A wrapper around unlink_framebuffer implemented by fbdev core -*/ -void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper) -{ -if (fb_helper && fb_helper->fbdev) -unlink_framebuffer (fb_helper->fbdev); -} -EXPORT_SYMBOL (drm_fb_helper_unlink_fbi); -static bool drm_fbdev_use_shadow_fb (struct drm_fb_helper *fb_helper) {struct drm_device *dev = fb_helper->dev;
include/drm/drm_fb_helper.h +0 -6
@@ -231,8 +231,6 @@ void drm_fb_helper_fill_info(struct fb_info *info,struct drm_fb_helper *fb_helper, struct drm_fb_helper_surface_size *sizes); -void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper); -void drm_fb_helper_deferred_io (struct fb_info *info,struct list_head *pagelist);
@@ -356,10 +354,6 @@ static inline int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,return 0 ; } -static inline void drm_fb_helper_unlink_fbi (struct drm_fb_helper *fb_helper) -{ -} -static inline void drm_fb_helper_deferred_io (struct fb_info *info,struct list_head *pagelist) {
Signature · 1 line
2.23.0
Thomas Zimmermann
maintainerPATCH v3 5/5 fbdev: Unexport unlink_framebuffer()
In reply to Thomas ZimmermannThere are no external callers of unlink_framebuffer() left. Make the function an internal interface.
--- drivers/video/fbdev/core/fbmem.c | 3 +-- include/linux/fb.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/core/fbmem.c +1 -2
@@ -1673,7 +1673,7 @@ static void unbind_console(struct fb_info *fb_info)console_unlock (); } -void unlink_framebuffer (struct fb_info *fb_info) +static void unlink_framebuffer (struct fb_info *fb_info) {int i;
@@ -1692,7 +1692,6 @@ void unlink_framebuffer(struct fb_info *fb_info) fb_info->dev =NULL ; } -EXPORT_SYMBOL (unlink_framebuffer);static void do_unregister_framebuffer (struct fb_info *fb_info) {
include/linux/fb.h +0 -1
@@ -606,7 +606,6 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,/* drivers/video/fbmem.c */ extern int register_framebuffer (struct fb_info *fb_info);extern void unregister_framebuffer (struct fb_info *fb_info); -extern void unlink_framebuffer (struct fb_info *fb_info);extern int remove_conflicting_pci_framebuffers (struct pci_dev *pdev,const char *name); extern int remove_conflicting_framebuffers(struct apertures_struct *a,
Signature · 1 line
2.23.0