From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomi Valkeinen Subject: Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Date: Wed, 8 Feb 2017 13:30:51 +0200 Message-ID: References: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0337223214==" Return-path: Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 165E36E841 for ; Wed, 8 Feb 2017 11:31:47 +0000 (UTC) In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Shawn Guo , Daniel Vetter Cc: Neil Armstrong , Liviu Dudau , Laurent Pinchart , Daniel Vetter , Marek Vasut , Alexey Brodkin , Russell King , Xinliang Liu , Mali DP Maintainers , Ben Skeggs , Jyri Sarha , dri-devel@lists.freedesktop.org, Maxime Ripard List-Id: dri-devel@lists.freedesktop.org --===============0337223214== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nxddS6KuLCelvvesbcdHOrlXS850SGx6k" --nxddS6KuLCelvvesbcdHOrlXS850SGx6k Content-Type: multipart/mixed; boundary="O2oMLvOHjPASEQJrpSCsiNtmghQp7u864"; protected-headers="v1" From: Tomi Valkeinen To: Shawn Guo , Daniel Vetter Cc: Alexey Brodkin , Liviu Dudau , Mali DP Maintainers , Russell King , Boris Brezillon , Inki Dae , Stefan Agner , Xinliang Liu , Daniel Vetter , Philipp Zabel , CK Hu , Neil Armstrong , Rob Clark , Marek Vasut , Ben Skeggs , Laurent Pinchart , Mark Yao , Benjamin Gaignard , Maxime Ripard , Jyri Sarha , Eric Anholt , Thierry Reding , David Airlie , dri-devel@lists.freedesktop.org, Shawn Guo Message-ID: Subject: Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs References: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> --O2oMLvOHjPASEQJrpSCsiNtmghQp7u864 Content-Type: multipart/mixed; boundary="------------8D37379FCCBA85B925651AB9" This is a multi-part message in MIME format. --------------8D37379FCCBA85B925651AB9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, On 07/02/17 11:16, Shawn Guo wrote: > From: Shawn Guo >=20 > 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 fallbac= k > in the wrapper function. >=20 > Patch #2 and #3 unexport function drm_vblank_no_hw_counter() by cleanin= g > up its use, since it's already the default implememention for > .get_vblank_counter hook anyway. >=20 > 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 showin= g > how driver code can be cleaned up with these new hooks. >=20 > 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 --------------8D37379FCCBA85B925651AB9 Content-Type: text/x-diff; name="0001-drm-omap-use-vblank-hooks-in-struct-drm_crtc_funcs.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-drm-omap-use-vblank-hooks-in-struct-drm_crtc_funcs.patc"; filename*1="h" =46rom 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/omapdr= m/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 =3D= { .atomic_destroy_state =3D drm_atomic_helper_crtc_destroy_state, .atomic_set_property =3D omap_crtc_atomic_set_property, .atomic_get_property =3D omap_crtc_atomic_get_property, + .enable_vblank =3D omap_irq_enable_vblank, + .disable_vblank =3D omap_irq_disable_vblank, }; =20 static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs =3D { 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 =3D { DRIVER_ATOMIC, .open =3D dev_open, .lastclose =3D dev_lastclose, - .enable_vblank =3D omap_irq_enable_vblank, - .disable_vblank =3D omap_irq_disable_vblank, #ifdef CONFIG_DEBUG_FS .debugfs_init =3D omap_debugfs_init, .debugfs_cleanup =3D 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 =20 -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); =20 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 om= ap_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 =3D crtc->dev; struct omap_drm_private *priv =3D dev->dev_private; - struct drm_crtc *crtc =3D priv->crtcs[pipe]; unsigned long flags; + enum omap_channel channel =3D omap_crtc_channel(crtc); =20 - DBG("dev=3D%p, crtc=3D%u", dev, pipe); + DBG("dev=3D%p, crtc=3D%u", dev, channel); =20 spin_lock_irqsave(&priv->wait_lock, flags); - priv->irq_mask |=3D dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc)); + priv->irq_mask |=3D dispc_mgr_get_vsync_irq(channel); omap_irq_update(dev); spin_unlock_irqrestore(&priv->wait_lock, flags); =20 @@ -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 =3D crtc->dev; struct omap_drm_private *priv =3D dev->dev_private; - struct drm_crtc *crtc =3D priv->crtcs[pipe]; unsigned long flags; + enum omap_channel channel =3D omap_crtc_channel(crtc); =20 - DBG("dev=3D%p, crtc=3D%u", dev, pipe); + DBG("dev=3D%p, crtc=3D%u", dev, channel); =20 spin_lock_irqsave(&priv->wait_lock, flags); - priv->irq_mask &=3D ~dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc)); + priv->irq_mask &=3D ~dispc_mgr_get_vsync_irq(channel); omap_irq_update(dev); spin_unlock_irqrestore(&priv->wait_lock, flags); } --=20 2.7.4 --------------8D37379FCCBA85B925651AB9-- --O2oMLvOHjPASEQJrpSCsiNtmghQp7u864-- --nxddS6KuLCelvvesbcdHOrlXS850SGx6k Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYmwFrAAoJEPo9qoy8lh71J10P/2CuER4VP+ivPdAv5M+BmYnL q+3dutTTrDQTSE5o+eAG3+BdC660xVlIYJ4DBGouVh4lWAWok2Dlb6Pwy8pb6Cvx vuF+31+VCkHeuIZBp9/BEmkgvbShYXY5Sw9AGbi0u4F7uA/S8rBtq70GESB9CvOY xaNxOqyYxA8JlMrVhKW3vdBxs+F7402aF1tt83kXBq9tyols07vRYmylDySYfvY4 v5Of4FDnPuAKiNIsY5L9MEp8lLhyMd2LR5q3JrP9S2gT9H/BqK1rNWXjjzsmYu03 84o8v1q8xItobjPoMAxh15B0Ys5cLy7P+ICAYMf5zcp3tU8qhPLIHQbpsRUbQ5Ag i4xPx2uZbXVT20mXRJgHfUa2giGP6wRThKQTm2XCjMuFzTyPWIaqSbo4LgQhmkqw aYqPuJN5q7wInYohGrbnJCRwUjW3tYwJO6/pOYRmX771mTvDtl7i160qhzg6XD3E KnqdrLbOZa8vQ89u1VjL2lILgkkHwMvNubjWF4XXFGhLAVksUNhVcmF5M8Auv+bk HmCTFG7nTUHj7Kaidd7bSXXz4K0eaNMfjZUbSV3JwhinDylFFtq7San+B2T+of6P Rqve6Y5hCWf6NdA5BEHhh0tJsk3H0JZSW43SJ6fQ0/y6UDHSKJER/A3/5RuuKVUj U/JcbY0Kqm7c7J00mOAx =bmCn -----END PGP SIGNATURE----- --nxddS6KuLCelvvesbcdHOrlXS850SGx6k-- --===============0337223214== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0337223214==--