drm/cma-helper: Remove drm_fbdev_cma* functions
Subsystems (12)
v3 cover drm/cma-helper: Remove drm_fbdev_cma* functions
These are the remaining patches not applied due to missing review and:
- arm/hdlcd and rcar-du have started to use drm_fbdev_cma_set_suspend_unlocked() since last, so I have added patches converting them to drm_mode_config_helper_suspend/resume().
- tinydrm has gained a new driver ili9225
Noralf.
Noralf Trønnes (11):
drm/arc: Use drm_fb_cma_fbdev_init/fini() drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume() drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini() drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini() drm/meson: Use drm_fb_cma_fbdev_init/fini() drm/mxsfb: Use drm_fb_cma_fbdev_init/fini() drm/rcar-du: Use drm_mode_config_helper_suspend/resume() drm/rcar-du: Use drm_fb_cma_fbdev_init/fini() drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini() drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() drm/cma-helper: Remove drm_fbdev_cma* functions
Documentation/gpu/todo.rst | 5 - drivers/gpu/drm/arc/arcpgu.h | 4 - drivers/gpu/drm/arc/arcpgu_drv.c | 36 ++---- drivers/gpu/drm/arm/hdlcd_drv.c | 62 ++-------- drivers/gpu/drm/arm/hdlcd_drv.h | 2 - drivers/gpu/drm/drm_fb_cma_helper.c | 158 ------------------------ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 +--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 +----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 - drivers/gpu/drm/meson/meson_drv.c | 20 +-- drivers/gpu/drm/meson/meson_drv.h | 1 - drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +--- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 - drivers/gpu/drm/rcar-du/rcar_du_drv.c | 34 +---- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 3 - drivers/gpu/drm/rcar-du/rcar_du_kms.c | 20 +-- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 37 +----- drivers/gpu/drm/tinydrm/ili9225.c | 3 +- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- drivers/gpu/drm/tinydrm/st7586.c | 3 +- include/drm/drm_fb_cma_helper.h | 28 +---- include/drm/tinydrm/tinydrm.h | 3 - 23 files changed, 61 insertions(+), 449 deletions(-)
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/11 drm/arc: Use drm_fb_cma_fbdev_init/fini()
Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
Remove unused function prototype arcpgu_fbdev_cma_init().
--- drivers/gpu/drm/arc/arcpgu.h | 4 ---- drivers/gpu/drm/arc/arcpgu_drv.c | 36 +++++++----------------------------- 2 files changed, 7 insertions(+), 33 deletions(-)
drivers/gpu/drm/arc/arcpgu.h +0 -4
@@ -20,7 +20,6 @@struct arcpgu_drm_private {void __iomem *regs;struct clk *clk; -struct drm_fbdev_cma *fbdev;struct drm_framebuffer *fb;struct drm_crtc crtc;struct drm_plane *plane;
@@ -43,8 +42,5 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,int arc_pgu_setup_crtc (struct drm_device *dev);int arcpgu_drm_hdmi_init (struct drm_device *drm,struct device_node *np);int arcpgu_drm_sim_init (struct drm_device *drm,struct device_node *np); -struct drm_fbdev_cma *arcpgu_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int num_crtc, -unsigned int max_conn_count);#endif
drivers/gpu/drm/arc/arcpgu_drv.c +7 -29
@@ -16,6 +16,7 @@#include <linux/clk.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
@@ -25,16 +26,9 @@#include "arcpgu.h" #include "arcpgu_regs.h" -static void arcpgu_fb_output_poll_changed (struct drm_device *dev) -{ -struct arcpgu_drm_private *arcpgu = dev->dev_private; - -drm_fbdev_cma_hotplug_event (arcpgu->fbdev); -} -static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = arcpgu_fb_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, };
@@ -51,13 +45,6 @@ static void arcpgu_setup_mode_config(struct drm_device *drm)DEFINE_DRM_GEM_CMA_FOPS (arcpgu_drm_ops); -static void arcpgu_lastclose (struct drm_device *drm) -{ -struct arcpgu_drm_private *arcpgu = drm->dev_private; - -drm_fbdev_cma_restore_mode (arcpgu->fbdev); -} -static int arcpgu_load (struct drm_device *drm) {struct platform_device *pdev =to_platform_device (drm->dev);
@@ -113,13 +100,9 @@ static int arcpgu_load(struct drm_device *drm)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - arcpgu->fbdev =drm_fbdev_cma_init (drm,16 , - drm->mode_config.num_connector); -if (IS_ERR (arcpgu->fbdev)) { - ret =PTR_ERR (arcpgu->fbdev); - arcpgu->fbdev =NULL ; -return -ENODEV ; - } + ret =drm_fb_cma_fbdev_init (drm,16 ,0 ); +if (ret) +return ret;platform_set_drvdata (pdev, drm);return 0 ;
@@ -127,12 +110,7 @@ static int arcpgu_load(struct drm_device *drm)static int arcpgu_unload (struct drm_device *drm) { -struct arcpgu_drm_private *arcpgu = drm->dev_private; - -if (arcpgu->fbdev) { -drm_fbdev_cma_fini (arcpgu->fbdev); - arcpgu->fbdev =NULL ; - } +drm_fb_cma_fbdev_fini (drm);drm_kms_helper_poll_fini (drm);drm_mode_config_cleanup (drm);
@@ -167,7 +145,7 @@ static int arcpgu_debugfs_init(struct drm_minor *minor)static struct drm_driver arcpgu_drm_driver = { .driver_features =DRIVER_MODESET |DRIVER_GEM |DRIVER_PRIME |DRIVER_ATOMIC , - .lastclose = arcpgu_lastclose, + .lastclose = drm_fb_helper_lastclose, .name ="arcpgu" , .desc ="ARC PGU Controller" , .date ="20160219" ,
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/11 drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()
In reply to Noralf TrønnesReplace driver's code with the generic helpers that do the same thing including the NULL check.
--- drivers/gpu/drm/arm/hdlcd_drv.c | 25 +++---------------------- drivers/gpu/drm/arm/hdlcd_drv.h | 1 - 2 files changed, 3 insertions(+), 23 deletions(-)
drivers/gpu/drm/arm/hdlcd_drv.c +3 -22
@@ -27,6 +27,7 @@#include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_modeset_helper.h> #include <drm/drm_of.h> #include "hdlcd_drv.h"
@@ -427,35 +428,15 @@ MODULE_DEVICE_TABLE(of, hdlcd_of_match);static int __maybe_unused hdlcd_pm_suspend (struct device *dev) {struct drm_device *drm =dev_get_drvdata (dev); -struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private :NULL ; -if (!hdlcd) -return 0 ; - -drm_kms_helper_poll_disable (drm); -drm_fbdev_cma_set_suspend_unlocked (hdlcd->fbdev,1 ); - - hdlcd->state =drm_atomic_helper_suspend (drm); -if (IS_ERR (hdlcd->state)) { -drm_fbdev_cma_set_suspend_unlocked (hdlcd->fbdev,0 ); -drm_kms_helper_poll_enable (drm); -return PTR_ERR (hdlcd->state); - } - -return 0 ; +return drm_mode_config_helper_suspend (drm); }static int __maybe_unused hdlcd_pm_resume (struct device *dev) {struct drm_device *drm =dev_get_drvdata (dev); -struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private :NULL ; -if (!hdlcd) -return 0 ; - -drm_atomic_helper_resume (drm, hdlcd->state); -drm_fbdev_cma_set_suspend_unlocked (hdlcd->fbdev,0 ); -drm_kms_helper_poll_enable (drm); +drm_mode_config_helper_resume (drm);return 0 ; }
drivers/gpu/drm/arm/hdlcd_drv.h +0 -1
@@ -12,7 +12,6 @@ struct hdlcd_drm_private {struct drm_fbdev_cma *fbdev;struct drm_crtc crtc;struct drm_plane *plane; -struct drm_atomic_state *state;#ifdef CONFIG_DEBUG_FS atomic_t buffer_underrun_count;atomic_t bus_error_count;
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 3/11 drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
--- drivers/gpu/drm/arm/hdlcd_drv.c | 37 ++++++------------------------------- drivers/gpu/drm/arm/hdlcd_drv.h | 1 - 2 files changed, 6 insertions(+), 32 deletions(-)
drivers/gpu/drm/arm/hdlcd_drv.c +6 -31
@@ -101,16 +101,9 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)return ret; } -static void hdlcd_fb_output_poll_changed (struct drm_device *drm) -{ -struct hdlcd_drm_private *hdlcd = drm->dev_private; - -drm_fbdev_cma_hotplug_event (hdlcd->fbdev); -} -static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = hdlcd_fb_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, };
@@ -125,13 +118,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm) drm->mode_config.funcs = &hdlcd_mode_config_funcs; } -static void hdlcd_lastclose (struct drm_device *drm) -{ -struct hdlcd_drm_private *hdlcd = drm->dev_private; - -drm_fbdev_cma_restore_mode (hdlcd->fbdev); -} -static irqreturn_t hdlcd_irq (int irq,void *arg) {struct drm_device *drm = arg;
@@ -247,7 +233,7 @@ static struct drm_driver hdlcd_driver = { .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = hdlcd_lastclose, + .lastclose = drm_fb_helper_lastclose, .irq_handler = hdlcd_irq, .irq_preinstall = hdlcd_irq_preinstall, .irq_postinstall = hdlcd_irq_postinstall,
@@ -322,14 +308,9 @@ static int hdlcd_drm_bind(struct device *dev)drm_mode_config_reset (drm);drm_kms_helper_poll_init (drm); - hdlcd->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_connector); - -if (IS_ERR (hdlcd->fbdev)) { - ret =PTR_ERR (hdlcd->fbdev); - hdlcd->fbdev =NULL ; + ret =drm_fb_cma_fbdev_init (drm,32 ,0 ); +if (ret) goto err_fbdev; - } ret =drm_dev_register (drm,0 );if (ret)
@@ -338,10 +319,7 @@ static int hdlcd_drm_bind(struct device *dev)return 0 ; err_register: -if (hdlcd->fbdev) { -drm_fbdev_cma_fini (hdlcd->fbdev); - hdlcd->fbdev =NULL ; - } +drm_fb_cma_fbdev_fini (drm); err_fbdev:drm_kms_helper_poll_fini (drm); err_vblank:
@@ -367,10 +345,7 @@ static void hdlcd_drm_unbind(struct device *dev)struct hdlcd_drm_private *hdlcd = drm->dev_private;drm_dev_unregister (drm); -if (hdlcd->fbdev) { -drm_fbdev_cma_fini (hdlcd->fbdev); - hdlcd->fbdev =NULL ; - } +drm_fb_cma_fbdev_fini (drm);drm_kms_helper_poll_fini (drm);component_unbind_all (dev, drm);of_node_put (hdlcd->crtc.port);
drivers/gpu/drm/arm/hdlcd_drv.h +0 -1
@@ -9,7 +9,6 @@struct hdlcd_drm_private {void __iomem *mmio;struct clk *clk; -struct drm_fbdev_cma *fbdev;struct drm_crtc crtc;struct drm_plane *plane;#ifdef CONFIG_DEBUG_FS
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 4/11 drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 ++++--------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 --- 2 files changed, 5 insertions(+), 34 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +5 -30
@@ -21,6 +21,7 @@#include <drm/drmP.h> #include <drm/drm_gem_cma_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_atomic_helper.h>
@@ -33,32 +34,17 @@ static struct kirin_dc_ops *dc_ops;static int kirin_drm_kms_cleanup (struct drm_device *dev) { -struct kirin_drm_private *priv = dev->dev_private; - -if (priv->fbdev) { -drm_fbdev_cma_fini (priv->fbdev); - priv->fbdev =NULL ; - } - +drm_fb_cma_fbdev_fini (dev);drm_kms_helper_poll_fini (dev); dc_ops->cleanup (to_platform_device (dev->dev));drm_mode_config_cleanup (dev); -devm_kfree (dev->dev, priv); - dev->dev_private =NULL ;return 0 ; } -static void kirin_fbdev_output_poll_changed (struct drm_device *dev) -{ -struct kirin_drm_private *priv = dev->dev_private; - -drm_fbdev_cma_hotplug_event (priv->fbdev); -} -static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { .fb_create = drm_gem_fb_create, - .output_poll_changed = kirin_fbdev_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, };
@@ -76,14 +62,8 @@ static void kirin_drm_mode_config_init(struct drm_device *dev)static int kirin_drm_kms_init (struct drm_device *dev) { -struct kirin_drm_private *priv;int ret; - priv =devm_kzalloc (dev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; - - dev->dev_private = priv;dev_set_drvdata (dev->dev, dev);/* dev->mode_config initialization */
@@ -117,12 +97,9 @@ static int kirin_drm_kms_init(struct drm_device *dev)/* init kms poll for handling hpd */ drm_kms_helper_poll_init (dev); - priv->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_connector); - -if (IS_ERR (priv->fbdev)) { + ret =drm_fb_cma_fbdev_init (dev,32 ,0 ); +if (ret) {DRM_ERROR ("failed to initialize fbdev.\n" ); - ret =PTR_ERR (priv->fbdev); goto err_cleanup_poll; }return 0 ;
@@ -135,8 +112,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) dc_ops->cleanup (to_platform_device (dev->dev)); err_mode_config_cleanup:drm_mode_config_cleanup (dev); -devm_kfree (dev->dev, priv); - dev->dev_private =NULL ;return ret; }
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +0 -4
@@ -19,10 +19,6 @@ struct kirin_dc_ops { void (*cleanup)(struct platform_device *pdev); }; -struct kirin_drm_private { -struct drm_fbdev_cma *fbdev; -}; -extern const struct kirin_dc_ops ade_dc_ops;#endif /* __KIRIN_DRM_DRV_H__ */
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 5/11 drm/meson: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
--- drivers/gpu/drm/meson/meson_drv.c | 20 +++++--------------- drivers/gpu/drm/meson/meson_drv.h | 1 - 2 files changed, 5 insertions(+), 16 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +5 -15
@@ -35,6 +35,7 @@#include <drm/drm_plane_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_rect.h> #include <drm/drm_fb_helper.h>
@@ -68,15 +69,8 @@* - Powering Up HDMI controller and PHY */ -static void meson_fb_output_poll_changed (struct drm_device *dev) -{ -struct meson_drm *priv = dev->dev_private; - -drm_fbdev_cma_hotplug_event (priv->fbdev); -} -static const struct drm_mode_config_funcs meson_mode_config_funcs = { - .output_poll_changed = meson_fb_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, .fb_create = drm_gem_fb_create,
@@ -263,12 +257,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)drm_mode_config_reset (drm); - priv->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_connector); -if (IS_ERR (priv->fbdev)) { - ret =PTR_ERR (priv->fbdev); + ret =drm_fb_cma_fbdev_init (drm,32 ,0 ); +if (ret) goto free_drm; - }drm_kms_helper_poll_init (drm);
@@ -294,11 +285,10 @@ static int meson_drv_bind(struct device *dev)static void meson_drv_unbind (struct device *dev) {struct drm_device *drm =dev_get_drvdata (dev); -struct meson_drm *priv = drm->dev_private;drm_dev_unregister (drm);drm_kms_helper_poll_fini (drm); -drm_fbdev_cma_fini (priv->fbdev); +drm_fb_cma_fbdev_fini (drm);drm_mode_config_cleanup (drm);drm_dev_unref (drm);
drivers/gpu/drm/meson/meson_drv.h +0 -1
@@ -33,7 +33,6 @@ struct meson_drm {struct drm_device *drm;struct drm_crtc *crtc; -struct drm_fbdev_cma *fbdev;struct drm_plane *primary_plane;/* Components Data */
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 6/11 drm/mxsfb: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 ++++----------------- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 - 2 files changed, 4 insertions(+), 18 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +4 -17
@@ -223,11 +223,8 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)drm_kms_helper_poll_init (drm); - mxsfb->fbdev =drm_fbdev_cma_init (drm,32 , - drm->mode_config.num_connector); -if (IS_ERR (mxsfb->fbdev)) { - ret =PTR_ERR (mxsfb->fbdev); - mxsfb->fbdev =NULL ; + ret =drm_fb_cma_fbdev_init (drm,32 ,0 ); +if (ret) {dev_err (drm->dev,"Failed to init FB CMA area\n" ); goto err_cma; }
@@ -250,10 +247,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)static void mxsfb_unload (struct drm_device *drm) { -struct mxsfb_drm_private *mxsfb = drm->dev_private; - -if (mxsfb->fbdev) -drm_fbdev_cma_fini (mxsfb->fbdev); +drm_fb_cma_fbdev_fini (drm);drm_kms_helper_poll_fini (drm);drm_mode_config_cleanup (drm);
@@ -267,13 +261,6 @@ static void mxsfb_unload(struct drm_device *drm)pm_runtime_disable (drm->dev); } -static void mxsfb_lastclose (struct drm_device *drm) -{ -struct mxsfb_drm_private *mxsfb = drm->dev_private; - -drm_fbdev_cma_restore_mode (mxsfb->fbdev); -} -static int mxsfb_enable_vblank (struct drm_device *drm,unsigned int crtc) {struct mxsfb_drm_private *mxsfb = drm->dev_private;
@@ -329,7 +316,7 @@ static struct drm_driver mxsfb_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET |DRIVER_PRIME |DRIVER_ATOMIC | DRIVER_HAVE_IRQ, - .lastclose = mxsfb_lastclose, + .lastclose = drm_fb_helper_lastclose, .irq_handler = mxsfb_irq_handler, .irq_preinstall = mxsfb_irq_preinstall, .irq_uninstall = mxsfb_irq_preinstall,
drivers/gpu/drm/mxsfb/mxsfb_drv.h +0 -1
@@ -37,7 +37,6 @@ struct mxsfb_drm_private {struct drm_simple_display_pipe pipe;struct drm_connector connector;struct drm_panel *panel; -struct drm_fbdev_cma *fbdev; };int mxsfb_setup_crtc (struct drm_device *dev);
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 7/11 drm/rcar-du: Use drm_mode_config_helper_suspend/resume()
In reply to Noralf TrønnesReplace driver's code with the generic helpers that do the same thing.
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++------------------ drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 - 2 files changed, 3 insertions(+), 19 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +3 -18
@@ -22,10 +22,10 @@#include <linux/wait.h> #include <drm/drmP.h> -#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> +#include <drm/drm_modeset_helper.h> #include "rcar_du_drv.h" #include "rcar_du_kms.h"
@@ -310,30 +310,15 @@ static struct drm_driver rcar_du_driver = {static int rcar_du_pm_suspend (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -struct drm_atomic_state *state; -drm_kms_helper_poll_disable (rcdu->ddev); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, true); - - state =drm_atomic_helper_suspend (rcdu->ddev); -if (IS_ERR (state)) { -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); -return PTR_ERR (state); - } - - rcdu->suspend_state = state; - -return 0 ; +return drm_mode_config_helper_suspend (rcdu->ddev); }static int rcar_du_pm_resume (struct device *dev) {struct rcar_du_device *rcdu =dev_get_drvdata (dev); -drm_atomic_helper_resume (rcdu->ddev, rcdu->suspend_state); -drm_fbdev_cma_set_suspend_unlocked (rcdu->fbdev, false); -drm_kms_helper_poll_enable (rcdu->ddev); +drm_mode_config_helper_resume (rcdu->ddev);return 0 ; }
drivers/gpu/drm/rcar-du/rcar_du_drv.h +0 -1
@@ -81,7 +81,6 @@ struct rcar_du_device {struct drm_device *ddev;struct drm_fbdev_cma *fbdev; -struct drm_atomic_state *suspend_state;struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS ];unsigned int num_crtcs;
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 8/11 drm/rcar-du: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 13 +++---------- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 2 -- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 20 +++++--------------- 3 files changed, 8 insertions(+), 27 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +3 -10
@@ -23,6 +23,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_modeset_helper.h>
@@ -269,19 +270,12 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table);* DRM operations */ -static void rcar_du_lastclose (struct drm_device *dev) -{ -struct rcar_du_device *rcdu = dev->dev_private; - -drm_fbdev_cma_restore_mode (rcdu->fbdev); -} -DEFINE_DRM_GEM_CMA_FOPS (rcar_du_fops);static struct drm_driver rcar_du_driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_ATOMIC , - .lastclose = rcar_du_lastclose, + .lastclose = drm_fb_helper_lastclose, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
@@ -339,8 +333,7 @@ static int rcar_du_remove(struct platform_device *pdev)drm_dev_unregister (ddev); -if (rcdu->fbdev) -drm_fbdev_cma_fini (rcdu->fbdev); +drm_fb_cma_fbdev_fini (ddev);drm_kms_helper_poll_fini (ddev);drm_mode_config_cleanup (ddev);
drivers/gpu/drm/rcar-du/rcar_du_drv.h +0 -2
@@ -24,7 +24,6 @@struct clk ;struct device ;struct drm_device ; -struct drm_fbdev_cma ;struct rcar_du_device ;struct rcar_du_lvdsenc ;
@@ -80,7 +79,6 @@ struct rcar_du_device {void __iomem *mmio;struct drm_device *ddev; -struct drm_fbdev_cma *fbdev;struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS ];unsigned int num_crtcs;
drivers/gpu/drm/rcar-du/rcar_du_kms.c +5 -15
@@ -16,6 +16,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
@@ -217,13 +218,6 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,return drm_gem_fb_create (dev, file_priv, mode_cmd); } -static void rcar_du_output_poll_changed (struct drm_device *dev) -{ -struct rcar_du_device *rcdu = dev->dev_private; - -drm_fbdev_cma_hotplug_event (rcdu->fbdev); -} -/* ----------------------------------------------------------------------------- * Atomic Check and Update */
@@ -278,7 +272,7 @@ static const struct drm_mode_config_helper_funcs rcar_du_mode_config_helper = {static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = { .fb_create = rcar_du_fb_create, - .output_poll_changed = rcar_du_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = rcar_du_atomic_check, .atomic_commit = drm_atomic_helper_commit, };
@@ -519,7 +513,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)struct drm_device *dev = rcdu->ddev;struct drm_encoder *encoder; -struct drm_fbdev_cma *fbdev;unsigned int num_encoders;unsigned int num_groups;unsigned int i;
@@ -629,12 +622,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)drm_kms_helper_poll_init (dev);if (dev->mode_config.num_connector) { - fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_connector); -if (IS_ERR (fbdev)) -return PTR_ERR (fbdev); - - rcdu->fbdev = fbdev; + ret =drm_fb_cma_fbdev_init (dev,32 ,0 ); +if (ret) +return ret; }else {dev_info (rcdu->dev,"no connector found, disabling fbdev emulation\n" );
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 9/11 drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
Remove console.h inclusion which was forgotten when converting to the suspend/resume helpers.
--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++-------------------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - 2 files changed, 6 insertions(+), 21 deletions(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +6 -20
@@ -11,7 +11,6 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/console.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/mm.h>
@@ -25,6 +24,7 @@#include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_modeset_helper.h>
@@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ); -if (IS_ERR (fsl_dev->fbdev)) { - ret =PTR_ERR (fsl_dev->fbdev); - fsl_dev->fbdev =NULL ; + ret =drm_fb_cma_fbdev_init (dev, legacyfb_depth,1 ); +if (ret) goto done; - }return 0 ; done:drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drm_irq_uninstall (dev);
@@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)static void fsl_dcu_unload (struct drm_device *dev) { -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; -drm_atomic_helper_shutdown (dev);drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drm_irq_uninstall (dev);
@@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)return IRQ_HANDLED ; } -static void fsl_dcu_drm_lastclose (struct drm_device *dev) -{ -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - -drm_fbdev_cma_restore_mode (fsl_dev->fbdev); -} -DEFINE_DRM_GEM_CMA_FOPS (fsl_dcu_drm_fops);static struct drm_driver fsl_dcu_drm_driver = { .driver_features =DRIVER_HAVE_IRQ |DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_ATOMIC , - .lastclose = fsl_dcu_drm_lastclose, + .lastclose = drm_fb_helper_lastclose, .load = fsl_dcu_load, .unload = fsl_dcu_unload, .irq_handler = fsl_dcu_drm_irq,
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +0 -1
@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {/*protects hardware register*/ spinlock_t irq_lock;struct drm_device *drm; -struct drm_fbdev_cma *fbdev;struct drm_crtc crtc;struct drm_encoder encoder;struct fsl_dcu_drm_connector connector;
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Stefan Agner
maintainerRe: [PATCH v3 09/11] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
Quoted 6 lines · Noralf Trønnes
Use
drm_fb_cma_fbdev_init()anddrm_fb_cma_fbdev_fini()which relies on the fact thatdrm_deviceholds a pointer to thedrm_fb_helperstructure. This means that the driver doesn't have to keep track of that. Also use thedrm_fb_helperfunctions directly.
Removeconsole.hinclusion which was forgotten when converting to the suspend/resume helpers.
Just realized this never made it upstream. I guess its still valid and could be applied?
--
Stefan
Quoted 97 lines
Cc Stefan Agner <[email protected]>Cc Alison Wang <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++-------------------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - 2 files changed, 6 insertions(+), 21 deletions(-)drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +4
-8@@ -11,7 +11,6 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/console.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/mm.h> @@ -25,6 +24,7 @@#include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_modeset_helper.h> @@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ); -if (IS_ERR (fsl_dev->fbdev)) { - ret =PTR_ERR (fsl_dev->fbdev); - fsl_dev->fbdev =NULL ; + ret =drm_fb_cma_fbdev_init (dev, legacyfb_depth,1 ); +if (ret) goto done; - }return 0 ; done:drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-4drm_irq_uninstall (dev);@@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)static void fsl_dcu_unload (struct drm_device *dev) { -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; -drm_atomic_helper_shutdown (dev);drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-8drm_irq_uninstall (dev);@@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)return IRQ_HANDLED ; } -static void fsl_dcu_drm_lastclose (struct drm_device *dev) -{ -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - -drm_fbdev_cma_restore_mode (fsl_dev->fbdev); -} -DEFINE_DRM_GEM_CMA_FOPS (fsl_dcu_drm_fops);static struct drm_driver fsl_dcu_drm_driver = { .driver_features =DRIVER_HAVE_IRQ |DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_ATOMIC , - .lastclose = fsl_dcu_drm_lastclose, + .lastclose = drm_fb_helper_lastclose, .load = fsl_dcu_load, .unload = fsl_dcu_unload, .irq_handler = fsl_dcu_drm_irq,drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +0
-0
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h struct fsl_dcu_drm_device { · line 196
Quoted 7 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +0
-1@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {/*protects hardware register*/ spinlock_t irq_lock;struct drm_device *drm; -struct drm_fbdev_cma *fbdev;struct drm_crtc crtc;struct drm_encoder encoder;struct fsl_dcu_drm_connector connector;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 09/11] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
Den 26.09.2018 22.26, skrev Stefan Agner:
Quoted 9 lines · Noralf Trønnes
Quoted 6 lines
Use
drm_fb_cma_fbdev_init()anddrm_fb_cma_fbdev_fini()which relies on the fact thatdrm_deviceholds a pointer to thedrm_fb_helperstructure. This means that the driver doesn't have to keep track of that. Also use thedrm_fb_helperfunctions directly.
Removeconsole.hinclusion which was forgotten when converting to the suspend/resume helpers.Just realized this never made it upstream. I guess its still valid and could be applied?
It has been superseeded by this patch:
[03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/patch/247865/
Noralf.
Quoted 98 lines
--
StefanQuoted 95 lines
Cc Stefan Agner <[email protected]>Cc Alison Wang <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++-------------------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - 2 files changed, 6 insertions(+), 21 deletions(-)drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +4
-8@@ -11,7 +11,6 @@#include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/console.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/mm.h> @@ -25,6 +24,7 @@#include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_modeset_helper.h> @@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth =24 ; } - fsl_dev->fbdev =drm_fbdev_cma_init (dev, legacyfb_depth,1 ); -if (IS_ERR (fsl_dev->fbdev)) { - ret =PTR_ERR (fsl_dev->fbdev); - fsl_dev->fbdev =NULL ; + ret =drm_fb_cma_fbdev_init (dev, legacyfb_depth,1 ); +if (ret) goto done; - }return 0 ; done:drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drm_irq_uninstall(dev);drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-4@@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)static void fsl_dcu_unload (struct drm_device *dev) { -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; -drm_atomic_helper_shutdown (dev);drm_kms_helper_poll_fini (dev); -if (fsl_dev->fbdev) -drm_fbdev_cma_fini (fsl_dev->fbdev); +drm_fb_cma_fbdev_fini (dev);drm_mode_config_cleanup (dev);drm_irq_uninstall(dev);drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +1
-8@@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)return IRQ_HANDLED ; } -static void fsl_dcu_drm_lastclose (struct drm_device *dev) -{ -struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - -drm_fbdev_cma_restore_mode (fsl_dev->fbdev); -} -DEFINE_DRM_GEM_CMA_FOPS (fsl_dcu_drm_fops);static struct drm_driver fsl_dcu_drm_driver = { .driver_features =DRIVER_HAVE_IRQ |DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME |DRIVER_ATOMIC , - .lastclose = fsl_dcu_drm_lastclose, + .lastclose = drm_fb_helper_lastclose, .load = fsl_dcu_load, .unload = fsl_dcu_unload, .irq_handler = fsl_dcu_drm_irq,drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +0
-0
Quoted 8 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h struct fsl_dcu_drm_device { · line 196
Quoted 8 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +0
-1@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {/*protects hardware register*/ spinlock_t irq_lock;struct drm_device *drm; -struct drm_fbdev_cma *fbdev;struct drm_crtc crtc;struct drm_encoder encoder;struct fsl_dcu_drm_connector connector;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 10/11 drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
In reply to Noralf TrønnesUse drm_fb_cma_fbdev_init_with_funcs() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.
Remove todo entry.
--- Documentation/gpu/todo.rst | 5 ---- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 37 ++++------------------------- drivers/gpu/drm/tinydrm/ili9225.c | 3 ++- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 ++- drivers/gpu/drm/tinydrm/st7586.c | 3 ++- include/drm/tinydrm/tinydrm.h | 3 --- 6 files changed, 11 insertions(+), 43 deletions(-)
Documentation/gpu/todo.rst +0 -5
@@ -395,11 +395,6 @@ those drivers as simple as possible, so lots of room for refactoring: one of the ideas for having a shared dsi/dbi helper, abstracting away the transport details more. -- tinydrm_lastclose could be drm_fb_helper_lastclose. Only thing we need - for that is to store the drm_fb_helper pointer somewhere in - drm_device->mode_config. And then we could roll that out to all the - drivers. - - tinydrm_gem_cma_prime_import_sg_table should probably go into the cma helpers, as a _vmapped variant (since not every driver needs the vmap). And tinydrm_gem_cma_free_object could the be merged into
drivers/gpu/drm/tinydrm/core/tinydrm-core.c +5 -32
@@ -10,6 +10,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/tinydrm/tinydrm.h> #include <linux/device.h>
@@ -35,23 +36,6 @@* and registers the DRM device using devm_tinydrm_register(). */ -/** -* tinydrm_lastclose - DRM lastclose helper -* @drm: DRM device -* -* This function ensures that fbdev is restored when drm_lastclose() is called -* on the last drm_release(). Drivers can use this as their -* &drm_driver->lastclose callback. -*/ -void tinydrm_lastclose (struct drm_device *drm) -{ -struct tinydrm_device *tdev = drm->dev_private; - -DRM_DEBUG_KMS ("\n" ); -drm_fbdev_cma_restore_mode (tdev->fbdev_cma); -} -EXPORT_SYMBOL (tinydrm_lastclose); -/** * tinydrm_gem_cma_prime_import_sg_table - Produce a CMA GEM object from * another driver's scatter/gather table of pinned pages
@@ -214,35 +198,24 @@ EXPORT_SYMBOL(devm_tinydrm_init);static int tinydrm_register (struct tinydrm_device *tdev) {struct drm_device *drm = tdev->drm; -int bpp = drm->mode_config.preferred_depth; -struct drm_fbdev_cma *fbdev;int ret; ret =drm_dev_register (tdev->drm,0 );if (ret)return ret; - fbdev =drm_fbdev_cma_init_with_funcs (drm, bpp ? bpp :32 , - drm->mode_config.num_connector, - tdev->fb_funcs); -if (IS_ERR (fbdev)) -DRM_ERROR ("Failed to initialize fbdev: %ld\n" ,PTR_ERR (fbdev)); -else - tdev->fbdev_cma = fbdev; + ret =drm_fb_cma_fbdev_init_with_funcs (drm,0 ,0 , tdev->fb_funcs); +if (ret) +DRM_ERROR ("Failed to initialize fbdev: %d\n" , ret);return 0 ; }static void tinydrm_unregister (struct tinydrm_device *tdev) { -struct drm_fbdev_cma *fbdev_cma = tdev->fbdev_cma; -drm_atomic_helper_shutdown (tdev->drm); -/* don't restore fbdev in lastclose, keep pipeline disabled */ - tdev->fbdev_cma =NULL ; +drm_fb_cma_fbdev_fini (tdev->drm);drm_dev_unregister (tdev->drm); -if (fbdev_cma) -drm_fbdev_cma_fini (fbdev_cma); }static void devm_tinydrm_register_release (void *data)
drivers/gpu/drm/tinydrm/ili9225.c +2 -1
@@ -20,6 +20,7 @@#include <linux/spi/spi.h> #include <video/mipi_display.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/tinydrm/mipi-dbi.h> #include <drm/tinydrm/tinydrm-helpers.h>
@@ -381,7 +382,7 @@ static struct drm_driver ili9225_driver = { DRIVER_ATOMIC, .fops = &ili9225_fops,TINYDRM_GEM_DRIVER_OPS , - .lastclose = tinydrm_lastclose, + .lastclose = drm_fb_helper_lastclose, .name = "ili9225", .desc = "Ilitek ILI9225", .date = "20171106",
drivers/gpu/drm/tinydrm/mi0283qt.c +2 -1
@@ -9,6 +9,7 @@* (at your option) any later version. */ +#include <drm/drm_fb_helper.h> #include <drm/drm_modeset_helper.h> #include <drm/tinydrm/ili9341.h> #include <drm/tinydrm/mipi-dbi.h>
@@ -140,7 +141,7 @@ static struct drm_driver mi0283qt_driver = { DRIVER_ATOMIC, .fops = &mi0283qt_fops,TINYDRM_GEM_DRIVER_OPS , - .lastclose = tinydrm_lastclose, + .lastclose = drm_fb_helper_lastclose, .debugfs_init = mipi_dbi_debugfs_init, .name = "mi0283qt", .desc = "Multi-Inno MI0283QT",
drivers/gpu/drm/tinydrm/st7586.c +2 -1
@@ -17,6 +17,7 @@#include <linux/spi/spi.h> #include <video/mipi_display.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/tinydrm/mipi-dbi.h> #include <drm/tinydrm/tinydrm-helpers.h>
@@ -320,7 +321,7 @@ static struct drm_driver st7586_driver = { DRIVER_ATOMIC, .fops = &st7586_fops,TINYDRM_GEM_DRIVER_OPS , - .lastclose = tinydrm_lastclose, + .lastclose = drm_fb_helper_lastclose, .debugfs_init = mipi_dbi_debugfs_init, .name = "st7586", .desc = "Sitronix ST7586",
include/drm/tinydrm/tinydrm.h +0 -3
@@ -19,14 +19,12 @@* @drm: DRM device * @pipe: Display pipe structure * @dirty_lock: Serializes framebuffer flushing -* @fbdev_cma: CMA fbdev structure * @fb_funcs: Framebuffer functions used when creating framebuffers */ struct tinydrm_device {struct drm_device *drm;struct drm_simple_display_pipe pipe;struct mutex dirty_lock; -struct drm_fbdev_cma *fbdev_cma;const struct drm_framebuffer_funcs *fb_funcs; };
@@ -80,7 +78,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe) .type = DRM_MODE_TYPE_DRIVER, \ .clock = 1 /* pass validation */ -void tinydrm_lastclose (struct drm_device *drm);void tinydrm_gem_cma_free_object (struct drm_gem_object *gem_obj);struct drm_gem_object * tinydrm_gem_cma_prime_import_sg_table(struct drm_device *drm,
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 10/11] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
Quoted 10 lines · Noralf Trønnes
Use
drm_fb_cma_fbdev_init_with_funcs()anddrm_fb_cma_fbdev_fini()which relies on the fact thatdrm_deviceholds a pointer to thedrm_fb_helperstructure. This means that the driver doesn't have to keep track of that. Also use thedrm_fb_helperfunctions directly.
Remove todo entry.Cc David Lechner <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Acked-by David Lechner <[email protected]>Acked-by Daniel Vetter <[email protected]>
Quoted 9 lines
--- Documentation/gpu/todo.rst | 5 ---- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 37 ++++------------------------- drivers/gpu/drm/tinydrm/ili9225.c | 3 ++- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 ++- drivers/gpu/drm/tinydrm/st7586.c | 3 ++- include/drm/tinydrm/tinydrm.h | 3 --- 6 files changed, 11 insertions(+), 43 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Noralf Trønnes
AppliedRe: [PATCH v3 10/11] drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
Den 08.12.2017 22.34, skrev David Lechner:
Quoted 22 lines · Noralf Trønnes
Quoted 18 lines
Use
drm_fb_cma_fbdev_init_with_funcs()anddrm_fb_cma_fbdev_fini()which relies on the fact thatdrm_deviceholds a pointer to thedrm_fb_helperstructure. This means that the driver doesn't have to keep track of that. Also use thedrm_fb_helperfunctions directly.
Remove todo entry.Cc David Lechner <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>Acked-by David Lechner <[email protected]>Acked-by Daniel Vetter <[email protected]>---
Documentation/gpu/todo.rst | 5 ----drivers/gpu/drm/tinydrm/core/tinydrm-core.c| 37
++++-------------------------
drivers/gpu/drm/tinydrm/ili9225.c | 3 ++- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 ++- drivers/gpu/drm/tinydrm/st7586.c | 3 ++- include/drm/tinydrm/tinydrm.h | 3 ---Quoted 2 lines
6 files changed, 11 insertions(+), 43 deletions(-)
Quoted 2 lines
Tested-by David Lechner <[email protected]>
Thanks, applied to drm-misc.
Noralf.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 11/11 drm/cma-helper: Remove drm_fbdev_cma* functions
In reply to Noralf TrønnesRemove the unused struct drm_fbdev_cma functions.
--- drivers/gpu/drm/drm_fb_cma_helper.c | 158 ------------------------------------ include/drm/drm_fb_cma_helper.h | 28 +------ 2 files changed, 3 insertions(+), 183 deletions(-)
drivers/gpu/drm/drm_fb_cma_helper.c +0 -158
@@ -389,161 +389,3 @@ void drm_fb_cma_fbdev_fini(struct drm_device *dev)kfree (to_fbdev_cma (fb_helper)); }EXPORT_SYMBOL_GPL (drm_fb_cma_fbdev_fini); - -/** -* drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct -* @dev: DRM device -* @preferred_bpp: Preferred bits per pixel for the device -* @max_conn_count: Maximum number of connectors -* @funcs: fb helper functions, in particular a custom dirty() callback -* -* Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. -*/ -struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int max_conn_count, -const struct drm_framebuffer_funcs *funcs) -{ -struct drm_fbdev_cma *fbdev_cma; -struct drm_fb_helper *helper; -int ret; - - fbdev_cma =kzalloc (sizeof (*fbdev_cma),GFP_KERNEL ); -if (!fbdev_cma) { -dev_err (dev->dev,"Failed to allocate drm fbdev.\n" ); -return ERR_PTR (-ENOMEM ); - } - fbdev_cma->fb_funcs = funcs; - - helper = &fbdev_cma->fb_helper; - -drm_fb_helper_prepare (dev, helper, &drm_fb_cma_helper_funcs); - - ret =drm_fb_helper_init (dev, helper, max_conn_count); -if (ret <0 ) { -dev_err (dev->dev,"Failed to initialize drm fb helper.\n" ); - goto err_free; - } - - ret =drm_fb_helper_single_add_all_connectors (helper); -if (ret <0 ) { -dev_err (dev->dev,"Failed to add connectors.\n" ); - goto err_drm_fb_helper_fini; - - } - - ret =drm_fb_helper_initial_config (helper, preferred_bpp); -if (ret <0 ) { -dev_err (dev->dev,"Failed to set initial hw configuration.\n" ); - goto err_drm_fb_helper_fini; - } - -return fbdev_cma; - -err_drm_fb_helper_fini: -drm_fb_helper_fini (helper); -err_free: -kfree (fbdev_cma); - -return ERR_PTR (ret); -} -EXPORT_SYMBOL_GPL (drm_fbdev_cma_init_with_funcs); - -static const struct drm_framebuffer_funcs drm_fb_cma_funcs = { - .destroy = drm_gem_fb_destroy, - .create_handle = drm_gem_fb_create_handle, -}; - -/** -* drm_fbdev_cma_init() - Allocate and initializes a drm_fbdev_cma struct -* @dev: DRM device -* @preferred_bpp: Preferred bits per pixel for the device -* @max_conn_count: Maximum number of connectors -* -* Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. -*/ -struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int max_conn_count) -{ -return drm_fbdev_cma_init_with_funcs (dev, preferred_bpp, - max_conn_count, - &drm_fb_cma_funcs); -} -EXPORT_SYMBOL_GPL (drm_fbdev_cma_init); - -/** -* drm_fbdev_cma_fini() - Free drm_fbdev_cma struct -* @fbdev_cma: The drm_fbdev_cma struct -*/ -void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma) -{ -drm_fb_helper_unregister_fbi (&fbdev_cma->fb_helper); -if (fbdev_cma->fb_helper.fbdev) -drm_fbdev_cma_defio_fini (fbdev_cma->fb_helper.fbdev); - -if (fbdev_cma->fb_helper.fb) -drm_framebuffer_remove (fbdev_cma->fb_helper.fb); - -drm_fb_helper_fini (&fbdev_cma->fb_helper); -kfree (fbdev_cma); -} -EXPORT_SYMBOL_GPL (drm_fbdev_cma_fini); - -/** -* drm_fbdev_cma_restore_mode() - Restores initial framebuffer mode -* @fbdev_cma: The drm_fbdev_cma struct, may be NULL -* -* This function is usually called from the &drm_driver.lastclose callback. -*/ -void drm_fbdev_cma_restore_mode (struct drm_fbdev_cma *fbdev_cma) -{ -if (fbdev_cma) -drm_fb_helper_restore_fbdev_mode_unlocked (&fbdev_cma->fb_helper); -} -EXPORT_SYMBOL_GPL (drm_fbdev_cma_restore_mode); - -/** -* drm_fbdev_cma_hotplug_event() - Poll for hotpulug events -* @fbdev_cma: The drm_fbdev_cma struct, may be NULL -* -* This function is usually called from the &drm_mode_config.output_poll_changed -* callback. -*/ -void drm_fbdev_cma_hotplug_event (struct drm_fbdev_cma *fbdev_cma) -{ -if (fbdev_cma) -drm_fb_helper_hotplug_event (&fbdev_cma->fb_helper); -} -EXPORT_SYMBOL_GPL (drm_fbdev_cma_hotplug_event); - -/** -* drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend -* @fbdev_cma: The drm_fbdev_cma struct, may be NULL -* @state: desired state, zero to resume, non-zero to suspend -* -* Calls drm_fb_helper_set_suspend, which is a wrapper around -* fb_set_suspend implemented by fbdev core. -*/ -void drm_fbdev_cma_set_suspend (struct drm_fbdev_cma *fbdev_cma,bool state) -{ -if (fbdev_cma) -drm_fb_helper_set_suspend (&fbdev_cma->fb_helper, state); -} -EXPORT_SYMBOL (drm_fbdev_cma_set_suspend); - -/** -* drm_fbdev_cma_set_suspend_unlocked - wrapper around -* drm_fb_helper_set_suspend_unlocked -* @fbdev_cma: The drm_fbdev_cma struct, may be NULL -* @state: desired state, zero to resume, non-zero to suspend -* -* Calls drm_fb_helper_set_suspend, which is a wrapper around -* fb_set_suspend implemented by fbdev core. -*/ -void drm_fbdev_cma_set_suspend_unlocked (struct drm_fbdev_cma *fbdev_cma, -bool state) -{ -if (fbdev_cma) -drm_fb_helper_set_suspend_unlocked (&fbdev_cma->fb_helper, - state); -} -EXPORT_SYMBOL (drm_fbdev_cma_set_suspend_unlocked);
include/drm/drm_fb_cma_helper.h +3 -25
@@ -2,18 +2,10 @@#ifndef __DRM_FB_CMA_HELPER_H__#define __DRM_FB_CMA_HELPER_H__ -struct drm_fbdev_cma ; -struct drm_gem_cma_object ; - -struct drm_fb_helper_surface_size ; -struct drm_framebuffer_funcs ; -struct drm_fb_helper_funcs ; -struct drm_framebuffer ; -struct drm_fb_helper ;struct drm_device ; -struct drm_file ; -struct drm_mode_fb_cmd2 ; -struct drm_plane ; +struct drm_framebuffer ; +struct drm_framebuffer_funcs ; +struct drm_gem_cma_object ;struct drm_plane_state ; int drm_fb_cma_fbdev_init_with_funcs(struct drm_device *dev,
@@ -23,19 +15,6 @@ int drm_fb_cma_fbdev_init(struct drm_device *dev, unsigned int preferred_bpp, unsigned int max_conn_count);void drm_fb_cma_fbdev_fini (struct drm_device *dev); -struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int max_conn_count, -const struct drm_framebuffer_funcs *funcs); -struct drm_fbdev_cma *drm_fbdev_cma_init (struct drm_device *dev, -unsigned int preferred_bpp,unsigned int max_conn_count); -void drm_fbdev_cma_fini (struct drm_fbdev_cma *fbdev_cma); - -void drm_fbdev_cma_restore_mode (struct drm_fbdev_cma *fbdev_cma); -void drm_fbdev_cma_hotplug_event (struct drm_fbdev_cma *fbdev_cma); -void drm_fbdev_cma_set_suspend (struct drm_fbdev_cma *fbdev_cma,bool state); -void drm_fbdev_cma_set_suspend_unlocked (struct drm_fbdev_cma *fbdev_cma, -bool state); -struct drm_gem_cma_object *drm_fb_cma_get_gem_obj (struct drm_framebuffer *fb,unsigned int plane);
@@ -44,4 +23,3 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, unsigned int plane);#endif -
Signature · 6 lines
2.14.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 08.12.2017 20.37, skrev Noralf Trønnes:
Quoted 7 lines
These are the remaining patches not applied due to missing review and:
- arm/hdlcd and rcar-du have started to usedrm_fbdev_cma_set_suspend_unlocked()since last, so I have added patches converting them to drm_mode_config_helper_suspend/resume().
- tinydrm has gained a new driver ili9225Noralf.
Just a note that this series has been superseeded by the generic fbdev work. During Christmas I got the idea that maybe it was possible to do generic fbdev using dumb buffers. A prototype for this was done in one day, but it took months before it was mergeable due to a drm_client API that had to be made.
So this is the superseeding series based on the generic fbdev work:
drm/cma-helper drivers: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/series/49382/
Noralf.
Quoted 30 lines
Noralf Trønnes (11):
drm/arc: Use drm_fb_cma_fbdev_init/fini() drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume() drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini() drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini() drm/meson: Use drm_fb_cma_fbdev_init/fini() drm/mxsfb: Use drm_fb_cma_fbdev_init/fini() drm/rcar-du: Use drm_mode_config_helper_suspend/resume() drm/rcar-du: Use drm_fb_cma_fbdev_init/fini() drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini() drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini() drm/cma-helper: Remove drm_fbdev_cma* functionsDocumentation/gpu/todo.rst | 5 - drivers/gpu/drm/arc/arcpgu.h | 4 - drivers/gpu/drm/arc/arcpgu_drv.c | 36 ++---- drivers/gpu/drm/arm/hdlcd_drv.c | 62 ++-------- drivers/gpu/drm/arm/hdlcd_drv.h | 2 - drivers/gpu/drm/drm_fb_cma_helper.c | 158 ------------------------ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 +--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 +----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 - drivers/gpu/drm/meson/meson_drv.c | 20 +-- drivers/gpu/drm/meson/meson_drv.h | 1 - drivers/gpu/drm/mxsfb/mxsfb_drv.c | 21 +--- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 - drivers/gpu/drm/rcar-du/rcar_du_drv.c | 34 +---- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 3 -
Quoted 9 lines
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 20 +-- drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 37 +----- drivers/gpu/drm/tinydrm/ili9225.c | 3 +- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 +- drivers/gpu/drm/tinydrm/st7586.c | 3 +- include/drm/drm_fb_cma_helper.h | 28 +---- include/drm/tinydrm/tinydrm.h | 3 - 23 files changed, 61 insertions(+), 449 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel