Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
On Wed, Feb 08, 2017 at 10:49:57AM -0500, Sean Paul wrote: > On Tue, Feb 07, 2017 at 05:16:12PM +0800, Shawn Guo wrote: > > From: Shawn Guo> > > > The vblank is mostly CRTC specific and implemented as part of CRTC > > driver. The first patch adds 3 vblank core<->driver hooks into struct > > drm_crtc_funcs, and plug them into core by adding wrapper functions for > > vblank handling code. We effectively make the .get_vblank_counter hook > > optional by providing drm_vblank_no_hw_counter() as the default fallback > > in the wrapper function. > > > > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleaning > > up its use, since it's already the default implememention for > > .get_vblank_counter hook anyway. > > > > The rest of the series is trying to do a massive conversion to the new > > hooks for DRIVER_MODESET drivers. But it only handles low-hanging > > fruit, and leaves out the ones that need a bit surgery, like gma500, > > i915, msm etc. Most of conversion get done by simply moving code and > > making functions static, but imx and rockchip are great examples showing > > how driver code can be cleaned up with these new hooks. > > > > Hi Shawn, > Thanks for the cleanup, it looks great! Let's soak this on the list until next > week, if there are no objections from driver maintainers, I'll merge it to > -misc. As suggested by Daniel, I pushed another 11 patches which have already received Reviewed-by or Acked-by to branch drm-misc-next. That leaves the last 3 flowing around, i.e. kirin, mediatek and qxl. So the drm-misc committer flow works for me \o/ Shawn ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
On Wed, Feb 08, 2017 at 08:10:04PM +0200, Laurent Pinchart wrote: > Hi Tomi, > > On Wednesday 08 Feb 2017 13:30:51 Tomi Valkeinen wrote: > > On 07/02/17 11:16, Shawn Guo wrote: > > > From: Shawn Guo> > > > > > The vblank is mostly CRTC specific and implemented as part of CRTC > > > driver. The first patch adds 3 vblank core<->driver hooks into struct > > > drm_crtc_funcs, and plug them into core by adding wrapper functions for > > > vblank handling code. We effectively make the .get_vblank_counter hook > > > optional by providing drm_vblank_no_hw_counter() as the default fallback > > > in the wrapper function. > > > > > > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleaning > > > up its use, since it's already the default implememention for > > > .get_vblank_counter hook anyway. > > > > > > The rest of the series is trying to do a massive conversion to the new > > > hooks for DRIVER_MODESET drivers. But it only handles low-hanging > > > fruit, and leaves out the ones that need a bit surgery, like gma500, > > > i915, msm etc. Most of conversion get done by simply moving code and > > > making functions static, but imx and rockchip are great examples showing > > > how driver code can be cleaned up with these new hooks. > > > > > > The series is generated against branch drm-next. > > > > Thanks for the series. I've attached a patch for omapdrm, in case you're > > sending v4 and want to include it in the series. > > You can add my > > Reviewed-by: Laurent Pinchart To simplify the flow a bit I've pushed this into drm-misc-next, with Tomi's ack. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
Hi Tomi, On Wednesday 08 Feb 2017 13:30:51 Tomi Valkeinen wrote: > On 07/02/17 11:16, Shawn Guo wrote: > > From: Shawn Guo> > > > The vblank is mostly CRTC specific and implemented as part of CRTC > > driver. The first patch adds 3 vblank core<->driver hooks into struct > > drm_crtc_funcs, and plug them into core by adding wrapper functions for > > vblank handling code. We effectively make the .get_vblank_counter hook > > optional by providing drm_vblank_no_hw_counter() as the default fallback > > in the wrapper function. > > > > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleaning > > up its use, since it's already the default implememention for > > .get_vblank_counter hook anyway. > > > > The rest of the series is trying to do a massive conversion to the new > > hooks for DRIVER_MODESET drivers. But it only handles low-hanging > > fruit, and leaves out the ones that need a bit surgery, like gma500, > > i915, msm etc. Most of conversion get done by simply moving code and > > making functions static, but imx and rockchip are great examples showing > > how driver code can be cleaned up with these new hooks. > > > > The series is generated against branch drm-next. > > Thanks for the series. I've attached a patch for omapdrm, in case you're > sending v4 and want to include it in the series. You can add my Reviewed-by: Laurent Pinchart to the patch. -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
On Tue, Feb 07, 2017 at 05:16:12PM +0800, Shawn Guo wrote: > From: Shawn Guo> > The vblank is mostly CRTC specific and implemented as part of CRTC > driver. The first patch adds 3 vblank core<->driver hooks into struct > drm_crtc_funcs, and plug them into core by adding wrapper functions for > vblank handling code. We effectively make the .get_vblank_counter hook > optional by providing drm_vblank_no_hw_counter() as the default fallback > in the wrapper function. > > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleaning > up its use, since it's already the default implememention for > .get_vblank_counter hook anyway. > > The rest of the series is trying to do a massive conversion to the new > hooks for DRIVER_MODESET drivers. But it only handles low-hanging > fruit, and leaves out the ones that need a bit surgery, like gma500, > i915, msm etc. Most of conversion get done by simply moving code and > making functions static, but imx and rockchip are great examples showing > how driver code can be cleaned up with these new hooks. > Hi Shawn, Thanks for the cleanup, it looks great! Let's soak this on the list until next week, if there are no objections from driver maintainers, I'll merge it to -misc. Sean > The series is generated against branch drm-next. > > Changes for v3: > - Let drm_vblank_no_hw_counter() be the last fallback for >.get_vblank_counter() hook. > - Improve the kernel-doc for .get_vblank_counter() hook. > - Convert more DRIVER_MODESET drivers to new hooks. > > Changes for v2: > - Wrap around core vblank handling code to save >drm_crtc_enable[disable]_vblank() helpers > - Add .get_vblank_counter to struct drm_crtc_funcs > - Add some comments to link between two sets of hooks > - Add one hdlcd driver patch for example > > Shawn Guo (23): > drm: add vblank hooks to struct drm_crtc_funcs > drm: remove drm_vblank_no_hw_counter assignment from driver code > drm: unexport function drm_vblank_no_hw_counter() > drm: hdlcd: use vblank hooks in struct drm_crtc_funcs > drm: malidp: use vblank hooks in struct drm_crtc_funcs > drm: armada: use vblank hooks in struct drm_crtc_funcs > drm: atmel: use vblank hooks in struct drm_crtc_funcs > drm: exynos: use vblank hooks in struct drm_crtc_funcs > drm: fsl-dcu: use vblank hooks in struct drm_crtc_funcs > drm: hibmc: use vblank hooks in struct drm_crtc_funcs > drm: kirin: use vblank hooks in struct drm_crtc_funcs > drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs > drm: mediatek: use vblank hooks in struct drm_crtc_funcs > drm: meson: use vblank hooks in struct drm_crtc_funcs > drm: qxl: use vblank hooks in struct drm_crtc_funcs > drm: rcar-du: use vblank hooks in struct drm_crtc_funcs > drm: rockchip: remove struct rockchip_crtc_funcs > drm: shmobile: use vblank hooks in struct drm_crtc_funcs > drm: sun4i: use vblank hooks in struct drm_crtc_funcs > drm: tegra: use vblank hooks in struct drm_crtc_funcs > drm: tilcdc: use vblank hooks in struct drm_crtc_funcs > drm: vc4: use vblank hooks in struct drm_crtc_funcs > drm: zte: use vblank hooks in struct drm_crtc_funcs > > drivers/gpu/drm/arc/arcpgu_drv.c| 1 - > drivers/gpu/drm/arm/hdlcd_crtc.c| 20 + > drivers/gpu/drm/arm/hdlcd_drv.c | 21 - > drivers/gpu/drm/arm/malidp_crtc.c | 21 + > drivers/gpu/drm/arm/malidp_drv.c| 22 - > drivers/gpu/drm/armada/armada_crtc.c| 56 - > drivers/gpu/drm/armada/armada_crtc.h| 2 - > drivers/gpu/drm/armada/armada_drv.c | 17 > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 21 + > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c| 22 - > drivers/gpu/drm/drm_irq.c | 81 +-- > drivers/gpu/drm/exynos/exynos_drm_crtc.c| 40 +- > drivers/gpu/drm/exynos/exynos_drm_crtc.h| 2 - > drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 - > drivers/gpu/drm/exynos/exynos_drm_drv.h | 8 -- > drivers/gpu/drm/exynos/exynos_hdmi.c| 7 +- > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 26 ++ > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 -- > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 20 + > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 23 -- > drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +-- > drivers/gpu/drm/i915/i915_irq.c | 1 - > drivers/gpu/drm/imx/imx-drm-core.c | 102 > > drivers/gpu/drm/imx/imx-drm.h | 13 --- > drivers/gpu/drm/imx/ipuv3-crtc.c| 58 +- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 +- > drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 2 - > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 - >
Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
Hi, On 07/02/17 11:16, Shawn Guo wrote: > From: Shawn Guo> > The vblank is mostly CRTC specific and implemented as part of CRTC > driver. The first patch adds 3 vblank core<->driver hooks into struct > drm_crtc_funcs, and plug them into core by adding wrapper functions for > vblank handling code. We effectively make the .get_vblank_counter hook > optional by providing drm_vblank_no_hw_counter() as the default fallback > in the wrapper function. > > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleaning > up its use, since it's already the default implememention for > .get_vblank_counter hook anyway. > > The rest of the series is trying to do a massive conversion to the new > hooks for DRIVER_MODESET drivers. But it only handles low-hanging > fruit, and leaves out the ones that need a bit surgery, like gma500, > i915, msm etc. Most of conversion get done by simply moving code and > making functions static, but imx and rockchip are great examples showing > how driver code can be cleaned up with these new hooks. > > The series is generated against branch drm-next. Thanks for the series. I've attached a patch for omapdrm, in case you're sending v4 and want to include it in the series. Tomi From b03a468fdaf2b329a940f3980871c27bd8d0caa6 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 8 Feb 2017 13:26:00 +0200 Subject: [PATCH] drm/omap: use vblank hooks in struct drm_crtc_funcs The vblank hooks in struct drm_driver are deprecated and only meant for legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks in struct drm_crtc_funcs should be used instead. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 2 ++ drivers/gpu/drm/omapdrm/omap_drv.c | 2 -- drivers/gpu/drm/omapdrm/omap_drv.h | 4 ++-- drivers/gpu/drm/omapdrm/omap_irq.c | 18 ++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index b68c70eb395f..2fe735c269fc 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -495,6 +495,8 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = omap_crtc_atomic_set_property, .atomic_get_property = omap_crtc_atomic_get_property, + .enable_vblank = omap_irq_enable_vblank, + .disable_vblank = omap_irq_disable_vblank, }; static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index a6d05e82db10..92d2f87fed5f 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -727,8 +727,6 @@ static struct drm_driver omap_drm_driver = { DRIVER_ATOMIC, .open = dev_open, .lastclose = dev_lastclose, - .enable_vblank = omap_irq_enable_vblank, - .disable_vblank = omap_irq_disable_vblank, #ifdef CONFIG_DEBUG_FS .debugfs_init = omap_debugfs_init, .debugfs_cleanup = omap_debugfs_cleanup, diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index b20377efd01b..3c13dc451ab4 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -113,8 +113,8 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); int omap_gem_resume(struct device *dev); #endif -int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe); -void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe); +int omap_irq_enable_vblank(struct drm_crtc *crtc); +void omap_irq_disable_vblank(struct drm_crtc *crtc); void omap_drm_irq_uninstall(struct drm_device *dev); int omap_drm_irq_install(struct drm_device *dev); diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c index 9adfa7c99695..59f21add6f19 100644 --- a/drivers/gpu/drm/omapdrm/omap_irq.c +++ b/drivers/gpu/drm/omapdrm/omap_irq.c @@ -101,16 +101,17 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, * Zero on success, appropriate errno if the given @crtc's vblank * interrupt cannot be enabled. */ -int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe) +int omap_irq_enable_vblank(struct drm_crtc *crtc) { + struct drm_device *dev = crtc->dev; struct omap_drm_private *priv = dev->dev_private; - struct drm_crtc *crtc = priv->crtcs[pipe]; unsigned long flags; + enum omap_channel channel = omap_crtc_channel(crtc); - DBG("dev=%p, crtc=%u", dev, pipe); + DBG("dev=%p, crtc=%u", dev, channel); spin_lock_irqsave(>wait_lock, flags); - priv->irq_mask |= dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc)); + priv->irq_mask |= dispc_mgr_get_vsync_irq(channel); omap_irq_update(dev); spin_unlock_irqrestore(>wait_lock, flags); @@ -126,16 +127,17 @@ int omap_irq_enable_vblank(struct drm_device *dev, unsigned