drm/udl: Replace fbdev by generic emulation
Subsystems (5)
Thomas Zimmermann
maintainerv4 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.
The fbdev conversion is in patch 1. As udl was the only remaining external user of unlink_framebuffer(), that function now becomes an internal interface of the fbdev code (Patches 2 + 3).
V4 of the patchset keeps udl_gem_object_free_object(). The function is still required to clean up after the damage handler mapped a BO.
The patchset has been tested by running the console, X11 and Weston on a DisplayLink adapter.
v4:
* go back to 24 bpp by default, 16 bpp for console
* keep udl_gem_object_free_object(); required by damage handler
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 (3):
drm/udl: Replace fbdev code with generic emulation 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_main.c | 5 +- drivers/gpu/drm/udl/udl_modeset.c | 1 - drivers/video/fbdev/core/fbmem.c | 3 +- include/drm/drm_fb_helper.h | 6 - include/linux/fb.h | 1 - 9 files changed, 4 insertions(+), 317 deletions(-)
--
2.23.0
Thomas Zimmermann
maintainerPATCH v4 1/3 drm/udl: Replace fbdev code with generic emulation
The udl driver can use the generic fbdev implementation. Convert it.
v4:
* hardcode console bpp to 16
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,16 );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
Re: [PATCH v4 1/3] drm/udl: Replace fbdev code with generic emulation
Den 13.11.2019 12.52, skrev Thomas Zimmermann:
Quoted 26 lines
The udl driver can use the generic fbdev implementation. Convert it.
v4:
* hardcode console bpp to 16
v3:
* remove module parameterfb_bppin favor of fbdev's video
* calldrm_fbdev_generic_setup()directly; removeudl_fbdev_init()
* use default for struct drm_mode_config_funcs.output_poll_changed
* use default for struct drm_driver.lastcloseSigned-off-by Thomas Zimmermann <[email protected]>---
drivers/gpu/drm/udl/udl_main.c +1
-0@@ -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>
drivers/gpu/drm/udl/udl_main.c int udl_init(struct udl_device *udl) · line 342
Quoted 5 lines
drivers/gpu/drm/udl/udl_main.c +1
-1@@ -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,16 );
I suggest you put this after drm_dev_register() in _probe() since fbdev is a client, a user of the driver, not part of it as such.
Either way you choose:
Btw, nice diffstat!
Quoted 10 lines
drivers/gpu/drm/udl/udl_main.c +0
-2if (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); }
Thomas Zimmermann
maintainerRe: [PATCH v4 1/3] drm/udl: Replace fbdev code with generic emulation
Hi
Am 13.11.19 um 16:26 schrieb Noralf Trønnes:
Quoted 32 lines
Den 13.11.2019 12.52, skrev Thomas Zimmermann:
Quoted 29 lines
The udl driver can use the generic fbdev implementation. Convert it.
v4:
* hardcode console bpp to 16
v3:
* remove module parameterfb_bppin favor of fbdev's video
* calldrm_fbdev_generic_setup()directly; removeudl_fbdev_init()
* use default for struct drm_mode_config_funcs.output_poll_changed
* use default for struct drm_driver.lastcloseSigned-off-by Thomas Zimmermann <[email protected]>---
drivers/gpu/drm/udl/udl_main.c +1
-0@@ -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;
Quoted 5 lines
drivers/gpu/drm/udl/udl_main.c int udl_init(struct udl_device *udl) · line 342
Quoted 2 lines
drivers/gpu/drm/udl/udl_main.c +1
-1- ret =udl_fbdev_init (dev); + ret =drm_fbdev_generic_setup (dev,16 );I suggest you put this after
drm_dev_register()in_probe()since fbdev is a client, a user of the driver, not part of it as such.
Good point. I'll change it.
Quoted 2 lines
Either way you choose:
Glad you like it :)
Quoted 2 lines
Reviewed-by Noralf Trønnes <[email protected]>
Thanks for the review.
Best regards
Thomas
Quoted 18 lines
Btw, nice diffstat!
drivers/gpu/drm/udl/udl_main.c void udl_fini(struct drm_device *dev) · line 371
Quoted 10 lines
drivers/gpu/drm/udl/udl_main.c +0
-2if (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); }_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
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: Felix Imendörffer
Thomas Zimmermann
maintainerRe: [PATCH v4 1/3] drm/udl: Replace fbdev code with generic emulation
Am 13.11.19 um 16:41 schrieb Thomas Zimmermann:
Quoted 4 lines
Quoted 1 line
Either way you choose:
Glad you like it :)
more like this
Quoted 2 lines
Quoted 2 lines
Btw, nice diffstat!
Glad you like it :)
Quoted 17 lines
Quoted 16 lines
drivers/gpu/drm/udl/udl_main.c void udl_fini(struct drm_device *dev) · line 371
Quoted 11 lines
drivers/gpu/drm/udl/udl_main.c +0
-2if (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); }_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
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: Felix Imendörffer
Thomas Zimmermann
maintainerPATCH v4 2/3 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
Re: [PATCH v4 2/3] drm/fb-helper: Remove drm_fb_helper_unlink_fbi()
Den 13.11.2019 12.52, skrev Thomas Zimmermann:
Quoted 5 lines
There are no callers of
drm_fb_helper_unlink_fbi()left. Remove the function.Signed-off-by Thomas Zimmermann <[email protected]>---
Thomas Zimmermann
maintainerPATCH v4 3/3 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
Re: [PATCH v4 3/3] fbdev: Unexport unlink_framebuffer()
Den 13.11.2019 12.52, skrev Thomas Zimmermann:
Quoted 5 lines
There are no external callers of
unlink_framebuffer()left. Make the function an internal interface.Signed-off-by Thomas Zimmermann <[email protected]>---