Message ID | a3bfddd9-1a1c-ab3d-2e73-e77c714a806d@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 <shawn.guo@linaro.org> > > > > 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 <laurent.pinchart@ideasonboard.com> to the patch.
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 <shawn.guo@linaro.org> > > > > > > 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 <laurent.pinchart@ideasonboard.com> To simplify the flow a bit I've pushed this into drm-misc-next, with Tomi's ack. -Daniel
From b03a468fdaf2b329a940f3980871c27bd8d0caa6 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen <tomi.valkeinen@ti.com> 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 <tomi.valkeinen@ti.com> --- 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(&priv->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(&priv->wait_lock, flags); @@ -126,16 +127,17 @@ int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe) * a hardware vblank counter, this routine should be a no-op, since * interrupts will have to stay on to keep the count accurate. */ -void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe) +void omap_irq_disable_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(&priv->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(&priv->wait_lock, flags); } -- 2.7.4