All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
@ 2017-02-07  9:16 Shawn Guo
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
                   ` (24 more replies)
  0 siblings, 25 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

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.

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 -
 drivers/gpu/drm/meson/meson_crtc.c              |  22 +++++
 drivers/gpu/drm/meson/meson_drv.c               |  21 -----
 drivers/gpu/drm/msm/msm_drv.c                   |   1 -
 drivers/gpu/drm/mxsfb/mxsfb_drv.c               |   1 -
 drivers/gpu/drm/nouveau/nouveau_drm.c           |   1 -
 drivers/gpu/drm/omapdrm/omap_drv.c              |   1 -
 drivers/gpu/drm/qxl/qxl_display.c               |  16 ++++
 drivers/gpu/drm/qxl/qxl_drv.c                   |  18 -----
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c          |  29 ++++---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h          |   1 -
 drivers/gpu/drm/rcar-du/rcar_du_drv.c           |  20 -----
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c     |  52 ------------
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h     |  14 ----
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c     |   9 +--
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c       |  51 ++++++++----
 drivers/gpu/drm/shmobile/shmob_drm_crtc.h       |   1 -
 drivers/gpu/drm/shmobile/shmob_drm_drv.c        |  20 -----
 drivers/gpu/drm/sti/sti_drv.c                   |   1 -
 drivers/gpu/drm/sun4i/sun4i_crtc.c              |  24 ++++++
 drivers/gpu/drm/sun4i/sun4i_drv.c               |  28 -------
 drivers/gpu/drm/tegra/dc.c                      |  15 +++-
 drivers/gpu/drm/tegra/drm.c                     |  38 ---------
 drivers/gpu/drm/tegra/drm.h                     |   3 -
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c            |  11 +++
 drivers/gpu/drm/tilcdc/tilcdc_drv.c             |  13 ---
 drivers/gpu/drm/vc4/vc4_crtc.c                  |   8 +-
 drivers/gpu/drm/vc4/vc4_drv.c                   |   3 -
 drivers/gpu/drm/vc4/vc4_drv.h                   |   2 -
 drivers/gpu/drm/zte/zx_drm_drv.c                |   3 -
 drivers/gpu/drm/zte/zx_vou.c                    |  61 ++++++--------
 drivers/gpu/drm/zte/zx_vou.h                    |   3 -
 include/drm/drm_crtc.h                          |  44 ++++++++++
 include/drm/drm_drv.h                           |  16 +++-
 include/drm/drm_irq.h                           |   1 -
 62 files changed, 481 insertions(+), 710 deletions(-)

-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:38   ` Andrzej Hajda
                     ` (2 more replies)
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                   ` (23 subsequent siblings)
  24 siblings, 3 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

The vblank is mostly CRTC specific and implemented as part of CRTC
driver.  Let's keep the vblank hooks struct drm_driver for legacy
drivers, and add corresponding hooks in struct drm_crtc_funcs.  These
hooks take struct drm_crtc pointer as argument, and will be called by
core vblank handling code for DRIVER_MODESET drivers.

The new hooks get plugged into core by adding wrapper functions for
vblank handling code.  The .get_vblank_counter hook is effectively
optional, as we provide drm_vblank_no_hw_counter() as the default
fallback in the wrapper function.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/gpu/drm/drm_irq.c | 53 +++++++++++++++++++++++++++++++++++++++++------
 include/drm/drm_crtc.h    | 44 +++++++++++++++++++++++++++++++++++++++
 include/drm/drm_drv.h     |  9 ++++++++
 3 files changed, 100 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index e06cf11ebb4a..646b3e57b9ad 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -89,6 +89,21 @@ static void store_vblank(struct drm_device *dev, unsigned int pipe,
 	write_sequnlock(&vblank->seqlock);
 }
 
+static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
+{
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		if (crtc->funcs->get_vblank_counter)
+			return crtc->funcs->get_vblank_counter(crtc);
+	}
+
+	if (dev->driver->get_vblank_counter)
+		return dev->driver->get_vblank_counter(dev, pipe);
+
+	return drm_vblank_no_hw_counter(dev, pipe);
+}
+
 /*
  * Reset the stored timestamp for the current vblank count to correspond
  * to the last vblank occurred.
@@ -112,9 +127,9 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe
 	 * when drm_vblank_enable() applies the diff
 	 */
 	do {
-		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
+		cur_vblank = __get_vblank_counter(dev, pipe);
 		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, 0);
-	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) && --count > 0);
+	} while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
 
 	/*
 	 * Only reinitialize corresponding vblank timestamp if high-precision query
@@ -168,9 +183,9 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
 	 * corresponding vblank timestamp.
 	 */
 	do {
-		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
+		cur_vblank = __get_vblank_counter(dev, pipe);
 		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, flags);
-	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) && --count > 0);
+	} while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
 
 	if (dev->max_vblank_count != 0) {
 		/* trust the hw counter when it's around */
@@ -275,6 +290,20 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_accurate_vblank_count);
 
+static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
+{
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		if (crtc->funcs->disable_vblank) {
+			crtc->funcs->disable_vblank(crtc);
+			return;
+		}
+	}
+
+	dev->driver->disable_vblank(dev, pipe);
+}
+
 /*
  * Disable vblank irq's on crtc, make sure that last vblank count
  * of hardware and corresponding consistent software vblank counter
@@ -298,7 +327,7 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
 	 * hardware potentially runtime suspended.
 	 */
 	if (vblank->enabled) {
-		dev->driver->disable_vblank(dev, pipe);
+		__disable_vblank(dev, pipe);
 		vblank->enabled = false;
 	}
 
@@ -1027,6 +1056,18 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_crtc_send_vblank_event);
 
+static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
+{
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
+
+		if (crtc->funcs->enable_vblank)
+			return crtc->funcs->enable_vblank(crtc);
+	}
+
+	return dev->driver->enable_vblank(dev, pipe);
+}
+
 /**
  * drm_vblank_enable - enable the vblank interrupt on a CRTC
  * @dev: DRM device
@@ -1052,7 +1093,7 @@ static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
 		 * timestamps. Filtercode in drm_handle_vblank() will
 		 * prevent double-accounting of same vblank interval.
 		 */
-		ret = dev->driver->enable_vblank(dev, pipe);
+		ret = __enable_vblank(dev, pipe);
 		DRM_DEBUG("enabling vblank on crtc %u, ret: %d\n", pipe, ret);
 		if (ret)
 			atomic_dec(&vblank->refcount);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 8f0b195e4a59..4323acefa596 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -601,6 +601,50 @@ struct drm_crtc_funcs {
 	 */
 	void (*atomic_print_state)(struct drm_printer *p,
 				   const struct drm_crtc_state *state);
+
+	/**
+	 * @get_vblank_counter:
+	 *
+	 * Driver callback for fetching a raw hardware vblank counter for the
+	 * CRTC. It's meant to be used by new drivers as the replacement of
+	 * &drm_driver.get_vblank_counter hook.
+	 *
+	 * This callback is optional. If a device doesn't have a hardware
+	 * counter, the driver can simply leave the hook as NULL. The DRM core
+	 * will account for missed vblank events while interrupts where disabled
+	 * based on system timestamps.
+	 *
+	 * Wraparound handling and loss of events due to modesetting is dealt
+	 * with in the DRM core code, as long as drivers call
+	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
+	 * enabling a CRTC.
+	 *
+	 * Returns:
+	 *
+	 * Raw vblank counter value.
+	 */
+	u32 (*get_vblank_counter)(struct drm_crtc *crtc);
+
+	/**
+	 * @enable_vblank:
+	 *
+	 * Enable vblank interrupts for the CRTC. It's meant to be used by
+	 * new drivers as the replacement of &drm_driver.enable_vblank hook.
+	 *
+	 * Returns:
+	 *
+	 * Zero on success, appropriate errno if the vblank interrupt cannot
+	 * be enabled.
+	 */
+	int (*enable_vblank)(struct drm_crtc *crtc);
+
+	/**
+	 * @disable_vblank:
+	 *
+	 * Disable vblank interrupts for the CRTC. It's meant to be used by
+	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
+	 */
+	void (*disable_vblank)(struct drm_crtc *crtc);
 };
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index f2c0040ddc3a..40ae89106594 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -130,6 +130,9 @@ struct drm_driver {
 	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
 	 * enabling a CRTC.
 	 *
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_funcs.get_vblank_counter instead.
+	 *
 	 * Returns:
 	 *
 	 * Raw vblank counter value.
@@ -142,6 +145,9 @@ struct drm_driver {
 	 * Enable vblank interrupts for the CRTC specified with the pipe
 	 * argument.
 	 *
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_funcs.enable_vblank instead.
+	 *
 	 * Returns:
 	 *
 	 * Zero on success, appropriate errno if the given @crtc's vblank
@@ -154,6 +160,9 @@ struct drm_driver {
 	 *
 	 * Disable vblank interrupts for the CRTC specified with the pipe
 	 * argument.
+	 *
+	 * This is deprecated and should not be used by new drivers.
+	 * Use &drm_crtc_funcs.disable_vblank instead.
 	 */
 	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07  9:27   ` Maxime Ripard
                     ` (7 more replies)
  2017-02-07  9:16 ` [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter() Shawn Guo
                   ` (22 subsequent siblings)
  24 siblings, 8 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

Core code already makes drm_driver.get_vblank_counter hook optional by
letting drm_vblank_no_hw_counter be the default implementation for the
function hook.  So the drm_vblank_no_hw_counter assignment in the driver
code becomes redundant and can be removed now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
 drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
 drivers/gpu/drm/arm/malidp_drv.c                | 1 -
 drivers/gpu/drm/armada/armada_drv.c             | 1 -
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
 drivers/gpu/drm/i915/i915_irq.c                 | 1 -
 drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
 drivers/gpu/drm/meson/meson_drv.c               | 1 -
 drivers/gpu/drm/msm/msm_drv.c                   | 1 -
 drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
 drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
 drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
 drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
 drivers/gpu/drm/sti/sti_drv.c                   | 1 -
 drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -
 drivers/gpu/drm/tilcdc/tilcdc_drv.c             | 1 -
 drivers/gpu/drm/vc4/vc4_drv.c                   | 1 -
 drivers/gpu/drm/zte/zx_drm_drv.c                | 1 -
 25 files changed, 25 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 8d8344ed655e..1926b200e4cb 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -175,7 +175,6 @@ static int arcpgu_unload(struct drm_device *drm)
 	.dumb_create = drm_gem_cma_dumb_create,
 	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
 	.dumb_destroy = drm_gem_dumb_destroy,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 4ce4f970920b..5d79e87f7421 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -278,7 +278,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
 	.irq_preinstall = hdlcd_irq_preinstall,
 	.irq_postinstall = hdlcd_irq_postinstall,
 	.irq_uninstall = hdlcd_irq_uninstall,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = hdlcd_enable_vblank,
 	.disable_vblank = hdlcd_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 8b0672d4aee9..ca6ccd172de3 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -213,7 +213,6 @@ static void malidp_lastclose(struct drm_device *drm)
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
 			   DRIVER_PRIME,
 	.lastclose = malidp_lastclose,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = malidp_enable_vblank,
 	.disable_vblank = malidp_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 63f42d001f33..bb27892012de 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -87,7 +87,6 @@ static void armada_drm_lastclose(struct drm_device *dev)
 
 static struct drm_driver armada_drm_driver = {
 	.lastclose		= armada_drm_lastclose,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= armada_drm_enable_vblank,
 	.disable_vblank		= armada_drm_disable_vblank,
 	.gem_free_object_unlocked = armada_gem_free_object,
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 427bdff425c2..5cba65b5ea16 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -760,7 +760,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
 	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
 	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
 	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 035d02ecffcd..a1c22eb12f4b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -263,7 +263,6 @@ static void exynos_drm_lastclose(struct drm_device *dev)
 	.preclose		= exynos_drm_preclose,
 	.lastclose		= exynos_drm_lastclose,
 	.postclose		= exynos_drm_postclose,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= exynos_drm_crtc_enable_vblank,
 	.disable_vblank		= exynos_drm_crtc_disable_vblank,
 	.gem_free_object_unlocked = exynos_drm_gem_free_object,
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 04173235f448..b59b816a1d7d 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -203,7 +203,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
 	.irq_handler		= fsl_dcu_drm_irq,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= fsl_dcu_drm_enable_vblank,
 	.disable_vblank		= fsl_dcu_drm_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 7e2043f4348c..8cac70454b57 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -84,7 +84,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 	.desc			= "hibmc drm driver",
 	.major			= 1,
 	.minor			= 0,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= hibmc_enable_vblank,
 	.disable_vblank		= hibmc_disable_vblank,
 	.gem_free_object_unlocked = hibmc_gem_free_object,
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 9a0678a33e0d..0624fab8046f 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -1025,7 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
 			       IRQF_SHARED, dev->driver->name, acrtc);
 	if (ret)
 		return ret;
-	dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
 	dev->driver->enable_vblank = ade_enable_vblank;
 	dev->driver->disable_vblank = ade_disable_vblank;
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 47d6131e977f..5aab08172faf 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -4218,7 +4218,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 	if (IS_GEN2(dev_priv)) {
 		/* Gen2 doesn't have a hardware frame counter */
 		dev->max_vblank_count = 0;
-		dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
 	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
 		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
 		dev->driver->get_vblank_counter = g4x_get_vblank_counter;
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 5ae48836652e..4badbb66d69e 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -288,7 +288,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= imx_drm_enable_vblank,
 	.disable_vblank		= imx_drm_disable_vblank,
 	.ioctls			= imx_drm_ioctls,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index b5f88e6d078e..ef8675336465 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -256,7 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
 
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = mtk_drm_crtc_enable_vblank,
 	.disable_vblank = mtk_drm_crtc_disable_vblank,
 
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 6f2fd82ed483..c0a59889c45f 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -129,7 +129,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
 	/* Vblank */
 	.enable_vblank		= meson_enable_vblank,
 	.disable_vblank		= meson_disable_vblank,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 
 	/* IRQ */
 	.irq_handler		= meson_irq,
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 70226eaa5cac..cb47f4a14215 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -816,7 +816,6 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
 	.irq_preinstall     = msm_irq_preinstall,
 	.irq_postinstall    = msm_irq_postinstall,
 	.irq_uninstall      = msm_irq_uninstall,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank      = msm_enable_vblank,
 	.disable_vblank     = msm_disable_vblank,
 	.gem_free_object    = msm_gem_free_object,
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index cdfbe0284635..104722a78bd6 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -340,7 +340,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
 	.irq_handler		= mxsfb_irq_handler,
 	.irq_preinstall		= mxsfb_irq_preinstall,
 	.irq_uninstall		= mxsfb_irq_preinstall,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= mxsfb_enable_vblank,
 	.disable_vblank		= mxsfb_disable_vblank,
 	.gem_free_object	= drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9ed2ca0769e3..626df485a03a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -977,7 +977,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 	.debugfs_cleanup = nouveau_drm_debugfs_cleanup,
 #endif
 
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = nouveau_display_vblank_enable,
 	.disable_vblank = nouveau_display_vblank_disable,
 	.get_scanout_position = nouveau_display_scanoutpos,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index afe8f05b927b..da049a7636ad 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -714,7 +714,6 @@ static void dev_lastclose(struct drm_device *dev)
 		DRIVER_ATOMIC,
 	.open = dev_open,
 	.lastclose = dev_lastclose,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = omap_irq_enable_vblank,
 	.disable_vblank = omap_irq_disable_vblank,
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index c05e00872778..094da3ef49d1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -259,7 +259,6 @@ static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
 				| DRIVER_ATOMIC,
 	.lastclose		= rcar_du_lastclose,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= rcar_du_enable_vblank,
 	.disable_vblank		= rcar_du_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index c30d649cb147..39243480c834 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -270,7 +270,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
 				  DRIVER_PRIME | DRIVER_ATOMIC,
 	.lastclose		= rockchip_drm_lastclose,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
 	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
 	.gem_vm_ops		= &drm_gem_cma_vm_ops,
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 33cec3d42389..d6b0545d252d 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -256,7 +256,6 @@ static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	.load			= shmob_drm_load,
 	.unload			= shmob_drm_unload,
 	.irq_handler		= shmob_drm_irq,
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= shmob_drm_enable_vblank,
 	.disable_vblank		= shmob_drm_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 788feed208d7..d4b771d2d10d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -264,7 +264,6 @@ static void sti_mode_config_init(struct drm_device *dev)
 	.dumb_destroy = drm_gem_dumb_destroy,
 	.fops = &sti_driver_fops,
 
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = sti_crtc_enable_vblank,
 	.disable_vblank = sti_crtc_disable_vblank,
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 4ce665349f6b..0816c635df20 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -92,7 +92,6 @@ static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
 	/* Frame Buffer Operations */
 
 	/* VBlank Operations */
-	.get_vblank_counter	= drm_vblank_no_hw_counter,
 	.enable_vblank		= sun4i_drv_enable_vblank,
 	.disable_vblank		= sun4i_drv_disable_vblank,
 };
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 372d86fbb093..d5bc98e283d9 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -557,7 +557,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
 			       DRIVER_PRIME | DRIVER_ATOMIC),
 	.lastclose          = tilcdc_lastclose,
 	.irq_handler        = tilcdc_irq,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank      = tilcdc_enable_vblank,
 	.disable_vblank     = tilcdc_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index a459745e96f7..3a8709d85da1 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -139,7 +139,6 @@ static void vc4_lastclose(struct drm_device *dev)
 
 	.enable_vblank = vc4_enable_vblank,
 	.disable_vblank = vc4_disable_vblank,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = vc4_crtc_get_vblank_timestamp,
 
diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index 5c6944a1e72c..afd713a954c6 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -71,7 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
 	.lastclose = zx_drm_lastclose,
-	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = zx_vou_enable_vblank,
 	.disable_vblank = zx_vou_disable_vblank,
 	.gem_free_object = drm_gem_cma_free_object,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter()
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:56   ` Laurent Pinchart
  2017-02-07  9:16 ` [PATCH v3 04/23] drm: hdlcd: use vblank hooks in struct drm_crtc_funcs Shawn Guo
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

The function drm_vblank_no_hw_counter() is now only used in core vblank
wrapper code.  Let's unexport it by making it a static function.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/gpu/drm/drm_irq.c | 28 ++++++++++------------------
 include/drm/drm_drv.h     |  7 +++----
 include/drm/drm_irq.h     |  1 -
 3 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 646b3e57b9ad..1906723af389 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -89,6 +89,16 @@ static void store_vblank(struct drm_device *dev, unsigned int pipe,
 	write_sequnlock(&vblank->seqlock);
 }
 
+/*
+ * "No hw counter" fallback implementation of .get_vblank_counter() hook,
+ * if there is no useable hardware frame counter available.
+ */
+static u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
+{
+	WARN_ON_ONCE(dev->max_vblank_count != 0);
+	return 0;
+}
+
 static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
 {
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
@@ -1748,21 +1758,3 @@ bool drm_crtc_handle_vblank(struct drm_crtc *crtc)
 	return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc));
 }
 EXPORT_SYMBOL(drm_crtc_handle_vblank);
-
-/**
- * drm_vblank_no_hw_counter - "No hw counter" implementation of .get_vblank_counter()
- * @dev: DRM device
- * @pipe: CRTC for which to read the counter
- *
- * Drivers can plug this into the .get_vblank_counter() function if
- * there is no useable hardware frame counter available.
- *
- * Returns:
- * 0
- */
-u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
-{
-	WARN_ON_ONCE(dev->max_vblank_count != 0);
-	return 0;
-}
-EXPORT_SYMBOL(drm_vblank_no_hw_counter);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 40ae89106594..661ca24a4c97 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -120,10 +120,9 @@ struct drm_driver {
 	 *
 	 * Driver callback for fetching a raw hardware vblank counter for the
 	 * CRTC specified with the pipe argument.  If a device doesn't have a
-	 * hardware counter, the driver can simply use
-	 * drm_vblank_no_hw_counter() function. The DRM core will account for
-	 * missed vblank events while interrupts where disabled based on system
-	 * timestamps.
+	 * hardware counter, the driver can simply leave the hook as NULL.
+	 * The DRM core will account for missed vblank events while interrupts
+	 * where disabled based on system timestamps.
 	 *
 	 * Wraparound handling and loss of events due to modesetting is dealt
 	 * with in the DRM core code, as long as drivers call
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 2fb880462a57..cf0be6594c8c 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -152,7 +152,6 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
 void drm_crtc_vblank_on(struct drm_crtc *crtc);
 void drm_vblank_cleanup(struct drm_device *dev);
 u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
-u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
 
 int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					  unsigned int pipe, int *max_error,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 04/23] drm: hdlcd: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (2 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter() Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07  9:16 ` [PATCH v3 05/23] drm: malidp: " Shawn Guo
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/arm/hdlcd_crtc.c | 20 ++++++++++++++++++++
 drivers/gpu/drm/arm/hdlcd_drv.c  | 20 --------------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 20ebfb4fbdfa..798a3cc480a2 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -42,6 +42,24 @@ static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
 	drm_crtc_cleanup(crtc);
 }
 
+static int hdlcd_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
+	unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask | HDLCD_INTERRUPT_VSYNC);
+
+	return 0;
+}
+
+static void hdlcd_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
+	unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask & ~HDLCD_INTERRUPT_VSYNC);
+}
+
 static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
 	.destroy = hdlcd_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
@@ -49,6 +67,8 @@ static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = hdlcd_crtc_enable_vblank,
+	.disable_vblank = hdlcd_crtc_disable_vblank,
 };
 
 static struct simplefb_format supported_formats[] = SIMPLEFB_FORMATS;
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 5d79e87f7421..4840dc277339 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -199,24 +199,6 @@ static void hdlcd_irq_uninstall(struct drm_device *drm)
 	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
 }
 
-static int hdlcd_enable_vblank(struct drm_device *drm, unsigned int crtc)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask | HDLCD_INTERRUPT_VSYNC);
-
-	return 0;
-}
-
-static void hdlcd_disable_vblank(struct drm_device *drm, unsigned int crtc)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask & ~HDLCD_INTERRUPT_VSYNC);
-}
-
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
@@ -278,8 +260,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
 	.irq_preinstall = hdlcd_irq_preinstall,
 	.irq_postinstall = hdlcd_irq_postinstall,
 	.irq_uninstall = hdlcd_irq_uninstall,
-	.enable_vblank = hdlcd_enable_vblank,
-	.disable_vblank = hdlcd_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 05/23] drm: malidp: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (3 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 04/23] drm: hdlcd: use vblank hooks in struct drm_crtc_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 15:22   ` Liviu Dudau
  2017-02-07  9:16 ` [PATCH v3 06/23] drm: armada: " Shawn Guo
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
---
 drivers/gpu/drm/arm/malidp_crtc.c | 21 +++++++++++++++++++++
 drivers/gpu/drm/arm/malidp_drv.c  | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
index 08e6a71f5d05..bad4d80cb711 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -167,6 +167,25 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
 	.atomic_check = malidp_crtc_atomic_check,
 };
 
+static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
+	struct malidp_hw_device *hwdev = malidp->dev;
+
+	malidp_hw_enable_irq(hwdev, MALIDP_DE_BLOCK,
+			     hwdev->map.de_irq_map.vsync_irq);
+	return 0;
+}
+
+static void malidp_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
+	struct malidp_hw_device *hwdev = malidp->dev;
+
+	malidp_hw_disable_irq(hwdev, MALIDP_DE_BLOCK,
+			      hwdev->map.de_irq_map.vsync_irq);
+}
+
 static const struct drm_crtc_funcs malidp_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
@@ -174,6 +193,8 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = malidp_crtc_enable_vblank,
+	.disable_vblank = malidp_crtc_disable_vblank,
 };
 
 int malidp_crtc_init(struct drm_device *drm)
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index ca6ccd172de3..5dfcdb05c96e 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -111,25 +111,6 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
-static int malidp_enable_vblank(struct drm_device *drm, unsigned int crtc)
-{
-	struct malidp_drm *malidp = drm->dev_private;
-	struct malidp_hw_device *hwdev = malidp->dev;
-
-	malidp_hw_enable_irq(hwdev, MALIDP_DE_BLOCK,
-			     hwdev->map.de_irq_map.vsync_irq);
-	return 0;
-}
-
-static void malidp_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct malidp_drm *malidp = drm->dev_private;
-	struct malidp_hw_device *hwdev = malidp->dev;
-
-	malidp_hw_disable_irq(hwdev, MALIDP_DE_BLOCK,
-			      hwdev->map.de_irq_map.vsync_irq);
-}
-
 static int malidp_init(struct drm_device *drm)
 {
 	int ret;
@@ -213,8 +194,6 @@ static void malidp_lastclose(struct drm_device *drm)
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
 			   DRIVER_PRIME,
 	.lastclose = malidp_lastclose,
-	.enable_vblank = malidp_enable_vblank,
-	.disable_vblank = malidp_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 06/23] drm: armada: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (4 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 05/23] drm: malidp: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:23   ` Russell King - ARM Linux
  2017-02-07  9:16 ` [PATCH v3 07/23] drm: atmel: " Shawn Guo
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.  As the result,
functions armada_drm_crtc_enable[disable]_irq() can be static, although
they are moved around a bit to save forward declaration.

The armada_crtc pointer array in struct armada_private is still kept in
there, because armada_debugfs.c still have reference to it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
---
 drivers/gpu/drm/armada/armada_crtc.c | 56 ++++++++++++++++++++++++------------
 drivers/gpu/drm/armada/armada_crtc.h |  2 --
 drivers/gpu/drm/armada/armada_drv.c  | 16 -----------
 3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index e62ee4498ce4..1341e0b9368a 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -418,6 +418,25 @@ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 	return true;
 }
 
+/* These are locked by dev->vbl_lock */
+static void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
+{
+	if (dcrtc->irq_ena & mask) {
+		dcrtc->irq_ena &= ~mask;
+		writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
+	}
+}
+
+static void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
+{
+	if ((dcrtc->irq_ena & mask) != mask) {
+		dcrtc->irq_ena |= mask;
+		writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
+		if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
+			writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
+	}
+}
+
 static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
 {
 	void __iomem *base = dcrtc->base;
@@ -491,25 +510,6 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)
 	return IRQ_NONE;
 }
 
-/* These are locked by dev->vbl_lock */
-void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
-{
-	if (dcrtc->irq_ena & mask) {
-		dcrtc->irq_ena &= ~mask;
-		writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
-	}
-}
-
-void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
-{
-	if ((dcrtc->irq_ena & mask) != mask) {
-		dcrtc->irq_ena |= mask;
-		writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
-		if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
-			writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
-	}
-}
-
 static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc)
 {
 	struct drm_display_mode *adj = &dcrtc->crtc.mode;
@@ -1109,6 +1109,22 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
 	return 0;
 }
 
+/* These are called under the vbl_lock. */
+static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
+
+	armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA);
+	return 0;
+}
+
+static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
+
+	armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA);
+}
+
 static const struct drm_crtc_funcs armada_crtc_funcs = {
 	.cursor_set	= armada_drm_crtc_cursor_set,
 	.cursor_move	= armada_drm_crtc_cursor_move,
@@ -1116,6 +1132,8 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
 	.set_config	= drm_crtc_helper_set_config,
 	.page_flip	= armada_drm_crtc_page_flip,
 	.set_property	= armada_drm_crtc_set_property,
+	.enable_vblank	= armada_drm_crtc_enable_vblank,
+	.disable_vblank	= armada_drm_crtc_disable_vblank,
 };
 
 static const struct drm_plane_funcs armada_primary_plane_funcs = {
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h
index b08043e8cc3b..7e8906d3ae26 100644
--- a/drivers/gpu/drm/armada/armada_crtc.h
+++ b/drivers/gpu/drm/armada/armada_crtc.h
@@ -104,8 +104,6 @@ struct armada_crtc {
 
 void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
 void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
-void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
-void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
 void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
 
 void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index bb27892012de..737bfcbce87b 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -49,20 +49,6 @@ void armada_drm_queue_unref_work(struct drm_device *dev,
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 }
 
-/* These are called under the vbl_lock. */
-static int armada_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct armada_private *priv = dev->dev_private;
-	armada_drm_crtc_enable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
-	return 0;
-}
-
-static void armada_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct armada_private *priv = dev->dev_private;
-	armada_drm_crtc_disable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
-}
-
 static struct drm_ioctl_desc armada_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0),
 	DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0),
@@ -87,8 +73,6 @@ static void armada_drm_lastclose(struct drm_device *dev)
 
 static struct drm_driver armada_drm_driver = {
 	.lastclose		= armada_drm_lastclose,
-	.enable_vblank		= armada_drm_enable_vblank,
-	.disable_vblank		= armada_drm_disable_vblank,
 	.gem_free_object_unlocked = armada_gem_free_object,
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 07/23] drm: atmel: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (5 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 06/23] drm: armada: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07  9:46   ` Boris Brezillon
  2017-02-07  9:16 ` [PATCH v3 08/23] drm: exynos: " Shawn Guo
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 21 +++++++++++++++++++++
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c   | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 9b17a66cf0e1..fabeeea0e899 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -434,6 +434,25 @@ static void atmel_hlcdc_crtc_destroy_state(struct drm_crtc *crtc,
 	kfree(state);
 }
 
+static int atmel_hlcdc_crtc_enable_vblank(struct drm_crtc *c)
+{
+	struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
+	struct regmap *regmap = crtc->dc->hlcdc->regmap;
+
+	/* Enable SOF (Start Of Frame) interrupt for vblank counting */
+	regmap_write(regmap, ATMEL_HLCDC_IER, ATMEL_HLCDC_SOF);
+
+	return 0;
+}
+
+static void atmel_hlcdc_crtc_disable_vblank(struct drm_crtc *c)
+{
+	struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
+	struct regmap *regmap = crtc->dc->hlcdc->regmap;
+
+	regmap_write(regmap, ATMEL_HLCDC_IDR, ATMEL_HLCDC_SOF);
+}
+
 static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.set_config = drm_atomic_helper_set_config,
@@ -441,6 +460,8 @@ static void atmel_hlcdc_crtc_destroy_state(struct drm_crtc *crtc,
 	.reset = atmel_hlcdc_crtc_reset,
 	.atomic_duplicate_state =  atmel_hlcdc_crtc_duplicate_state,
 	.atomic_destroy_state = atmel_hlcdc_crtc_destroy_state,
+	.enable_vblank = atmel_hlcdc_crtc_enable_vblank,
+	.disable_vblank = atmel_hlcdc_crtc_disable_vblank,
 };
 
 int atmel_hlcdc_crtc_create(struct drm_device *dev)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 5cba65b5ea16..fd1a2d0c870d 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -720,25 +720,6 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
 	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
 }
 
-static int atmel_hlcdc_dc_enable_vblank(struct drm_device *dev,
-					unsigned int pipe)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-
-	/* Enable SOF (Start Of Frame) interrupt for vblank counting */
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, ATMEL_HLCDC_SOF);
-
-	return 0;
-}
-
-static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
-					  unsigned int pipe)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, ATMEL_HLCDC_SOF);
-}
-
 static const struct file_operations fops = {
 	.owner              = THIS_MODULE,
 	.open               = drm_open,
@@ -760,8 +741,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
 	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
 	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
-	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
-	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
 	.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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 08/23] drm: exynos: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (6 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 07/23] drm: atmel: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:47   ` Andrzej Hajda
  2017-02-07  9:16 ` [PATCH v3 09/23] drm: fsl-dcu: " Shawn Guo
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.

As the result, exynos_drm_crtc_enable[disable]_vblank() become static
functions.  They are moved around a bit to save forward declaration
though.  Also while at it, we move one step further to kill
exynos_drm_crtc_from_pipe() completely by updating hdmi_bind() a bit.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Inki Dae <inki.dae@samsung.com>
---
 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  |  3 ---
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  8 -------
 drivers/gpu/drm/exynos/exynos_hdmi.c     |  7 ++++--
 5 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5367b6664fe3..fa32091af924 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -122,6 +122,24 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 	kfree(exynos_crtc);
 }
 
+static int exynos_drm_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+	if (exynos_crtc->ops->enable_vblank)
+		return exynos_crtc->ops->enable_vblank(exynos_crtc);
+
+	return 0;
+}
+
+static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+	if (exynos_crtc->ops->disable_vblank)
+		exynos_crtc->ops->disable_vblank(exynos_crtc);
+}
+
 static const struct drm_crtc_funcs exynos_crtc_funcs = {
 	.set_config	= drm_atomic_helper_set_config,
 	.page_flip	= drm_atomic_helper_page_flip,
@@ -129,6 +147,8 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = exynos_drm_crtc_enable_vblank,
+	.disable_vblank = exynos_drm_crtc_disable_vblank,
 };
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
@@ -168,26 +188,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 	return ERR_PTR(ret);
 }
 
-int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev,
-									pipe);
-
-	if (exynos_crtc->ops->enable_vblank)
-		return exynos_crtc->ops->enable_vblank(exynos_crtc);
-
-	return 0;
-}
-
-void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev,
-									pipe);
-
-	if (exynos_crtc->ops->disable_vblank)
-		exynos_crtc->ops->disable_vblank(exynos_crtc);
-}
-
 int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,
 				       enum exynos_drm_output_type out_type)
 {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 6a581a8af465..4e986ba92320 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -23,8 +23,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					enum exynos_drm_output_type type,
 					const struct exynos_drm_crtc_ops *ops,
 					void *context);
-int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
-void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
 void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc);
 void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc,
 				   struct exynos_drm_plane *exynos_plane);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index a1c22eb12f4b..b4522f67b3cb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -22,7 +22,6 @@
 #include <drm/exynos_drm.h>
 
 #include "exynos_drm_drv.h"
-#include "exynos_drm_crtc.h"
 #include "exynos_drm_fbdev.h"
 #include "exynos_drm_fb.h"
 #include "exynos_drm_gem.h"
@@ -263,8 +262,6 @@ static void exynos_drm_lastclose(struct drm_device *dev)
 	.preclose		= exynos_drm_preclose,
 	.lastclose		= exynos_drm_lastclose,
 	.postclose		= exynos_drm_postclose,
-	.enable_vblank		= exynos_drm_crtc_enable_vblank,
-	.disable_vblank		= exynos_drm_crtc_disable_vblank,
 	.gem_free_object_unlocked = exynos_drm_gem_free_object,
 	.gem_vm_ops		= &exynos_drm_gem_vm_ops,
 	.dumb_create		= exynos_drm_gem_dumb_create,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index cf6e08cb35a7..cb3176930596 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -222,14 +222,6 @@ struct exynos_drm_private {
 	wait_queue_head_t	wait;
 };
 
-static inline struct exynos_drm_crtc *
-exynos_drm_crtc_from_pipe(struct drm_device *dev, int pipe)
-{
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
-
-	return to_exynos_crtc(crtc);
-}
-
 static inline struct device *to_dma_dev(struct drm_device *dev)
 {
 	struct exynos_drm_private *priv = dev->dev_private;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 5ed8b1effe71..752e8a3afc79 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -42,7 +42,6 @@
 
 #include <drm/exynos_drm.h>
 
-#include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
 
 #define HOTPLUG_DEBOUNCE_MS		1100
@@ -1657,6 +1656,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm_dev = data;
 	struct hdmi_context *hdata = dev_get_drvdata(dev);
 	struct drm_encoder *encoder = &hdata->encoder;
+	struct exynos_drm_crtc *exynos_crtc;
+	struct drm_crtc *crtc;
 	int ret, pipe;
 
 	hdata->drm_dev = drm_dev;
@@ -1668,7 +1669,9 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
 
 	hdata->phy_clk.enable = hdmiphy_clk_enable;
 
-	exynos_drm_crtc_from_pipe(drm_dev, pipe)->pipe_clk = &hdata->phy_clk;
+	crtc = drm_crtc_from_index(drm_dev, pipe);
+	exynos_crtc = to_exynos_crtc(crtc);
+	exynos_crtc->pipe_clk = &hdata->phy_clk;
 
 	encoder->possible_crtcs = 1 << pipe;
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 09/23] drm: fsl-dcu: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (7 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 08/23] drm: exynos: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-08  5:01   ` Stefan Agner
  2017-02-07  9:16 ` [PATCH v3 10/23] drm: hibmc: " Shawn Guo
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c  | 25 -------------------------
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index deb57435cc89..cc4e944a1d3c 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -137,6 +137,30 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	.mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb,
 };
 
+static int fsl_dcu_drm_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int value;
+
+	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
+	value &= ~DCU_INT_MASK_VBLANK;
+	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
+
+	return 0;
+}
+
+static void fsl_dcu_drm_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int value;
+
+	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
+	value |= DCU_INT_MASK_VBLANK;
+	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
+}
+
 static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
@@ -144,6 +168,8 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	.page_flip = drm_atomic_helper_page_flip,
 	.reset = drm_atomic_helper_crtc_reset,
 	.set_config = drm_atomic_helper_set_config,
+	.enable_vblank = fsl_dcu_drm_crtc_enable_vblank,
+	.disable_vblank = fsl_dcu_drm_crtc_disable_vblank,
 };
 
 int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index b59b816a1d7d..b5391c124c64 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -154,29 +154,6 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int value;
-
-	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
-	value &= ~DCU_INT_MASK_VBLANK;
-	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
-
-	return 0;
-}
-
-static void fsl_dcu_drm_disable_vblank(struct drm_device *dev,
-				       unsigned int pipe)
-{
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int value;
-
-	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
-	value |= DCU_INT_MASK_VBLANK;
-	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
-}
-
 static void fsl_dcu_drm_lastclose(struct drm_device *dev)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -203,8 +180,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
 	.irq_handler		= fsl_dcu_drm_irq,
-	.enable_vblank		= fsl_dcu_drm_enable_vblank,
-	.disable_vblank		= fsl_dcu_drm_disable_vblank,
 	.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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 10/23] drm: hibmc: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (8 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 09/23] drm: fsl-dcu: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-08 15:39   ` Sean Paul
  2017-02-16  3:28   ` Xinliang Liu
  2017-02-07  9:16 ` [PATCH v3 11/23] drm: kirin: " Shawn Guo
                   ` (14 subsequent siblings)
  24 siblings, 2 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
index c655883d3613..59542bddc980 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
 	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 }
 
+static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct hibmc_drm_private *priv = crtc->dev->dev_private;
+
+	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
+	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
+
+	return 0;
+}
+
+static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct hibmc_drm_private *priv = crtc->dev->dev_private;
+
+	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
+	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
+}
+
 static const struct drm_crtc_funcs hibmc_crtc_funcs = {
 	.page_flip = drm_atomic_helper_page_flip,
 	.set_config = drm_atomic_helper_set_config,
@@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = hibmc_crtc_enable_vblank,
+	.disable_vblank = hibmc_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 8cac70454b57..2ffdbf9801bd 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -37,26 +37,6 @@
 	.llseek		= no_llseek,
 };
 
-static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct hibmc_drm_private *priv =
-		(struct hibmc_drm_private *)dev->dev_private;
-
-	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
-	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
-
-	return 0;
-}
-
-static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct hibmc_drm_private *priv =
-		(struct hibmc_drm_private *)dev->dev_private;
-
-	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
-	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
-}
-
 irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *)arg;
@@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 	.desc			= "hibmc drm driver",
 	.major			= 1,
 	.minor			= 0,
-	.enable_vblank		= hibmc_enable_vblank,
-	.disable_vblank		= hibmc_disable_vblank,
 	.gem_free_object_unlocked = hibmc_gem_free_object,
 	.dumb_create            = hibmc_dumb_create,
 	.dumb_map_offset        = hibmc_dumb_mmap_offset,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 11/23] drm: kirin: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (9 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 10/23] drm: hibmc: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-16  3:23   ` Xinliang Liu
  2017-02-07  9:16 ` [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs Shawn Guo
                   ` (13 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 0624fab8046f..c96c228a9898 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -302,9 +302,8 @@ static void ade_set_medianoc_qos(struct ade_crtc *acrtc)
 			   SOCKET_QOS_EN, SOCKET_QOS_EN);
 }
 
-static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
+static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct ade_crtc *acrtc = to_ade_crtc(crtc);
 	struct ade_hw_ctx *ctx = acrtc->ctx;
 	void __iomem *base = ctx->base;
@@ -318,9 +317,8 @@ static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	return 0;
 }
 
-static void ade_disable_vblank(struct drm_device *dev, unsigned int pipe)
+static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 	struct ade_crtc *acrtc = to_ade_crtc(crtc);
 	struct ade_hw_ctx *ctx = acrtc->ctx;
 	void __iomem *base = ctx->base;
@@ -570,6 +568,8 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
 	.set_property = drm_atomic_helper_crtc_set_property,
 	.atomic_duplicate_state	= drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state	= drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank	= ade_crtc_enable_vblank,
+	.disable_vblank	= ade_crtc_disable_vblank,
 };
 
 static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
@@ -1025,8 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
 			       IRQF_SHARED, dev->driver->name, acrtc);
 	if (ret)
 		return ret;
-	dev->driver->enable_vblank = ade_enable_vblank;
-	dev->driver->disable_vblank = ade_disable_vblank;
 
 	return 0;
 }
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (10 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 11/23] drm: kirin: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:10   ` Philipp Zabel
  2017-02-07  9:16 ` [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs Shawn Guo
                   ` (12 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

With the vblank hooks in struct drm_crtc_funcs, we do not need to
maintain the CRTC specific vblank callbacks with struct
imx_drm_crtc_helper_funcs any more.  By moving the stuff that we
currently do in imx_drm_add_crtc(), like of_node setting and
drm_crtc_helper_add()/drm_crtc_init_with_planes() invoking, we can kill
things like struct imx_drm_crtc, imx_drm_crtc_helper_funcs and related
functions completely.

Functions ipu_enable_vblank() and ipu_disable_vblank() are moved around
without changes, only for saving the forward declarations.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 101 -------------------------------------
 drivers/gpu/drm/imx/imx-drm.h      |  13 -----
 drivers/gpu/drm/imx/ipuv3-crtc.c   |  58 ++++++++-------------
 3 files changed, 22 insertions(+), 150 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 4badbb66d69e..65bd8b8a2494 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -40,17 +40,11 @@ struct imx_drm_component {
 
 struct imx_drm_device {
 	struct drm_device			*drm;
-	struct imx_drm_crtc			*crtc[MAX_CRTC];
 	unsigned int				pipes;
 	struct drm_fbdev_cma			*fbhelper;
 	struct drm_atomic_state			*state;
 };
 
-struct imx_drm_crtc {
-	struct drm_crtc				*crtc;
-	struct imx_drm_crtc_helper_funcs	imx_drm_helper_funcs;
-};
-
 #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
 static int legacyfb_depth = 16;
 module_param(legacyfb_depth, int, 0444);
@@ -63,38 +57,6 @@ static void imx_drm_driver_lastclose(struct drm_device *drm)
 	drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
 }
 
-static int imx_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct imx_drm_device *imxdrm = drm->dev_private;
-	struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
-	int ret;
-
-	if (!imx_drm_crtc)
-		return -EINVAL;
-
-	if (!imx_drm_crtc->imx_drm_helper_funcs.enable_vblank)
-		return -ENOSYS;
-
-	ret = imx_drm_crtc->imx_drm_helper_funcs.enable_vblank(
-			imx_drm_crtc->crtc);
-
-	return ret;
-}
-
-static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct imx_drm_device *imxdrm = drm->dev_private;
-	struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe];
-
-	if (!imx_drm_crtc)
-		return;
-
-	if (!imx_drm_crtc->imx_drm_helper_funcs.disable_vblank)
-		return;
-
-	imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
-}
-
 static const struct file_operations imx_drm_driver_fops = {
 	.owner = THIS_MODULE,
 	.open = drm_open,
@@ -180,67 +142,6 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
 	.atomic_commit_tail = imx_drm_atomic_commit_tail,
 };
 
-/*
- * imx_drm_add_crtc - add a new crtc
- */
-int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
-		struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane,
-		const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs,
-		struct device_node *port)
-{
-	struct imx_drm_device *imxdrm = drm->dev_private;
-	struct imx_drm_crtc *imx_drm_crtc;
-
-	/*
-	 * The vblank arrays are dimensioned by MAX_CRTC - we can't
-	 * pass IDs greater than this to those functions.
-	 */
-	if (imxdrm->pipes >= MAX_CRTC)
-		return -EINVAL;
-
-	if (imxdrm->drm->open_count)
-		return -EBUSY;
-
-	imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL);
-	if (!imx_drm_crtc)
-		return -ENOMEM;
-
-	imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
-	imx_drm_crtc->crtc = crtc;
-
-	crtc->port = port;
-
-	imxdrm->crtc[imxdrm->pipes++] = imx_drm_crtc;
-
-	*new_crtc = imx_drm_crtc;
-
-	drm_crtc_helper_add(crtc,
-			imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
-
-	drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
-			imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs, NULL);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
-
-/*
- * imx_drm_remove_crtc - remove a crtc
- */
-int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc)
-{
-	struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private;
-	unsigned int pipe = drm_crtc_index(imx_drm_crtc->crtc);
-
-	drm_crtc_cleanup(imx_drm_crtc->crtc);
-
-	imxdrm->crtc[pipe] = NULL;
-
-	kfree(imx_drm_crtc);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(imx_drm_remove_crtc);
 
 int imx_drm_encoder_parse_of(struct drm_device *drm,
 	struct drm_encoder *encoder, struct device_node *np)
@@ -288,8 +189,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
-	.enable_vblank		= imx_drm_enable_vblank,
-	.disable_vblank		= imx_drm_disable_vblank,
 	.ioctls			= imx_drm_ioctls,
 	.num_ioctls		= ARRAY_SIZE(imx_drm_ioctls),
 	.fops			= &imx_drm_driver_fops,
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index 5a91cb16c8fa..cc003334505d 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -25,19 +25,6 @@ static inline struct imx_crtc_state *to_imx_crtc_state(struct drm_crtc_state *s)
 {
 	return container_of(s, struct imx_crtc_state, base);
 }
-
-struct imx_drm_crtc_helper_funcs {
-	int (*enable_vblank)(struct drm_crtc *crtc);
-	void (*disable_vblank)(struct drm_crtc *crtc);
-	const struct drm_crtc_helper_funcs *crtc_helper_funcs;
-	const struct drm_crtc_funcs *crtc_funcs;
-};
-
-int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
-		struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane,
-		const struct imx_drm_crtc_helper_funcs *imx_helper_funcs,
-		struct device_node *port);
-int imx_drm_remove_crtc(struct imx_drm_crtc *);
 int imx_drm_init_drm(struct platform_device *pdev,
 		int preferred_bpp);
 int imx_drm_exit_drm(void);
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 6be515a9fb69..a3f2843b78cd 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -129,18 +129,31 @@ static void imx_drm_crtc_destroy_state(struct drm_crtc *crtc,
 	kfree(to_imx_crtc_state(state));
 }
 
-static void imx_drm_crtc_destroy(struct drm_crtc *crtc)
+static int ipu_enable_vblank(struct drm_crtc *crtc)
+{
+	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
+
+	enable_irq(ipu_crtc->irq);
+
+	return 0;
+}
+
+static void ipu_disable_vblank(struct drm_crtc *crtc)
 {
-	imx_drm_remove_crtc(to_ipu_crtc(crtc)->imx_crtc);
+	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
+
+	disable_irq_nosync(ipu_crtc->irq);
 }
 
 static const struct drm_crtc_funcs ipu_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
-	.destroy = imx_drm_crtc_destroy,
+	.destroy = drm_crtc_cleanup,
 	.page_flip = drm_atomic_helper_page_flip,
 	.reset = imx_drm_crtc_reset,
 	.atomic_duplicate_state = imx_drm_crtc_duplicate_state,
 	.atomic_destroy_state = imx_drm_crtc_destroy_state,
+	.enable_vblank = ipu_enable_vblank,
+	.disable_vblank = ipu_disable_vblank,
 };
 
 static irqreturn_t ipu_irq_handler(int irq, void *dev_id)
@@ -261,29 +274,6 @@ static void ipu_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	.enable = ipu_crtc_enable,
 };
 
-static int ipu_enable_vblank(struct drm_crtc *crtc)
-{
-	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
-
-	enable_irq(ipu_crtc->irq);
-
-	return 0;
-}
-
-static void ipu_disable_vblank(struct drm_crtc *crtc)
-{
-	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
-
-	disable_irq_nosync(ipu_crtc->irq);
-}
-
-static const struct imx_drm_crtc_helper_funcs ipu_crtc_helper_funcs = {
-	.enable_vblank = ipu_enable_vblank,
-	.disable_vblank = ipu_disable_vblank,
-	.crtc_funcs = &ipu_crtc_funcs,
-	.crtc_helper_funcs = &ipu_helper_funcs,
-};
-
 static void ipu_put_resources(struct ipu_crtc *ipu_crtc)
 {
 	if (!IS_ERR_OR_NULL(ipu_crtc->dc))
@@ -321,6 +311,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
 	struct ipu_client_platformdata *pdata, struct drm_device *drm)
 {
 	struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
+	struct drm_crtc *crtc = &ipu_crtc->base;
 	int dp = -EINVAL;
 	int ret;
 
@@ -340,19 +331,16 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
 		goto err_put_resources;
 	}
 
-	ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
-			&ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,
-			pdata->of_node);
-	if (ret) {
-		dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
-		goto err_put_resources;
-	}
+	crtc->port = pdata->of_node;
+	drm_crtc_helper_add(crtc, &ipu_helper_funcs);
+	drm_crtc_init_with_planes(drm, crtc, &ipu_crtc->plane[0]->base, NULL,
+				  &ipu_crtc_funcs, NULL);
 
 	ret = ipu_plane_get_resources(ipu_crtc->plane[0]);
 	if (ret) {
 		dev_err(ipu_crtc->dev, "getting plane 0 resources failed with %d.\n",
 			ret);
-		goto err_remove_crtc;
+		goto err_put_resources;
 	}
 
 	/* If this crtc is using the DP, add an overlay plane */
@@ -390,8 +378,6 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
 		ipu_plane_put_resources(ipu_crtc->plane[1]);
 err_put_plane0_res:
 	ipu_plane_put_resources(ipu_crtc->plane[0]);
-err_remove_crtc:
-	imx_drm_remove_crtc(ipu_crtc->imx_crtc);
 err_put_resources:
 	ipu_put_resources(ipu_crtc);
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (11 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-21 16:21   ` Sean Paul
  2017-02-07  9:16 ` [PATCH v3 14/23] drm: meson: " Shawn Guo
                   ` (11 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: CK Hu <ck.hu@mediatek.com>
---
 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  | 3 ---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a73de1e669c2..69982f5a6198 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -168,9 +168,8 @@ static void mtk_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	state->pending_config = true;
 }
 
-int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
+static int mtk_drm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
 
@@ -179,9 +178,8 @@ int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
 	return 0;
 }
 
-void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe)
+static void mtk_drm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
 
@@ -436,6 +434,8 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
 	.atomic_duplicate_state	= mtk_drm_crtc_duplicate_state,
 	.atomic_destroy_state	= mtk_drm_crtc_destroy_state,
 	.gamma_set		= drm_atomic_helper_legacy_gamma_set,
+	.enable_vblank		= mtk_drm_crtc_enable_vblank,
+	.disable_vblank		= mtk_drm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
index a1550fa3c9d2..9d9410c67ae9 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
@@ -23,8 +23,6 @@
 #define MTK_MAX_BPC	10
 #define MTK_MIN_BPC	3
 
-int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe);
-void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe);
 void mtk_drm_crtc_commit(struct drm_crtc *crtc);
 void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl);
 int mtk_drm_crtc_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index ef8675336465..f5a1fd9b3ecc 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -256,9 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
 
-	.enable_vblank = mtk_drm_crtc_enable_vblank,
-	.disable_vblank = mtk_drm_crtc_disable_vblank,
-
 	.gem_free_object_unlocked = mtk_drm_gem_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = mtk_drm_gem_dumb_create,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 14/23] drm: meson: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (12 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 10:09   ` Neil Armstrong
  2017-02-07  9:16 ` [PATCH v3 15/23] drm: qxl: " Shawn Guo
                   ` (10 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/gpu/drm/meson/meson_crtc.c | 22 ++++++++++++++++++++++
 drivers/gpu/drm/meson/meson_drv.c  | 20 --------------------
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
index 749770e5c65f..0fe49eccda65 100644
--- a/drivers/gpu/drm/meson/meson_crtc.c
+++ b/drivers/gpu/drm/meson/meson_crtc.c
@@ -33,6 +33,7 @@
 
 #include "meson_crtc.h"
 #include "meson_plane.h"
+#include "meson_venc.h"
 #include "meson_vpp.h"
 #include "meson_viu.h"
 #include "meson_registers.h"
@@ -48,6 +49,24 @@ struct meson_crtc {
 
 /* CRTC */
 
+static int meson_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
+	struct meson_drm *priv = meson_crtc->priv;
+
+	meson_venc_enable_vsync(priv);
+
+	return 0;
+}
+
+static void meson_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
+	struct meson_drm *priv = meson_crtc->priv;
+
+	meson_venc_disable_vsync(priv);
+}
+
 static const struct drm_crtc_funcs meson_crtc_funcs = {
 	.atomic_destroy_state	= drm_atomic_helper_crtc_destroy_state,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
@@ -55,6 +74,9 @@ struct meson_crtc {
 	.page_flip		= drm_atomic_helper_page_flip,
 	.reset			= drm_atomic_helper_crtc_reset,
 	.set_config             = drm_atomic_helper_set_config,
+	.enable_vblank		= meson_crtc_enable_vblank,
+	.disable_vblank		= meson_crtc_disable_vblank,
+
 };
 
 static void meson_crtc_enable(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index c0a59889c45f..8d17d0e59cbe 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -79,22 +79,6 @@ static void meson_fb_output_poll_changed(struct drm_device *dev)
 	.fb_create           = drm_fb_cma_create,
 };
 
-static int meson_enable_vblank(struct drm_device *dev, unsigned int crtc)
-{
-	struct meson_drm *priv = dev->dev_private;
-
-	meson_venc_enable_vsync(priv);
-
-	return 0;
-}
-
-static void meson_disable_vblank(struct drm_device *dev, unsigned int crtc)
-{
-	struct meson_drm *priv = dev->dev_private;
-
-	meson_venc_disable_vsync(priv);
-}
-
 static irqreturn_t meson_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -126,10 +110,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
 				  DRIVER_MODESET | DRIVER_PRIME |
 				  DRIVER_ATOMIC,
 
-	/* Vblank */
-	.enable_vblank		= meson_enable_vblank,
-	.disable_vblank		= meson_disable_vblank,
-
 	/* IRQ */
 	.irq_handler		= meson_irq,
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 15/23] drm: qxl: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (13 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 14/23] drm: meson: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-21 16:21   ` Sean Paul
  2017-02-07  9:16 ` [PATCH v3 16/23] drm: rcar-du: " Shawn Guo
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Dave Airlie,
	Jyri Sarha, dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 16 ++++++++++++++++
 drivers/gpu/drm/qxl/qxl_drv.c     | 18 ------------------
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 1094cd33eb06..2ce805a7ce5e 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -548,6 +548,19 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
 	return 0;
 }
 
+static u32 qxl_noop_get_vblank_counter(struct drm_crtc *crtc)
+{
+	return 0;
+}
+
+static int qxl_noop_enable_vblank(struct drm_crtc *crtc)
+{
+	return 0;
+}
+
+static void qxl_noop_disable_vblank(struct drm_crtc *crtc)
+{
+}
 
 static const struct drm_crtc_funcs qxl_crtc_funcs = {
 	.cursor_set2 = qxl_crtc_cursor_set2,
@@ -555,6 +568,9 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
 	.set_config = drm_crtc_helper_set_config,
 	.destroy = qxl_crtc_destroy,
 	.page_flip = qxl_crtc_page_flip,
+	.get_vblank_counter = qxl_noop_get_vblank_counter,
+	.enable_vblank = qxl_noop_enable_vblank,
+	.disable_vblank = qxl_noop_disable_vblank,
 };
 
 void qxl_user_framebuffer_destroy(struct drm_framebuffer *fb)
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index 8e17c241e63c..48d51a2f3bd8 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -247,21 +247,6 @@ static int qxl_pm_restore(struct device *dev)
 	return qxl_drm_resume(drm_dev, false);
 }
 
-static u32 qxl_noop_get_vblank_counter(struct drm_device *dev,
-				       unsigned int pipe)
-{
-	return 0;
-}
-
-static int qxl_noop_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	return 0;
-}
-
-static void qxl_noop_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-}
-
 static const struct dev_pm_ops qxl_pm_ops = {
 	.suspend = qxl_pm_suspend,
 	.resume = qxl_pm_resume,
@@ -281,9 +266,6 @@ static void qxl_noop_disable_vblank(struct drm_device *dev, unsigned int pipe)
 static struct drm_driver qxl_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
-	.get_vblank_counter = qxl_noop_get_vblank_counter,
-	.enable_vblank = qxl_noop_enable_vblank,
-	.disable_vblank = qxl_noop_disable_vblank,
 
 	.set_busid = drm_pci_set_busid,
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 16/23] drm: rcar-du: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (14 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 15/23] drm: qxl: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 14:03   ` Laurent Pinchart
  2017-02-07  9:16 ` [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs Shawn Guo
                   ` (8 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 29 +++++++++++++++++++----------
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  1 -
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 19 -------------------
 3 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index a2ec6d8796a0..edcbe2e3625d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -529,6 +529,23 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
 	.atomic_flush = rcar_du_crtc_atomic_flush,
 };
 
+static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
+
+	rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
+	rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
+
+	return 0;
+}
+
+static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
+
+	rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE);
+}
+
 static const struct drm_crtc_funcs crtc_funcs = {
 	.reset = drm_atomic_helper_crtc_reset,
 	.destroy = drm_crtc_cleanup,
@@ -536,6 +553,8 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
 	.page_flip = drm_atomic_helper_page_flip,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = rcar_du_crtc_enable_vblank,
+	.disable_vblank = rcar_du_crtc_disable_vblank,
 };
 
 /* -----------------------------------------------------------------------------
@@ -650,13 +669,3 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
 
 	return 0;
 }
-
-void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable)
-{
-	if (enable) {
-		rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
-		rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
-	} else {
-		rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE);
-	}
-}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 6f08b7e7db06..a7194812997e 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -66,7 +66,6 @@ enum rcar_du_output {
 };
 
 int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index);
-void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable);
 void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc);
 void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc);
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 094da3ef49d1..192346d4fb34 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -26,7 +26,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 
-#include "rcar_du_crtc.h"
 #include "rcar_du_drv.h"
 #include "rcar_du_kms.h"
 #include "rcar_du_regs.h"
@@ -227,22 +226,6 @@ static void rcar_du_lastclose(struct drm_device *dev)
 	drm_fbdev_cma_restore_mode(rcdu->fbdev);
 }
 
-static int rcar_du_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct rcar_du_device *rcdu = dev->dev_private;
-
-	rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], true);
-
-	return 0;
-}
-
-static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct rcar_du_device *rcdu = dev->dev_private;
-
-	rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], false);
-}
-
 static const struct file_operations rcar_du_fops = {
 	.owner		= THIS_MODULE,
 	.open		= drm_open,
@@ -259,8 +242,6 @@ static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
 				| DRIVER_ATOMIC,
 	.lastclose		= rcar_du_lastclose,
-	.enable_vblank		= rcar_du_enable_vblank,
-	.disable_vblank		= rcar_du_disable_vblank,
 	.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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (15 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 16/23] drm: rcar-du: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 15:35   ` Sean Paul
  2017-02-07  9:16 ` [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs Shawn Guo
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

With the vblank hooks in struct drm_crtc_funcs, we do not need to
maintain struct rockchip_crtc_funcs and the related registration
functions.  Remove them.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Yao <mark.yao@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 51 -----------------------------
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 14 --------
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  9 ++---
 3 files changed, 2 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 39243480c834..7719b9cd5b74 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -74,55 +74,6 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
 	arm_iommu_detach_device(dev);
 }
 
-int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
-				 const struct rockchip_crtc_funcs *crtc_funcs)
-{
-	int pipe = drm_crtc_index(crtc);
-	struct rockchip_drm_private *priv = crtc->dev->dev_private;
-
-	if (pipe >= ROCKCHIP_MAX_CRTC)
-		return -EINVAL;
-
-	priv->crtc_funcs[pipe] = crtc_funcs;
-
-	return 0;
-}
-
-void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)
-{
-	int pipe = drm_crtc_index(crtc);
-	struct rockchip_drm_private *priv = crtc->dev->dev_private;
-
-	if (pipe >= ROCKCHIP_MAX_CRTC)
-		return;
-
-	priv->crtc_funcs[pipe] = NULL;
-}
-
-static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev,
-					   unsigned int pipe)
-{
-	struct rockchip_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
-
-	if (crtc && priv->crtc_funcs[pipe] &&
-	    priv->crtc_funcs[pipe]->enable_vblank)
-		return priv->crtc_funcs[pipe]->enable_vblank(crtc);
-
-	return 0;
-}
-
-static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev,
-					     unsigned int pipe)
-{
-	struct rockchip_drm_private *priv = dev->dev_private;
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
-
-	if (crtc && priv->crtc_funcs[pipe] &&
-	    priv->crtc_funcs[pipe]->enable_vblank)
-		priv->crtc_funcs[pipe]->disable_vblank(crtc);
-}
-
 static int rockchip_drm_bind(struct device *dev)
 {
 	struct drm_device *drm_dev;
@@ -270,8 +221,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
 				  DRIVER_PRIME | DRIVER_ATOMIC,
 	.lastclose		= rockchip_drm_lastclose,
-	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
-	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
 	.gem_vm_ops		= &drm_gem_cma_vm_ops,
 	.gem_free_object_unlocked = rockchip_gem_free_object,
 	.dumb_create		= rockchip_gem_dumb_create,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index fb6226cf84b7..9f9bc959b108 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -31,16 +31,6 @@
 struct drm_device;
 struct drm_connector;
 
-/*
- * Rockchip drm private crtc funcs.
- * @enable_vblank: enable crtc vblank irq.
- * @disable_vblank: disable crtc vblank irq.
- */
-struct rockchip_crtc_funcs {
-	int (*enable_vblank)(struct drm_crtc *crtc);
-	void (*disable_vblank)(struct drm_crtc *crtc);
-};
-
 struct rockchip_crtc_state {
 	struct drm_crtc_state base;
 	int output_type;
@@ -58,16 +48,12 @@ struct rockchip_crtc_state {
 struct rockchip_drm_private {
 	struct drm_fb_helper fbdev_helper;
 	struct drm_gem_object *fbdev_bo;
-	const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
 	struct drm_atomic_state *state;
 
 	struct list_head psr_list;
 	spinlock_t psr_list_lock;
 };
 
-int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
-				 const struct rockchip_crtc_funcs *crtc_funcs);
-void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc);
 int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
 				   struct device *dev);
 void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index fb5f001f51c3..ffee8d8c3794 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -853,11 +853,6 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&vop->irq_lock, flags);
 }
 
-static const struct rockchip_crtc_funcs private_crtc_funcs = {
-	.enable_vblank = vop_crtc_enable_vblank,
-	.disable_vblank = vop_crtc_disable_vblank,
-};
-
 static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
 				const struct drm_display_mode *mode,
 				struct drm_display_mode *adjusted_mode)
@@ -1112,6 +1107,8 @@ static void vop_crtc_destroy_state(struct drm_crtc *crtc,
 	.reset = vop_crtc_reset,
 	.atomic_duplicate_state = vop_crtc_duplicate_state,
 	.atomic_destroy_state = vop_crtc_destroy_state,
+	.enable_vblank = vop_crtc_enable_vblank,
+	.disable_vblank = vop_crtc_disable_vblank,
 };
 
 static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
@@ -1283,7 +1280,6 @@ static int vop_create_crtc(struct vop *vop)
 	init_completion(&vop->dsp_hold_completion);
 	init_completion(&vop->line_flag_completion);
 	crtc->port = port;
-	rockchip_register_crtc_funcs(crtc, &private_crtc_funcs);
 
 	return 0;
 
@@ -1302,7 +1298,6 @@ static void vop_destroy_crtc(struct vop *vop)
 	struct drm_device *drm_dev = vop->drm_dev;
 	struct drm_plane *plane, *tmp;
 
-	rockchip_unregister_crtc_funcs(crtc);
 	of_node_put(crtc->port);
 
 	/*
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (16 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 14:05   ` Laurent Pinchart
  2017-02-07  9:16 ` [PATCH v3 19/23] drm: sun4i: " Shawn Guo
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.

As the result, shmob_drm_crtc_enable_vblank() becomes a static function,
although it gets moved around a bit to save forward declaration.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 51 +++++++++++++++++++++----------
 drivers/gpu/drm/shmobile/shmob_drm_crtc.h |  1 -
 drivers/gpu/drm/shmobile/shmob_drm_drv.c  | 19 ------------
 3 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 445476551695..8244890e6d53 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -476,10 +476,45 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
 	return 0;
 }
 
+static void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev,
+					 bool enable)
+{
+	unsigned long flags;
+	u32 ldintr;
+
+	/* Be careful not to acknowledge any pending interrupt. */
+	spin_lock_irqsave(&sdev->irq_lock, flags);
+	ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
+	if (enable)
+		ldintr |= LDINTR_VEE;
+	else
+		ldintr &= ~LDINTR_VEE;
+	lcdc_write(sdev, LDINTR, ldintr);
+	spin_unlock_irqrestore(&sdev->irq_lock, flags);
+}
+
+static int shmob_drm_enable_vblank(struct drm_crtc *crtc)
+{
+	struct shmob_drm_device *sdev = crtc->dev->dev_private;
+
+	shmob_drm_crtc_enable_vblank(sdev, true);
+
+	return 0;
+}
+
+static void shmob_drm_disable_vblank(struct drm_crtc *crtc)
+{
+	struct shmob_drm_device *sdev = crtc->dev->dev_private;
+
+	shmob_drm_crtc_enable_vblank(sdev, false);
+}
+
 static const struct drm_crtc_funcs crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_crtc_helper_set_config,
 	.page_flip = shmob_drm_crtc_page_flip,
+	.enable_vblank = shmob_drm_enable_vblank,
+	.disable_vblank = shmob_drm_disable_vblank,
 };
 
 int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
@@ -594,22 +629,6 @@ int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
 	return 0;
 }
 
-void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool enable)
-{
-	unsigned long flags;
-	u32 ldintr;
-
-	/* Be careful not to acknowledge any pending interrupt. */
-	spin_lock_irqsave(&sdev->irq_lock, flags);
-	ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
-	if (enable)
-		ldintr |= LDINTR_VEE;
-	else
-		ldintr &= ~LDINTR_VEE;
-	lcdc_write(sdev, LDINTR, ldintr);
-	spin_unlock_irqrestore(&sdev->irq_lock, flags);
-}
-
 /* -----------------------------------------------------------------------------
  * Connector
  */
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h b/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
index 818b31549ddc..f152973df11c 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
@@ -47,7 +47,6 @@ struct shmob_drm_connector {
 };
 
 int shmob_drm_crtc_create(struct shmob_drm_device *sdev);
-void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool enable);
 void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc);
 void shmob_drm_crtc_suspend(struct shmob_drm_crtc *scrtc);
 void shmob_drm_crtc_resume(struct shmob_drm_crtc *scrtc);
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index d6b0545d252d..34fefa0ba0f0 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 
-#include "shmob_drm_crtc.h"
 #include "shmob_drm_drv.h"
 #include "shmob_drm_kms.h"
 #include "shmob_drm_plane.h"
@@ -222,22 +221,6 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-static int shmob_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct shmob_drm_device *sdev = dev->dev_private;
-
-	shmob_drm_crtc_enable_vblank(sdev, true);
-
-	return 0;
-}
-
-static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	struct shmob_drm_device *sdev = dev->dev_private;
-
-	shmob_drm_crtc_enable_vblank(sdev, false);
-}
-
 static const struct file_operations shmob_drm_fops = {
 	.owner		= THIS_MODULE,
 	.open		= drm_open,
@@ -256,8 +239,6 @@ static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
 	.load			= shmob_drm_load,
 	.unload			= shmob_drm_unload,
 	.irq_handler		= shmob_drm_irq,
-	.enable_vblank		= shmob_drm_enable_vblank,
-	.disable_vblank		= shmob_drm_disable_vblank,
 	.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,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 19/23] drm: sun4i: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (17 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07  9:28   ` Maxime Ripard
  2017-02-07  9:16 ` [PATCH v3 20/23] drm: tegra: " Shawn Guo
                   ` (5 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_crtc.c | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/sun4i/sun4i_drv.c  | 27 ---------------------------
 2 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 4a192210574f..a5d546a68e16 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -104,6 +104,28 @@ static void sun4i_crtc_enable(struct drm_crtc *crtc)
 	.enable		= sun4i_crtc_enable,
 };
 
+static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
+	struct sun4i_drv *drv = scrtc->drv;
+
+	DRM_DEBUG_DRIVER("Enabling VBLANK on crtc %p\n", crtc);
+
+	sun4i_tcon_enable_vblank(drv->tcon, true);
+
+	return 0;
+}
+
+static void sun4i_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+	struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
+	struct sun4i_drv *drv = scrtc->drv;
+
+	DRM_DEBUG_DRIVER("Disabling VBLANK on crtc %p\n", crtc);
+
+	sun4i_tcon_enable_vblank(drv->tcon, false);
+}
+
 static const struct drm_crtc_funcs sun4i_crtc_funcs = {
 	.atomic_destroy_state	= drm_atomic_helper_crtc_destroy_state,
 	.atomic_duplicate_state	= drm_atomic_helper_crtc_duplicate_state,
@@ -111,6 +133,8 @@ static void sun4i_crtc_enable(struct drm_crtc *crtc)
 	.page_flip		= drm_atomic_helper_page_flip,
 	.reset			= drm_atomic_helper_crtc_reset,
 	.set_config		= drm_atomic_helper_set_config,
+	.enable_vblank		= sun4i_crtc_enable_vblank,
+	.disable_vblank		= sun4i_crtc_disable_vblank,
 };
 
 struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 0816c635df20..9ccf7c4deb6d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -24,29 +24,6 @@
 #include "sun4i_drv.h"
 #include "sun4i_framebuffer.h"
 #include "sun4i_layer.h"
-#include "sun4i_tcon.h"
-
-static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct sun4i_drv *drv = drm->dev_private;
-	struct sun4i_tcon *tcon = drv->tcon;
-
-	DRM_DEBUG_DRIVER("Enabling VBLANK on pipe %d\n", pipe);
-
-	sun4i_tcon_enable_vblank(tcon, true);
-
-	return 0;
-}
-
-static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct sun4i_drv *drv = drm->dev_private;
-	struct sun4i_tcon *tcon = drv->tcon;
-
-	DRM_DEBUG_DRIVER("Disabling VBLANK on pipe %d\n", pipe);
-
-	sun4i_tcon_enable_vblank(tcon, false);
-}
 
 static const struct file_operations sun4i_drv_fops = {
 	.owner		= THIS_MODULE,
@@ -90,10 +67,6 @@ static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
 	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
 
 	/* Frame Buffer Operations */
-
-	/* VBlank Operations */
-	.enable_vblank		= sun4i_drv_enable_vblank,
-	.disable_vblank		= sun4i_drv_disable_vblank,
 };
 
 static void sun4i_remove_framebuffers(void)
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 20/23] drm: tegra: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (18 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 19/23] drm: sun4i: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 11:02   ` Thierry Reding
  2017-02-07  9:16 ` [PATCH v3 21/23] drm: tilcdc: " Shawn Guo
                   ` (4 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.

As the result, the wrapper functions tegra_drm_xxx get killed
completely, and tegra_dc_xxx are filled into struct drm_crtc_funcs as
vblank hooks directly.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
---
 drivers/gpu/drm/tegra/dc.c  | 15 ++++++++++++---
 drivers/gpu/drm/tegra/drm.c | 38 --------------------------------------
 drivers/gpu/drm/tegra/drm.h |  3 ---
 3 files changed, 12 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 7561a95a54e3..0db5d5a8d3b9 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -909,8 +909,10 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc)
 	return 0;
 }
 
-u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc)
+static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc)
 {
+	struct tegra_dc *dc = to_tegra_dc(crtc);
+
 	if (dc->syncpt)
 		return host1x_syncpt_read(dc->syncpt);
 
@@ -918,8 +920,9 @@ u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc)
 	return drm_crtc_vblank_count(&dc->base);
 }
 
-void tegra_dc_enable_vblank(struct tegra_dc *dc)
+static int tegra_dc_enable_vblank(struct drm_crtc *crtc)
 {
+	struct tegra_dc *dc = to_tegra_dc(crtc);
 	unsigned long value, flags;
 
 	spin_lock_irqsave(&dc->lock, flags);
@@ -929,10 +932,13 @@ void tegra_dc_enable_vblank(struct tegra_dc *dc)
 	tegra_dc_writel(dc, value, DC_CMD_INT_MASK);
 
 	spin_unlock_irqrestore(&dc->lock, flags);
+
+	return 0;
 }
 
-void tegra_dc_disable_vblank(struct tegra_dc *dc)
+static void tegra_dc_disable_vblank(struct drm_crtc *crtc)
 {
+	struct tegra_dc *dc = to_tegra_dc(crtc);
 	unsigned long value, flags;
 
 	spin_lock_irqsave(&dc->lock, flags);
@@ -1036,6 +1042,9 @@ static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc,
 	.reset = tegra_crtc_reset,
 	.atomic_duplicate_state = tegra_crtc_atomic_duplicate_state,
 	.atomic_destroy_state = tegra_crtc_atomic_destroy_state,
+	.get_vblank_counter = tegra_dc_get_vblank_counter,
+	.enable_vblank = tegra_dc_enable_vblank,
+	.disable_vblank = tegra_dc_disable_vblank,
 };
 
 static int tegra_dc_set_timings(struct tegra_dc *dc,
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index ef215fef63d6..dba4e090d3df 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -804,40 +804,6 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data,
 	.llseek = noop_llseek,
 };
 
-static u32 tegra_drm_get_vblank_counter(struct drm_device *drm,
-					unsigned int pipe)
-{
-	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
-	struct tegra_dc *dc = to_tegra_dc(crtc);
-
-	if (!crtc)
-		return 0;
-
-	return tegra_dc_get_vblank_counter(dc);
-}
-
-static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
-	struct tegra_dc *dc = to_tegra_dc(crtc);
-
-	if (!crtc)
-		return -ENODEV;
-
-	tegra_dc_enable_vblank(dc);
-
-	return 0;
-}
-
-static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
-	struct tegra_dc *dc = to_tegra_dc(crtc);
-
-	if (crtc)
-		tegra_dc_disable_vblank(dc);
-}
-
 static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file)
 {
 	struct tegra_drm_file *fpriv = file->driver_priv;
@@ -905,10 +871,6 @@ static int tegra_debugfs_init(struct drm_minor *minor)
 	.preclose = tegra_drm_preclose,
 	.lastclose = tegra_drm_lastclose,
 
-	.get_vblank_counter = tegra_drm_get_vblank_counter,
-	.enable_vblank = tegra_drm_enable_vblank,
-	.disable_vblank = tegra_drm_disable_vblank,
-
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = tegra_debugfs_init,
 #endif
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 5205790dd679..5747accb2271 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -193,9 +193,6 @@ struct tegra_dc_window {
 };
 
 /* from dc.c */
-u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc);
-void tegra_dc_enable_vblank(struct tegra_dc *dc);
-void tegra_dc_disable_vblank(struct tegra_dc *dc);
 void tegra_dc_commit(struct tegra_dc *dc);
 int tegra_dc_state_setup_clock(struct tegra_dc *dc,
 			       struct drm_crtc_state *crtc_state,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 21/23] drm: tilcdc: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (19 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 20/23] drm: tegra: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07  9:38   ` Jyri Sarha
  2017-02-07  9:16 ` [PATCH v3 22/23] drm: vc4: " Shawn Guo
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.

While at it, the 'return' of .disable_vblank is dropped to fix the
following checkpatch warning.

 WARNING: void function return statements are not generally useful

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 11 +++++++++++
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 12 ------------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index f80bf9385e41..93505bcfdf4b 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -695,6 +695,15 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
 	return 0;
 }
 
+static int tilcdc_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+	return 0;
+}
+
+static void tilcdc_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+}
+
 static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
 	.destroy        = tilcdc_crtc_destroy,
 	.set_config     = drm_atomic_helper_set_config,
@@ -702,6 +711,8 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
 	.reset		= drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank	= tilcdc_crtc_enable_vblank,
+	.disable_vblank	= tilcdc_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index d5bc98e283d9..81d80a2ffeb1 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -437,16 +437,6 @@ static irqreturn_t tilcdc_irq(int irq, void *arg)
 	return tilcdc_crtc_irq(priv->crtc);
 }
 
-static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	return 0;
-}
-
-static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-	return;
-}
-
 #if defined(CONFIG_DEBUG_FS)
 static const struct {
 	const char *name;
@@ -557,8 +547,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
 			       DRIVER_PRIME | DRIVER_ATOMIC),
 	.lastclose          = tilcdc_lastclose,
 	.irq_handler        = tilcdc_irq,
-	.enable_vblank      = tilcdc_enable_vblank,
-	.disable_vblank     = tilcdc_disable_vblank,
 	.gem_free_object_unlocked = drm_gem_cma_free_object,
 	.gem_vm_ops         = &drm_gem_cma_vm_ops,
 	.dumb_create        = drm_gem_cma_dumb_create,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 22/23] drm: vc4: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (20 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 21/23] drm: tilcdc: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-08 19:56   ` Eric Anholt
  2017-02-07  9:16 ` [PATCH v3 23/23] drm: zte: " Shawn Guo
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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: Shawn Guo <shawn.guo@linaro.org>
Cc: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 8 ++++----
 drivers/gpu/drm/vc4/vc4_drv.c  | 2 --
 drivers/gpu/drm/vc4/vc4_drv.h  | 2 --
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 93aece203c54..87b4445cb286 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -654,9 +654,8 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id)
+static int vc4_enable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 
 	CRTC_WRITE(PV_INTEN, PV_INT_VFP_START);
@@ -664,9 +663,8 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id)
 	return 0;
 }
 
-void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id)
+static void vc4_disable_vblank(struct drm_crtc *crtc)
 {
-	struct drm_crtc *crtc = drm_crtc_from_index(dev, crtc_id);
 	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
 
 	CRTC_WRITE(PV_INTEN, 0);
@@ -857,6 +855,8 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
 	.atomic_duplicate_state = vc4_crtc_duplicate_state,
 	.atomic_destroy_state = vc4_crtc_destroy_state,
 	.gamma_set = vc4_crtc_gamma_set,
+	.enable_vblank = vc4_enable_vblank,
+	.disable_vblank = vc4_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 3a8709d85da1..4f93328a2f20 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -137,8 +137,6 @@ static void vc4_lastclose(struct drm_device *dev)
 	.irq_postinstall = vc4_irq_postinstall,
 	.irq_uninstall = vc4_irq_uninstall,
 
-	.enable_vblank = vc4_enable_vblank,
-	.disable_vblank = vc4_disable_vblank,
 	.get_scanout_position = vc4_crtc_get_scanoutpos,
 	.get_vblank_timestamp = vc4_crtc_get_vblank_timestamp,
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 0e59f3ee1b83..dffce6293d87 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -444,8 +444,6 @@ int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
 
 /* vc4_crtc.c */
 extern struct platform_driver vc4_crtc_driver;
-int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id);
-void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id);
 bool vc4_event_pending(struct drm_crtc *crtc);
 int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg);
 int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH v3 23/23] drm: zte: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (21 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 22/23] drm: vc4: " Shawn Guo
@ 2017-02-07  9:16 ` Shawn Guo
  2017-02-07 15:34   ` Sean Paul
  2017-02-08 11:30 ` [PATCH v3 00/23] Add vblank hooks to " Tomi Valkeinen
  2017-02-08 15:49 ` Sean Paul
  24 siblings, 1 reply; 68+ messages in thread
From: Shawn Guo @ 2017-02-07  9:16 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

From: Shawn Guo <shawn.guo@linaro.org>

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.

The functions are moved around to save forward declaration.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/gpu/drm/zte/zx_drm_drv.c |  2 --
 drivers/gpu/drm/zte/zx_vou.c     | 61 +++++++++++++++-------------------------
 drivers/gpu/drm/zte/zx_vou.h     |  3 --
 3 files changed, 23 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index afd713a954c6..b24a70ba4b83 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -71,8 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
 	.lastclose = zx_drm_lastclose,
-	.enable_vblank = zx_vou_enable_vblank,
-	.disable_vblank = zx_vou_disable_vblank,
 	.gem_free_object = drm_gem_cma_free_object,
 	.gem_vm_ops = &drm_gem_cma_vm_ops,
 	.dumb_create = drm_gem_cma_dumb_create,
diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
index cf92d675feaa..b500c8dd0d9d 100644
--- a/drivers/gpu/drm/zte/zx_vou.c
+++ b/drivers/gpu/drm/zte/zx_vou.c
@@ -470,6 +470,27 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
 	.atomic_flush = zx_crtc_atomic_flush,
 };
 
+static int zx_vou_enable_vblank(struct drm_crtc *crtc)
+{
+	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
+	struct zx_vou_hw *vou = crtc_to_vou(crtc);
+	u32 int_frame_mask = zcrtc->bits->int_frame_mask;
+
+	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
+		       int_frame_mask);
+
+	return 0;
+}
+
+static void zx_vou_disable_vblank(struct drm_crtc *crtc)
+{
+	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
+	struct zx_vou_hw *vou = crtc_to_vou(crtc);
+
+	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
+		       zcrtc->bits->int_frame_mask, 0);
+}
+
 static const struct drm_crtc_funcs zx_crtc_funcs = {
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
@@ -477,6 +498,8 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+	.enable_vblank = zx_vou_enable_vblank,
+	.disable_vblank = zx_vou_disable_vblank,
 };
 
 static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
@@ -553,44 +576,6 @@ static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
 	return 0;
 }
 
-int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc;
-	struct zx_crtc *zcrtc;
-	struct zx_vou_hw *vou;
-	u32 int_frame_mask;
-
-	crtc = drm_crtc_from_index(drm, pipe);
-	if (!crtc)
-		return 0;
-
-	vou = crtc_to_vou(crtc);
-	zcrtc = to_zx_crtc(crtc);
-	int_frame_mask = zcrtc->bits->int_frame_mask;
-
-	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
-		       int_frame_mask);
-
-	return 0;
-}
-
-void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe)
-{
-	struct drm_crtc *crtc;
-	struct zx_crtc *zcrtc;
-	struct zx_vou_hw *vou;
-
-	crtc = drm_crtc_from_index(drm, pipe);
-	if (!crtc)
-		return;
-
-	vou = crtc_to_vou(crtc);
-	zcrtc = to_zx_crtc(crtc);
-
-	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
-		       zcrtc->bits->int_frame_mask, 0);
-}
-
 void zx_vou_layer_enable(struct drm_plane *plane)
 {
 	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
index 57e3c31ee6a5..97d72bfce982 100644
--- a/drivers/gpu/drm/zte/zx_vou.h
+++ b/drivers/gpu/drm/zte/zx_vou.h
@@ -61,9 +61,6 @@ struct vou_div_config {
 void zx_vou_config_dividers(struct drm_crtc *crtc,
 			    struct vou_div_config *configs, int num);
 
-int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe);
-void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe);
-
 void zx_vou_layer_enable(struct drm_plane *plane);
 void zx_vou_layer_disable(struct drm_plane *plane);
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
@ 2017-02-07  9:27   ` Maxime Ripard
  2017-02-07  9:46   ` Boris Brezillon
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 68+ messages in thread
From: Maxime Ripard @ 2017-02-07  9:27 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2894 bytes --]

On Tue, Feb 07, 2017 at 05:16:14PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
>  drivers/gpu/drm/arm/malidp_drv.c                | 1 -
>  drivers/gpu/drm/armada/armada_drv.c             | 1 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
>  drivers/gpu/drm/i915/i915_irq.c                 | 1 -
>  drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
>  drivers/gpu/drm/meson/meson_drv.c               | 1 -
>  drivers/gpu/drm/msm/msm_drv.c                   | 1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
>  drivers/gpu/drm/sti/sti_drv.c                   | 1 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -

For sun4i,

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 19/23] drm: sun4i: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 19/23] drm: sun4i: " Shawn Guo
@ 2017-02-07  9:28   ` Maxime Ripard
  0 siblings, 0 replies; 68+ messages in thread
From: Maxime Ripard @ 2017-02-07  9:28 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 595 bytes --]

On Tue, Feb 07, 2017 at 05:16:31PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 21/23] drm: tilcdc: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 21/23] drm: tilcdc: " Shawn Guo
@ 2017-02-07  9:38   ` Jyri Sarha
  0 siblings, 0 replies; 68+ messages in thread
From: Jyri Sarha @ 2017-02-07  9:38 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, dri-devel,
	Maxime Ripard

On 02/07/17 11:16, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.
> 
> While at it, the 'return' of .disable_vblank is dropped to fix the
> following checkpatch warning.
> 
>  WARNING: void function return statements are not generally useful
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Jyri Sarha <jsarha@ti.com>

Acked-by: Jyri Sarha <jsarha@ti.com>

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 11 +++++++++++
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 12 ------------
>  2 files changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index f80bf9385e41..93505bcfdf4b 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -695,6 +695,15 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
>  	return 0;
>  }
>  
> +static int tilcdc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	return 0;
> +}
> +
> +static void tilcdc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +}
> +
>  static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
>  	.destroy        = tilcdc_crtc_destroy,
>  	.set_config     = drm_atomic_helper_set_config,
> @@ -702,6 +711,8 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
>  	.reset		= drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank	= tilcdc_crtc_enable_vblank,
> +	.disable_vblank	= tilcdc_crtc_disable_vblank,
>  };
>  
>  static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index d5bc98e283d9..81d80a2ffeb1 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -437,16 +437,6 @@ static irqreturn_t tilcdc_irq(int irq, void *arg)
>  	return tilcdc_crtc_irq(priv->crtc);
>  }
>  
> -static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	return 0;
> -}
> -
> -static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	return;
> -}
> -
>  #if defined(CONFIG_DEBUG_FS)
>  static const struct {
>  	const char *name;
> @@ -557,8 +547,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
>  	.lastclose          = tilcdc_lastclose,
>  	.irq_handler        = tilcdc_irq,
> -	.enable_vblank      = tilcdc_enable_vblank,
> -	.disable_vblank     = tilcdc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
>  	.gem_vm_ops         = &drm_gem_cma_vm_ops,
>  	.dumb_create        = drm_gem_cma_dumb_create,
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
  2017-02-07  9:27   ` Maxime Ripard
@ 2017-02-07  9:46   ` Boris Brezillon
  2017-02-07 10:09   ` Neil Armstrong
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 68+ messages in thread
From: Boris Brezillon @ 2017-02-07  9:46 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel, Maxime Ripard

On Tue,  7 Feb 2017 17:16:14 +0800
Shawn Guo <shawnguo@kernel.org> wrote:

> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
>  drivers/gpu/drm/arm/malidp_drv.c                | 1 -
>  drivers/gpu/drm/armada/armada_drv.c             | 1 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
>  drivers/gpu/drm/i915/i915_irq.c                 | 1 -
>  drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
>  drivers/gpu/drm/meson/meson_drv.c               | 1 -
>  drivers/gpu/drm/msm/msm_drv.c                   | 1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
>  drivers/gpu/drm/sti/sti_drv.c                   | 1 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             | 1 -
>  drivers/gpu/drm/vc4/vc4_drv.c                   | 1 -
>  drivers/gpu/drm/zte/zx_drm_drv.c                | 1 -
>  25 files changed, 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 8d8344ed655e..1926b200e4cb 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -175,7 +175,6 @@ static int arcpgu_unload(struct drm_device *drm)
>  	.dumb_create = drm_gem_cma_dumb_create,
>  	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
>  	.dumb_destroy = drm_gem_dumb_destroy,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>  	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 4ce4f970920b..5d79e87f7421 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -278,7 +278,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
>  	.irq_preinstall = hdlcd_irq_preinstall,
>  	.irq_postinstall = hdlcd_irq_postinstall,
>  	.irq_uninstall = hdlcd_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = hdlcd_enable_vblank,
>  	.disable_vblank = hdlcd_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 8b0672d4aee9..ca6ccd172de3 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -213,7 +213,6 @@ static void malidp_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
>  			   DRIVER_PRIME,
>  	.lastclose = malidp_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = malidp_enable_vblank,
>  	.disable_vblank = malidp_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 63f42d001f33..bb27892012de 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -87,7 +87,6 @@ static void armada_drm_lastclose(struct drm_device *dev)
>  
>  static struct drm_driver armada_drm_driver = {
>  	.lastclose		= armada_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= armada_drm_enable_vblank,
>  	.disable_vblank		= armada_drm_disable_vblank,
>  	.gem_free_object_unlocked = armada_gem_free_object,
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 427bdff425c2..5cba65b5ea16 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -760,7 +760,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
>  	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 035d02ecffcd..a1c22eb12f4b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -263,7 +263,6 @@ static void exynos_drm_lastclose(struct drm_device *dev)
>  	.preclose		= exynos_drm_preclose,
>  	.lastclose		= exynos_drm_lastclose,
>  	.postclose		= exynos_drm_postclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= exynos_drm_crtc_enable_vblank,
>  	.disable_vblank		= exynos_drm_crtc_disable_vblank,
>  	.gem_free_object_unlocked = exynos_drm_gem_free_object,
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 04173235f448..b59b816a1d7d 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -203,7 +203,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
>  	.irq_handler		= fsl_dcu_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= fsl_dcu_drm_enable_vblank,
>  	.disable_vblank		= fsl_dcu_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 7e2043f4348c..8cac70454b57 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -84,7 +84,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	.desc			= "hibmc drm driver",
>  	.major			= 1,
>  	.minor			= 0,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= hibmc_enable_vblank,
>  	.disable_vblank		= hibmc_disable_vblank,
>  	.gem_free_object_unlocked = hibmc_gem_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 9a0678a33e0d..0624fab8046f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -1025,7 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
>  			       IRQF_SHARED, dev->driver->name, acrtc);
>  	if (ret)
>  		return ret;
> -	dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	dev->driver->enable_vblank = ade_enable_vblank;
>  	dev->driver->disable_vblank = ade_disable_vblank;
>  
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 47d6131e977f..5aab08172faf 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4218,7 +4218,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  	if (IS_GEN2(dev_priv)) {
>  		/* Gen2 doesn't have a hardware frame counter */
>  		dev->max_vblank_count = 0;
> -		dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
>  		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
>  		dev->driver->get_vblank_counter = g4x_get_vblank_counter;
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 5ae48836652e..4badbb66d69e 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -288,7 +288,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
>  	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
>  	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
>  	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= imx_drm_enable_vblank,
>  	.disable_vblank		= imx_drm_disable_vblank,
>  	.ioctls			= imx_drm_ioctls,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index b5f88e6d078e..ef8675336465 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -256,7 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = mtk_drm_crtc_enable_vblank,
>  	.disable_vblank = mtk_drm_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 6f2fd82ed483..c0a59889c45f 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -129,7 +129,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
>  	/* Vblank */
>  	.enable_vblank		= meson_enable_vblank,
>  	.disable_vblank		= meson_disable_vblank,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  
>  	/* IRQ */
>  	.irq_handler		= meson_irq,
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 70226eaa5cac..cb47f4a14215 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -816,7 +816,6 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
>  	.irq_preinstall     = msm_irq_preinstall,
>  	.irq_postinstall    = msm_irq_postinstall,
>  	.irq_uninstall      = msm_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = msm_enable_vblank,
>  	.disable_vblank     = msm_disable_vblank,
>  	.gem_free_object    = msm_gem_free_object,
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index cdfbe0284635..104722a78bd6 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -340,7 +340,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
>  	.irq_handler		= mxsfb_irq_handler,
>  	.irq_preinstall		= mxsfb_irq_preinstall,
>  	.irq_uninstall		= mxsfb_irq_preinstall,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= mxsfb_enable_vblank,
>  	.disable_vblank		= mxsfb_disable_vblank,
>  	.gem_free_object	= drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 9ed2ca0769e3..626df485a03a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -977,7 +977,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>  	.debugfs_cleanup = nouveau_drm_debugfs_cleanup,
>  #endif
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = nouveau_display_vblank_enable,
>  	.disable_vblank = nouveau_display_vblank_disable,
>  	.get_scanout_position = nouveau_display_scanoutpos,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index afe8f05b927b..da049a7636ad 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -714,7 +714,6 @@ static void dev_lastclose(struct drm_device *dev)
>  		DRIVER_ATOMIC,
>  	.open = dev_open,
>  	.lastclose = dev_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = omap_irq_enable_vblank,
>  	.disable_vblank = omap_irq_disable_vblank,
>  #ifdef CONFIG_DEBUG_FS
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index c05e00872778..094da3ef49d1 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -259,7 +259,6 @@ static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
>  				| DRIVER_ATOMIC,
>  	.lastclose		= rcar_du_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rcar_du_enable_vblank,
>  	.disable_vblank		= rcar_du_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index c30d649cb147..39243480c834 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -270,7 +270,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
>  				  DRIVER_PRIME | DRIVER_ATOMIC,
>  	.lastclose		= rockchip_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
>  	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
>  	.gem_vm_ops		= &drm_gem_cma_vm_ops,
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 33cec3d42389..d6b0545d252d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -256,7 +256,6 @@ static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.load			= shmob_drm_load,
>  	.unload			= shmob_drm_unload,
>  	.irq_handler		= shmob_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= shmob_drm_enable_vblank,
>  	.disable_vblank		= shmob_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 788feed208d7..d4b771d2d10d 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -264,7 +264,6 @@ static void sti_mode_config_init(struct drm_device *dev)
>  	.dumb_destroy = drm_gem_dumb_destroy,
>  	.fops = &sti_driver_fops,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = sti_crtc_enable_vblank,
>  	.disable_vblank = sti_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 4ce665349f6b..0816c635df20 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -92,7 +92,6 @@ static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
>  	/* Frame Buffer Operations */
>  
>  	/* VBlank Operations */
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= sun4i_drv_enable_vblank,
>  	.disable_vblank		= sun4i_drv_disable_vblank,
>  };
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 372d86fbb093..d5bc98e283d9 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -557,7 +557,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
>  	.lastclose          = tilcdc_lastclose,
>  	.irq_handler        = tilcdc_irq,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = tilcdc_enable_vblank,
>  	.disable_vblank     = tilcdc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index a459745e96f7..3a8709d85da1 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -139,7 +139,6 @@ static void vc4_lastclose(struct drm_device *dev)
>  
>  	.enable_vblank = vc4_enable_vblank,
>  	.disable_vblank = vc4_disable_vblank,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.get_scanout_position = vc4_crtc_get_scanoutpos,
>  	.get_vblank_timestamp = vc4_crtc_get_vblank_timestamp,
>  
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index 5c6944a1e72c..afd713a954c6 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -71,7 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  	.lastclose = zx_drm_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = zx_vou_enable_vblank,
>  	.disable_vblank = zx_vou_disable_vblank,
>  	.gem_free_object = drm_gem_cma_free_object,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 07/23] drm: atmel: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 07/23] drm: atmel: " Shawn Guo
@ 2017-02-07  9:46   ` Boris Brezillon
  0 siblings, 0 replies; 68+ messages in thread
From: Boris Brezillon @ 2017-02-07  9:46 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel, Maxime Ripard

On Tue,  7 Feb 2017 17:16:19 +0800
Shawn Guo <shawnguo@kernel.org> wrote:

> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 21 +++++++++++++++++++++
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c   | 21 ---------------------
>  2 files changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 9b17a66cf0e1..fabeeea0e899 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -434,6 +434,25 @@ static void atmel_hlcdc_crtc_destroy_state(struct drm_crtc *crtc,
>  	kfree(state);
>  }
>  
> +static int atmel_hlcdc_crtc_enable_vblank(struct drm_crtc *c)
> +{
> +	struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
> +	struct regmap *regmap = crtc->dc->hlcdc->regmap;
> +
> +	/* Enable SOF (Start Of Frame) interrupt for vblank counting */
> +	regmap_write(regmap, ATMEL_HLCDC_IER, ATMEL_HLCDC_SOF);
> +
> +	return 0;
> +}
> +
> +static void atmel_hlcdc_crtc_disable_vblank(struct drm_crtc *c)
> +{
> +	struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
> +	struct regmap *regmap = crtc->dc->hlcdc->regmap;
> +
> +	regmap_write(regmap, ATMEL_HLCDC_IDR, ATMEL_HLCDC_SOF);
> +}
> +
>  static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = {
>  	.page_flip = drm_atomic_helper_page_flip,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -441,6 +460,8 @@ static void atmel_hlcdc_crtc_destroy_state(struct drm_crtc *crtc,
>  	.reset = atmel_hlcdc_crtc_reset,
>  	.atomic_duplicate_state =  atmel_hlcdc_crtc_duplicate_state,
>  	.atomic_destroy_state = atmel_hlcdc_crtc_destroy_state,
> +	.enable_vblank = atmel_hlcdc_crtc_enable_vblank,
> +	.disable_vblank = atmel_hlcdc_crtc_disable_vblank,
>  };
>  
>  int atmel_hlcdc_crtc_create(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 5cba65b5ea16..fd1a2d0c870d 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -720,25 +720,6 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>  	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>  }
>  
> -static int atmel_hlcdc_dc_enable_vblank(struct drm_device *dev,
> -					unsigned int pipe)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -
> -	/* Enable SOF (Start Of Frame) interrupt for vblank counting */
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, ATMEL_HLCDC_SOF);
> -
> -	return 0;
> -}
> -
> -static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
> -					  unsigned int pipe)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, ATMEL_HLCDC_SOF);
> -}
> -
>  static const struct file_operations fops = {
>  	.owner              = THIS_MODULE,
>  	.open               = drm_open,
> @@ -760,8 +741,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
> -	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
>  	.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,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
  2017-02-07  9:27   ` Maxime Ripard
  2017-02-07  9:46   ` Boris Brezillon
@ 2017-02-07 10:09   ` Neil Armstrong
  2017-02-07 10:22   ` Russell King - ARM Linux
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 68+ messages in thread
From: Neil Armstrong @ 2017-02-07 10:09 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Liviu Dudau, Laurent Pinchart, Daniel Vetter, Marek Vasut,
	Alexey Brodkin, Russell King, Xinliang Liu, Tomi Valkeinen,
	Mali DP Maintainers, Ben Skeggs, Jyri Sarha, dri-devel,
	Maxime Ripard

On 02/07/2017 10:16 AM, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>

For the meson drm driver :

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
>  drivers/gpu/drm/arm/malidp_drv.c                | 1 -
>  drivers/gpu/drm/armada/armada_drv.c             | 1 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
>  drivers/gpu/drm/i915/i915_irq.c                 | 1 -
>  drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
>  drivers/gpu/drm/meson/meson_drv.c               | 1 -
>  drivers/gpu/drm/msm/msm_drv.c                   | 1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
>  drivers/gpu/drm/sti/sti_drv.c                   | 1 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             | 1 -
>  drivers/gpu/drm/vc4/vc4_drv.c                   | 1 -
>  drivers/gpu/drm/zte/zx_drm_drv.c                | 1 -
>  25 files changed, 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 8d8344ed655e..1926b200e4cb 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -175,7 +175,6 @@ static int arcpgu_unload(struct drm_device *drm)
>  	.dumb_create = drm_gem_cma_dumb_create,
>  	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
>  	.dumb_destroy = drm_gem_dumb_destroy,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>  	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 4ce4f970920b..5d79e87f7421 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -278,7 +278,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
>  	.irq_preinstall = hdlcd_irq_preinstall,
>  	.irq_postinstall = hdlcd_irq_postinstall,
>  	.irq_uninstall = hdlcd_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = hdlcd_enable_vblank,
>  	.disable_vblank = hdlcd_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 8b0672d4aee9..ca6ccd172de3 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -213,7 +213,6 @@ static void malidp_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
>  			   DRIVER_PRIME,
>  	.lastclose = malidp_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = malidp_enable_vblank,
>  	.disable_vblank = malidp_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 63f42d001f33..bb27892012de 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -87,7 +87,6 @@ static void armada_drm_lastclose(struct drm_device *dev)
>  
>  static struct drm_driver armada_drm_driver = {
>  	.lastclose		= armada_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= armada_drm_enable_vblank,
>  	.disable_vblank		= armada_drm_disable_vblank,
>  	.gem_free_object_unlocked = armada_gem_free_object,
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 427bdff425c2..5cba65b5ea16 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -760,7 +760,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
>  	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 035d02ecffcd..a1c22eb12f4b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -263,7 +263,6 @@ static void exynos_drm_lastclose(struct drm_device *dev)
>  	.preclose		= exynos_drm_preclose,
>  	.lastclose		= exynos_drm_lastclose,
>  	.postclose		= exynos_drm_postclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= exynos_drm_crtc_enable_vblank,
>  	.disable_vblank		= exynos_drm_crtc_disable_vblank,
>  	.gem_free_object_unlocked = exynos_drm_gem_free_object,
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 04173235f448..b59b816a1d7d 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -203,7 +203,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
>  	.irq_handler		= fsl_dcu_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= fsl_dcu_drm_enable_vblank,
>  	.disable_vblank		= fsl_dcu_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 7e2043f4348c..8cac70454b57 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -84,7 +84,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	.desc			= "hibmc drm driver",
>  	.major			= 1,
>  	.minor			= 0,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= hibmc_enable_vblank,
>  	.disable_vblank		= hibmc_disable_vblank,
>  	.gem_free_object_unlocked = hibmc_gem_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 9a0678a33e0d..0624fab8046f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -1025,7 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
>  			       IRQF_SHARED, dev->driver->name, acrtc);
>  	if (ret)
>  		return ret;
> -	dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	dev->driver->enable_vblank = ade_enable_vblank;
>  	dev->driver->disable_vblank = ade_disable_vblank;
>  
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 47d6131e977f..5aab08172faf 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4218,7 +4218,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  	if (IS_GEN2(dev_priv)) {
>  		/* Gen2 doesn't have a hardware frame counter */
>  		dev->max_vblank_count = 0;
> -		dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
>  		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
>  		dev->driver->get_vblank_counter = g4x_get_vblank_counter;
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 5ae48836652e..4badbb66d69e 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -288,7 +288,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
>  	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
>  	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
>  	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= imx_drm_enable_vblank,
>  	.disable_vblank		= imx_drm_disable_vblank,
>  	.ioctls			= imx_drm_ioctls,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index b5f88e6d078e..ef8675336465 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -256,7 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = mtk_drm_crtc_enable_vblank,
>  	.disable_vblank = mtk_drm_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 6f2fd82ed483..c0a59889c45f 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -129,7 +129,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
>  	/* Vblank */
>  	.enable_vblank		= meson_enable_vblank,
>  	.disable_vblank		= meson_disable_vblank,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  
>  	/* IRQ */
>  	.irq_handler		= meson_irq,
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 70226eaa5cac..cb47f4a14215 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -816,7 +816,6 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
>  	.irq_preinstall     = msm_irq_preinstall,
>  	.irq_postinstall    = msm_irq_postinstall,
>  	.irq_uninstall      = msm_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = msm_enable_vblank,
>  	.disable_vblank     = msm_disable_vblank,
>  	.gem_free_object    = msm_gem_free_object,
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index cdfbe0284635..104722a78bd6 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -340,7 +340,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
>  	.irq_handler		= mxsfb_irq_handler,
>  	.irq_preinstall		= mxsfb_irq_preinstall,
>  	.irq_uninstall		= mxsfb_irq_preinstall,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= mxsfb_enable_vblank,
>  	.disable_vblank		= mxsfb_disable_vblank,
>  	.gem_free_object	= drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 9ed2ca0769e3..626df485a03a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -977,7 +977,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>  	.debugfs_cleanup = nouveau_drm_debugfs_cleanup,
>  #endif
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = nouveau_display_vblank_enable,
>  	.disable_vblank = nouveau_display_vblank_disable,
>  	.get_scanout_position = nouveau_display_scanoutpos,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index afe8f05b927b..da049a7636ad 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -714,7 +714,6 @@ static void dev_lastclose(struct drm_device *dev)
>  		DRIVER_ATOMIC,
>  	.open = dev_open,
>  	.lastclose = dev_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = omap_irq_enable_vblank,
>  	.disable_vblank = omap_irq_disable_vblank,
>  #ifdef CONFIG_DEBUG_FS
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index c05e00872778..094da3ef49d1 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -259,7 +259,6 @@ static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
>  				| DRIVER_ATOMIC,
>  	.lastclose		= rcar_du_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rcar_du_enable_vblank,
>  	.disable_vblank		= rcar_du_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index c30d649cb147..39243480c834 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -270,7 +270,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
>  				  DRIVER_PRIME | DRIVER_ATOMIC,
>  	.lastclose		= rockchip_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
>  	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
>  	.gem_vm_ops		= &drm_gem_cma_vm_ops,
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 33cec3d42389..d6b0545d252d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -256,7 +256,6 @@ static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.load			= shmob_drm_load,
>  	.unload			= shmob_drm_unload,
>  	.irq_handler		= shmob_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= shmob_drm_enable_vblank,
>  	.disable_vblank		= shmob_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 788feed208d7..d4b771d2d10d 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -264,7 +264,6 @@ static void sti_mode_config_init(struct drm_device *dev)
>  	.dumb_destroy = drm_gem_dumb_destroy,
>  	.fops = &sti_driver_fops,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = sti_crtc_enable_vblank,
>  	.disable_vblank = sti_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 4ce665349f6b..0816c635df20 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -92,7 +92,6 @@ static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
>  	/* Frame Buffer Operations */
>  
>  	/* VBlank Operations */
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= sun4i_drv_enable_vblank,
>  	.disable_vblank		= sun4i_drv_disable_vblank,
>  };
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 372d86fbb093..d5bc98e283d9 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -557,7 +557,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
>  	.lastclose          = tilcdc_lastclose,
>  	.irq_handler        = tilcdc_irq,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = tilcdc_enable_vblank,
>  	.disable_vblank     = tilcdc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index a459745e96f7..3a8709d85da1 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -139,7 +139,6 @@ static void vc4_lastclose(struct drm_device *dev)
>  
>  	.enable_vblank = vc4_enable_vblank,
>  	.disable_vblank = vc4_disable_vblank,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.get_scanout_position = vc4_crtc_get_scanoutpos,
>  	.get_vblank_timestamp = vc4_crtc_get_vblank_timestamp,
>  
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index 5c6944a1e72c..afd713a954c6 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -71,7 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  	.lastclose = zx_drm_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = zx_vou_enable_vblank,
>  	.disable_vblank = zx_vou_disable_vblank,
>  	.gem_free_object = drm_gem_cma_free_object,
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 14/23] drm: meson: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 14/23] drm: meson: " Shawn Guo
@ 2017-02-07 10:09   ` Neil Armstrong
  0 siblings, 0 replies; 68+ messages in thread
From: Neil Armstrong @ 2017-02-07 10:09 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Liviu Dudau, Laurent Pinchart, Daniel Vetter, Marek Vasut,
	Alexey Brodkin, Russell King, Xinliang Liu, Tomi Valkeinen,
	Mali DP Maintainers, Ben Skeggs, Jyri Sarha, dri-devel,
	Maxime Ripard

On 02/07/2017 10:16 AM, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/gpu/drm/meson/meson_crtc.c | 22 ++++++++++++++++++++++
>  drivers/gpu/drm/meson/meson_drv.c  | 20 --------------------
>  2 files changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c
> index 749770e5c65f..0fe49eccda65 100644
> --- a/drivers/gpu/drm/meson/meson_crtc.c
> +++ b/drivers/gpu/drm/meson/meson_crtc.c
> @@ -33,6 +33,7 @@
>  
>  #include "meson_crtc.h"
>  #include "meson_plane.h"
> +#include "meson_venc.h"
>  #include "meson_vpp.h"
>  #include "meson_viu.h"
>  #include "meson_registers.h"
> @@ -48,6 +49,24 @@ struct meson_crtc {
>  
>  /* CRTC */
>  
> +static int meson_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
> +	struct meson_drm *priv = meson_crtc->priv;
> +
> +	meson_venc_enable_vsync(priv);
> +
> +	return 0;
> +}
> +
> +static void meson_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct meson_crtc *meson_crtc = to_meson_crtc(crtc);
> +	struct meson_drm *priv = meson_crtc->priv;
> +
> +	meson_venc_disable_vsync(priv);
> +}
> +
>  static const struct drm_crtc_funcs meson_crtc_funcs = {
>  	.atomic_destroy_state	= drm_atomic_helper_crtc_destroy_state,
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> @@ -55,6 +74,9 @@ struct meson_crtc {
>  	.page_flip		= drm_atomic_helper_page_flip,
>  	.reset			= drm_atomic_helper_crtc_reset,
>  	.set_config             = drm_atomic_helper_set_config,
> +	.enable_vblank		= meson_crtc_enable_vblank,
> +	.disable_vblank		= meson_crtc_disable_vblank,
> +
>  };
>  
>  static void meson_crtc_enable(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index c0a59889c45f..8d17d0e59cbe 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -79,22 +79,6 @@ static void meson_fb_output_poll_changed(struct drm_device *dev)
>  	.fb_create           = drm_fb_cma_create,
>  };
>  
> -static int meson_enable_vblank(struct drm_device *dev, unsigned int crtc)
> -{
> -	struct meson_drm *priv = dev->dev_private;
> -
> -	meson_venc_enable_vsync(priv);
> -
> -	return 0;
> -}
> -
> -static void meson_disable_vblank(struct drm_device *dev, unsigned int crtc)
> -{
> -	struct meson_drm *priv = dev->dev_private;
> -
> -	meson_venc_disable_vsync(priv);
> -}
> -
>  static irqreturn_t meson_irq(int irq, void *arg)
>  {
>  	struct drm_device *dev = arg;
> @@ -126,10 +110,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
>  				  DRIVER_MODESET | DRIVER_PRIME |
>  				  DRIVER_ATOMIC,
>  
> -	/* Vblank */
> -	.enable_vblank		= meson_enable_vblank,
> -	.disable_vblank		= meson_disable_vblank,
> -
>  	/* IRQ */
>  	.irq_handler		= meson_irq,
>  
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs
  2017-02-07  9:16 ` [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs Shawn Guo
@ 2017-02-07 10:10   ` Philipp Zabel
  0 siblings, 0 replies; 68+ messages in thread
From: Philipp Zabel @ 2017-02-07 10:10 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel, Maxime Ripard

Hi Shawn,

On Tue, 2017-02-07 at 17:16 +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> With the vblank hooks in struct drm_crtc_funcs, we do not need to
> maintain the CRTC specific vblank callbacks with struct
> imx_drm_crtc_helper_funcs any more.  By moving the stuff that we
> currently do in imx_drm_add_crtc(), like of_node setting and
> drm_crtc_helper_add()/drm_crtc_init_with_planes() invoking, we can kill
> things like struct imx_drm_crtc, imx_drm_crtc_helper_funcs and related
> functions completely.

Thanks for removing the imx_drm_crtc indirection.

> Functions ipu_enable_vblank() and ipu_disable_vblank() are moved around
> without changes, only for saving the forward declarations.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                     ` (2 preceding siblings ...)
  2017-02-07 10:09   ` Neil Armstrong
@ 2017-02-07 10:22   ` Russell King - ARM Linux
  2017-02-07 10:42   ` Laurent Pinchart
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 68+ messages in thread
From: Russell King - ARM Linux @ 2017-02-07 10:22 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

On Tue, Feb 07, 2017 at 05:16:14PM +0800, Shawn Guo wrote:

For:

>  drivers/gpu/drm/armada/armada_drv.c             | 1 -

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 06/23] drm: armada: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 06/23] drm: armada: " Shawn Guo
@ 2017-02-07 10:23   ` Russell King - ARM Linux
  0 siblings, 0 replies; 68+ messages in thread
From: Russell King - ARM Linux @ 2017-02-07 10:23 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

On Tue, Feb 07, 2017 at 05:16:18PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.  As the result,
> functions armada_drm_crtc_enable[disable]_irq() can be static, although
> they are moved around a bit to save forward declaration.
> 
> The armada_crtc pointer array in struct armada_private is still kept in
> there, because armada_debugfs.c still have reference to it.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Russell King <linux@armlinux.org.uk>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
@ 2017-02-07 10:38   ` Andrzej Hajda
  2017-02-07 10:52     ` Daniel Vetter
  2017-02-07 11:04   ` Thierry Reding
  2017-02-07 14:01   ` Laurent Pinchart
  2 siblings, 1 reply; 68+ messages in thread
From: Andrzej Hajda @ 2017-02-07 10:38 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Marek Vasut, Neil Armstrong, Liviu Dudau, dri-devel,
	Alexey Brodkin, Russell King, Jyri Sarha, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Laurent Pinchart,
	Daniel Vetter, Maxime Ripard, Ben Skeggs

On 07.02.2017 10:16, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> The vblank is mostly CRTC specific and implemented as part of CRTC
> driver.  Let's keep the vblank hooks struct drm_driver for legacy
> drivers, and add corresponding hooks in struct drm_crtc_funcs.  These
> hooks take struct drm_crtc pointer as argument, and will be called by
> core vblank handling code for DRIVER_MODESET drivers.
>
> The new hooks get plugged into core by adding wrapper functions for
> vblank handling code.  The .get_vblank_counter hook is effectively
> optional, as we provide drm_vblank_no_hw_counter() as the default
> fallback in the wrapper function.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Every time I have lurked into vblank code I was wondering why it is not
a part of crtc, thanks for clearing it up.
Small comment below, anyway:

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>


> ---
>  drivers/gpu/drm/drm_irq.c | 53 +++++++++++++++++++++++++++++++++++++++++------
>  include/drm/drm_crtc.h    | 44 +++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_drv.h     |  9 ++++++++
>  3 files changed, 100 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index e06cf11ebb4a..646b3e57b9ad 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -89,6 +89,21 @@ static void store_vblank(struct drm_device *dev, unsigned int pipe,
>  	write_sequnlock(&vblank->seqlock);
>  }
>  
> +static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->get_vblank_counter)
> +			return crtc->funcs->get_vblank_counter(crtc);
> +	}
> +
> +	if (dev->driver->get_vblank_counter)
> +		return dev->driver->get_vblank_counter(dev, pipe);

After converting all modeset drivers dev->driver->get_vblank_counter
could be called only for non-modeset drivers, ie 'else' can be put
before last if, the same for two other callbacks.

Regards
Andrzej

> +
> +	return drm_vblank_no_hw_counter(dev, pipe);
> +}
> +
>  /*
>   * Reset the stored timestamp for the current vblank count to correspond
>   * to the last vblank occurred.
> @@ -112,9 +127,9 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe
>  	 * when drm_vblank_enable() applies the diff
>  	 */
>  	do {
> -		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
> +		cur_vblank = __get_vblank_counter(dev, pipe);
>  		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, 0);
> -	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) && --count > 0);
> +	} while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
>  
>  	/*
>  	 * Only reinitialize corresponding vblank timestamp if high-precision query
> @@ -168,9 +183,9 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
>  	 * corresponding vblank timestamp.
>  	 */
>  	do {
> -		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
> +		cur_vblank = __get_vblank_counter(dev, pipe);
>  		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, flags);
> -	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) && --count > 0);
> +	} while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
>  
>  	if (dev->max_vblank_count != 0) {
>  		/* trust the hw counter when it's around */
> @@ -275,6 +290,20 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc)
>  }
>  EXPORT_SYMBOL(drm_accurate_vblank_count);
>  
> +static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->disable_vblank) {
> +			crtc->funcs->disable_vblank(crtc);
> +			return;
> +		}
> +	}
> +
> +	dev->driver->disable_vblank(dev, pipe);
> +}
> +
>  /*
>   * Disable vblank irq's on crtc, make sure that last vblank count
>   * of hardware and corresponding consistent software vblank counter
> @@ -298,7 +327,7 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
>  	 * hardware potentially runtime suspended.
>  	 */
>  	if (vblank->enabled) {
> -		dev->driver->disable_vblank(dev, pipe);
> +		__disable_vblank(dev, pipe);
>  		vblank->enabled = false;
>  	}
>  
> @@ -1027,6 +1056,18 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>  }
>  EXPORT_SYMBOL(drm_crtc_send_vblank_event);
>  
> +static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->enable_vblank)
> +			return crtc->funcs->enable_vblank(crtc);
> +	}
> +
> +	return dev->driver->enable_vblank(dev, pipe);
> +}
> +
>  /**
>   * drm_vblank_enable - enable the vblank interrupt on a CRTC
>   * @dev: DRM device
> @@ -1052,7 +1093,7 @@ static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
>  		 * timestamps. Filtercode in drm_handle_vblank() will
>  		 * prevent double-accounting of same vblank interval.
>  		 */
> -		ret = dev->driver->enable_vblank(dev, pipe);
> +		ret = __enable_vblank(dev, pipe);
>  		DRM_DEBUG("enabling vblank on crtc %u, ret: %d\n", pipe, ret);
>  		if (ret)
>  			atomic_dec(&vblank->refcount);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 8f0b195e4a59..4323acefa596 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -601,6 +601,50 @@ struct drm_crtc_funcs {
>  	 */
>  	void (*atomic_print_state)(struct drm_printer *p,
>  				   const struct drm_crtc_state *state);
> +
> +	/**
> +	 * @get_vblank_counter:
> +	 *
> +	 * Driver callback for fetching a raw hardware vblank counter for the
> +	 * CRTC. It's meant to be used by new drivers as the replacement of
> +	 * &drm_driver.get_vblank_counter hook.
> +	 *
> +	 * This callback is optional. If a device doesn't have a hardware
> +	 * counter, the driver can simply leave the hook as NULL. The DRM core
> +	 * will account for missed vblank events while interrupts where disabled
> +	 * based on system timestamps.
> +	 *
> +	 * Wraparound handling and loss of events due to modesetting is dealt
> +	 * with in the DRM core code, as long as drivers call
> +	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> +	 * enabling a CRTC.
> +	 *
> +	 * Returns:
> +	 *
> +	 * Raw vblank counter value.
> +	 */
> +	u32 (*get_vblank_counter)(struct drm_crtc *crtc);
> +
> +	/**
> +	 * @enable_vblank:
> +	 *
> +	 * Enable vblank interrupts for the CRTC. It's meant to be used by
> +	 * new drivers as the replacement of &drm_driver.enable_vblank hook.
> +	 *
> +	 * Returns:
> +	 *
> +	 * Zero on success, appropriate errno if the vblank interrupt cannot
> +	 * be enabled.
> +	 */
> +	int (*enable_vblank)(struct drm_crtc *crtc);
> +
> +	/**
> +	 * @disable_vblank:
> +	 *
> +	 * Disable vblank interrupts for the CRTC. It's meant to be used by
> +	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
> +	 */
> +	void (*disable_vblank)(struct drm_crtc *crtc);
>  };
>  
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index f2c0040ddc3a..40ae89106594 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -130,6 +130,9 @@ struct drm_driver {
>  	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>  	 * enabling a CRTC.
>  	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> +	 *
>  	 * Returns:
>  	 *
>  	 * Raw vblank counter value.
> @@ -142,6 +145,9 @@ struct drm_driver {
>  	 * Enable vblank interrupts for the CRTC specified with the pipe
>  	 * argument.
>  	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.enable_vblank instead.
> +	 *
>  	 * Returns:
>  	 *
>  	 * Zero on success, appropriate errno if the given @crtc's vblank
> @@ -154,6 +160,9 @@ struct drm_driver {
>  	 *
>  	 * Disable vblank interrupts for the CRTC specified with the pipe
>  	 * argument.
> +	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.disable_vblank instead.
>  	 */
>  	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
>  


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                     ` (3 preceding siblings ...)
  2017-02-07 10:22   ` Russell King - ARM Linux
@ 2017-02-07 10:42   ` Laurent Pinchart
  2017-02-07 10:44     ` Russell King - ARM Linux
  2017-02-07 11:54   ` Alexey Brodkin
                     ` (2 subsequent siblings)
  7 siblings, 1 reply; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 10:42 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

Hi Shawn,

Thank you for the patch.

On Tuesday 07 Feb 2017 17:16:14 Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
>  drivers/gpu/drm/arm/malidp_drv.c                | 1 -
>  drivers/gpu/drm/armada/armada_drv.c             | 1 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
>  drivers/gpu/drm/i915/i915_irq.c                 | 1 -
>  drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
>  drivers/gpu/drm/meson/meson_drv.c               | 1 -
>  drivers/gpu/drm/msm/msm_drv.c                   | 1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
>  drivers/gpu/drm/sti/sti_drv.c                   | 1 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             | 1 -
>  drivers/gpu/drm/vc4/vc4_drv.c                   | 1 -
>  drivers/gpu/drm/zte/zx_drm_drv.c                | 1 -
>  25 files changed, 25 deletions(-)

[snip]

> diff --git a/drivers/gpu/drm/i915/i915_irq.c
> b/drivers/gpu/drm/i915/i915_irq.c index 47d6131e977f..5aab08172faf 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4218,7 +4218,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
> if (IS_GEN2(dev_priv)) {
>  		/* Gen2 doesn't have a hardware frame counter */
>  		dev->max_vblank_count = 0;
> -		dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
>  		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
>  		dev->driver->get_vblank_counter = g4x_get_vblank_counter;

On an unrelated note, for security reasons we should try to make the driver 
structure static, or at least move ops to a static structure.

Anyway, for this patch,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07 10:42   ` Laurent Pinchart
@ 2017-02-07 10:44     ` Russell King - ARM Linux
  2017-02-07 10:58       ` Laurent Pinchart
  2017-02-07 11:01       ` Thierry Reding
  0 siblings, 2 replies; 68+ messages in thread
From: Russell King - ARM Linux @ 2017-02-07 10:44 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Xinliang Liu, Tomi Valkeinen,
	Mali DP Maintainers, Ben Skeggs, Jyri Sarha, dri-devel,
	Maxime Ripard, Shawn Guo

On Tue, Feb 07, 2017 at 12:42:15PM +0200, Laurent Pinchart wrote:
> On an unrelated note, for security reasons we should try to make the driver 
> structure static, or at least move ops to a static structure.

ITYM "const" not "static".

"static" doesn't get you anything from a security point of view.  "const"
gets you write protection, so code can't modify the function pointers.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 08/23] drm: exynos: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 08/23] drm: exynos: " Shawn Guo
@ 2017-02-07 10:47   ` Andrzej Hajda
  0 siblings, 0 replies; 68+ messages in thread
From: Andrzej Hajda @ 2017-02-07 10:47 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Marek Vasut, Neil Armstrong, Liviu Dudau, dri-devel,
	Alexey Brodkin, Russell King, Jyri Sarha, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Laurent Pinchart,
	Daniel Vetter, Maxime Ripard, Ben Skeggs

On 07.02.2017 10:16, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> 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.
>
> As the result, exynos_drm_crtc_enable[disable]_vblank() become static
> functions.  They are moved around a bit to save forward declaration
> though.  Also while at it, we move one step further to kill
> exynos_drm_crtc_from_pipe() completely by updating hdmi_bind() a bit.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Inki Dae <inki.dae@samsung.com>

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
--
Regards
Andrzej

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07 10:38   ` Andrzej Hajda
@ 2017-02-07 10:52     ` Daniel Vetter
  2017-02-07 11:50       ` Thierry Reding
  0 siblings, 1 reply; 68+ messages in thread
From: Daniel Vetter @ 2017-02-07 10:52 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Shawn Guo,
	Ben Skeggs

On Tue, Feb 07, 2017 at 11:38:08AM +0100, Andrzej Hajda wrote:
> On 07.02.2017 10:16, Shawn Guo wrote:
> > +static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> > +{
> > +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> > +
> > +		if (crtc->funcs->get_vblank_counter)
> > +			return crtc->funcs->get_vblank_counter(crtc);
> > +	}
> > +
> > +	if (dev->driver->get_vblank_counter)
> > +		return dev->driver->get_vblank_counter(dev, pipe);
> 
> After converting all modeset drivers dev->driver->get_vblank_counter
> could be called only for non-modeset drivers, ie 'else' can be put
> before last if, the same for two other callbacks.

Shawn converted a lot of drivers, but not yet all of them. There's a lot
more kms drivers, so probably will take some time until we can do this.
But a good long-term goal indeed.
-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

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter()
  2017-02-07  9:16 ` [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter() Shawn Guo
@ 2017-02-07 10:56   ` Laurent Pinchart
  0 siblings, 0 replies; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 10:56 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

Hi Shawn,

Thank you for the patch.

On Tuesday 07 Feb 2017 17:16:15 Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> The function drm_vblank_no_hw_counter() is now only used in core vblank
> wrapper code.  Let's unexport it by making it a static function.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/drm_irq.c | 28 ++++++++++------------------
>  include/drm/drm_drv.h     |  7 +++----
>  include/drm/drm_irq.h     |  1 -
>  3 files changed, 13 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 646b3e57b9ad..1906723af389 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -89,6 +89,16 @@ static void store_vblank(struct drm_device *dev, unsigned
> int pipe, write_sequnlock(&vblank->seqlock);
>  }
> 
> +/*
> + * "No hw counter" fallback implementation of .get_vblank_counter() hook,
> + * if there is no useable hardware frame counter available.
> + */
> +static u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int
> pipe) +{
> +	WARN_ON_ONCE(dev->max_vblank_count != 0);
> +	return 0;
> +}
> +
>  static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
>  {
>  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> @@ -1748,21 +1758,3 @@ bool drm_crtc_handle_vblank(struct drm_crtc *crtc)
>  	return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc));
>  }
>  EXPORT_SYMBOL(drm_crtc_handle_vblank);
> -
> -/**
> - * drm_vblank_no_hw_counter - "No hw counter" implementation of
> .get_vblank_counter() - * @dev: DRM device
> - * @pipe: CRTC for which to read the counter
> - *
> - * Drivers can plug this into the .get_vblank_counter() function if
> - * there is no useable hardware frame counter available.
> - *
> - * Returns:
> - * 0
> - */
> -u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
> -{
> -	WARN_ON_ONCE(dev->max_vblank_count != 0);
> -	return 0;
> -}
> -EXPORT_SYMBOL(drm_vblank_no_hw_counter);
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 40ae89106594..661ca24a4c97 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -120,10 +120,9 @@ struct drm_driver {
>  	 *
>  	 * Driver callback for fetching a raw hardware vblank counter for the
>  	 * CRTC specified with the pipe argument.  If a device doesn't have a
> -	 * hardware counter, the driver can simply use
> -	 * drm_vblank_no_hw_counter() function. The DRM core will account for
> -	 * missed vblank events while interrupts where disabled based on 
system
> -	 * timestamps.
> +	 * hardware counter, the driver can simply leave the hook as NULL.
> +	 * The DRM core will account for missed vblank events while interrupts
> +	 * where disabled based on system timestamps.
>  	 *
>  	 * Wraparound handling and loss of events due to modesetting is dealt
>  	 * with in the DRM core code, as long as drivers call
> diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
> index 2fb880462a57..cf0be6594c8c 100644
> --- a/include/drm/drm_irq.h
> +++ b/include/drm/drm_irq.h
> @@ -152,7 +152,6 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
>  void drm_crtc_vblank_on(struct drm_crtc *crtc);
>  void drm_vblank_cleanup(struct drm_device *dev);
>  u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
> -u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
> 
>  int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>  					  unsigned int pipe, int *max_error,

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07 10:44     ` Russell King - ARM Linux
@ 2017-02-07 10:58       ` Laurent Pinchart
  2017-02-07 11:01       ` Thierry Reding
  1 sibling, 0 replies; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 10:58 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Xinliang Liu, Tomi Valkeinen,
	Mali DP Maintainers, Ben Skeggs, Jyri Sarha, dri-devel,
	Maxime Ripard, Shawn Guo

Hi Russell,

On Tuesday 07 Feb 2017 10:44:49 Russell King - ARM Linux wrote:
> On Tue, Feb 07, 2017 at 12:42:15PM +0200, Laurent Pinchart wrote:
> > On an unrelated note, for security reasons we should try to make the
> > driver
> > structure static, or at least move ops to a static structure.
> 
> ITYM "const" not "static".
> 
> "static" doesn't get you anything from a security point of view.  "const"
> gets you write protection, so code can't modify the function pointers.

That's what I meant, sorry. My brain-fingers link seems to be have a high 
noise level this week.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07 10:44     ` Russell King - ARM Linux
  2017-02-07 10:58       ` Laurent Pinchart
@ 2017-02-07 11:01       ` Thierry Reding
  1 sibling, 0 replies; 68+ messages in thread
From: Thierry Reding @ 2017-02-07 11:01 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard, Shawn Guo


[-- Attachment #1.1: Type: text/plain, Size: 987 bytes --]

On Tue, Feb 07, 2017 at 10:44:49AM +0000, Russell King - ARM Linux wrote:
> On Tue, Feb 07, 2017 at 12:42:15PM +0200, Laurent Pinchart wrote:
> > On an unrelated note, for security reasons we should try to make the driver 
> > structure static, or at least move ops to a static structure.
> 
> ITYM "const" not "static".
> 
> "static" doesn't get you anything from a security point of view.  "const"
> gets you write protection, so code can't modify the function pointers.

We can't easily do that for struct drm_driver at the moment because some
fields end up being modified at runtime. I suppose we could move some of
those fields over to struct drm_device, which, in many cases, would make
more sense anyway.

What i915 is currently doing is probably fine for all existing cases,
but it sets a bad example for other drivers that may end up having to
drive multiple devices with one driver, so modifying the global driver
is likely going to break things.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 20/23] drm: tegra: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 20/23] drm: tegra: " Shawn Guo
@ 2017-02-07 11:02   ` Thierry Reding
  0 siblings, 0 replies; 68+ messages in thread
From: Thierry Reding @ 2017-02-07 11:02 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 861 bytes --]

On Tue, Feb 07, 2017 at 05:16:32PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.
> 
> As the result, the wrapper functions tegra_drm_xxx get killed
> completely, and tegra_dc_xxx are filled into struct drm_crtc_funcs as
> vblank hooks directly.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> ---
>  drivers/gpu/drm/tegra/dc.c  | 15 ++++++++++++---
>  drivers/gpu/drm/tegra/drm.c | 38 --------------------------------------
>  drivers/gpu/drm/tegra/drm.h |  3 ---
>  3 files changed, 12 insertions(+), 44 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
  2017-02-07 10:38   ` Andrzej Hajda
@ 2017-02-07 11:04   ` Thierry Reding
  2017-02-07 14:01   ` Laurent Pinchart
  2 siblings, 0 replies; 68+ messages in thread
From: Thierry Reding @ 2017-02-07 11:04 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Laurent Pinchart,
	Daniel Vetter, Marek Vasut, Alexey Brodkin, Russell King,
	Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs,
	Jyri Sarha, dri-devel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 1165 bytes --]

On Tue, Feb 07, 2017 at 05:16:13PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> The vblank is mostly CRTC specific and implemented as part of CRTC
> driver.  Let's keep the vblank hooks struct drm_driver for legacy
> drivers, and add corresponding hooks in struct drm_crtc_funcs.  These
> hooks take struct drm_crtc pointer as argument, and will be called by
> core vblank handling code for DRIVER_MODESET drivers.
> 
> The new hooks get plugged into core by adding wrapper functions for
> vblank handling code.  The .get_vblank_counter hook is effectively
> optional, as we provide drm_vblank_no_hw_counter() as the default
> fallback in the wrapper function.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  drivers/gpu/drm/drm_irq.c | 53 +++++++++++++++++++++++++++++++++++++++++------
>  include/drm/drm_crtc.h    | 44 +++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_drv.h     |  9 ++++++++
>  3 files changed, 100 insertions(+), 6 deletions(-)

I had been meaning to do this for a long time myself but never got
around to it. Great stuff.

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07 10:52     ` Daniel Vetter
@ 2017-02-07 11:50       ` Thierry Reding
  0 siblings, 0 replies; 68+ messages in thread
From: Thierry Reding @ 2017-02-07 11:50 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Marek Vasut, Neil Armstrong, Daniel Vetter, Alexey Brodkin,
	Liviu Dudau, Russell King, dri-devel, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Jyri Sarha, Daniel Vetter,
	Maxime Ripard, Ben Skeggs, Shawn Guo, Laurent Pinchart


[-- Attachment #1.1: Type: text/plain, Size: 1104 bytes --]

On Tue, Feb 07, 2017 at 11:52:06AM +0100, Daniel Vetter wrote:
> On Tue, Feb 07, 2017 at 11:38:08AM +0100, Andrzej Hajda wrote:
> > On 07.02.2017 10:16, Shawn Guo wrote:
> > > +static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> > > +{
> > > +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > > +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> > > +
> > > +		if (crtc->funcs->get_vblank_counter)
> > > +			return crtc->funcs->get_vblank_counter(crtc);
> > > +	}
> > > +
> > > +	if (dev->driver->get_vblank_counter)
> > > +		return dev->driver->get_vblank_counter(dev, pipe);
> > 
> > After converting all modeset drivers dev->driver->get_vblank_counter
> > could be called only for non-modeset drivers, ie 'else' can be put
> > before last if, the same for two other callbacks.
> 
> Shawn converted a lot of drivers, but not yet all of them. There's a lot
> more kms drivers, so probably will take some time until we can do this.
> But a good long-term goal indeed.

Probably should be added to that new TODO list thing... =)

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                     ` (4 preceding siblings ...)
  2017-02-07 10:42   ` Laurent Pinchart
@ 2017-02-07 11:54   ` Alexey Brodkin
  2017-02-07 15:21   ` Liviu Dudau
  2017-02-08 19:58   ` Eric Anholt
  7 siblings, 0 replies; 68+ messages in thread
From: Alexey Brodkin @ 2017-02-07 11:54 UTC (permalink / raw)
  To: shawnguo
  Cc: narmstrong, daniel.vetter, liviu.dudau, dri-devel,
	laurent.pinchart, daniel.vetter, marex, linux, z.liuxinliang,
	tomi.valkeinen, malidp, bskeggs, jsarha, maxime.ripard

Hi Shawn,

On Tue, 2017-02-07 at 17:16 +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>

For ARC PGU part

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 01/23] drm: add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
  2017-02-07 10:38   ` Andrzej Hajda
  2017-02-07 11:04   ` Thierry Reding
@ 2017-02-07 14:01   ` Laurent Pinchart
  2 siblings, 0 replies; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 14:01 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

Hi Shawn,

Thank you for the patch.

On Tuesday 07 Feb 2017 17:16:13 Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> The vblank is mostly CRTC specific and implemented as part of CRTC
> driver.  Let's keep the vblank hooks struct drm_driver for legacy
> drivers, and add corresponding hooks in struct drm_crtc_funcs.  These
> hooks take struct drm_crtc pointer as argument, and will be called by
> core vblank handling code for DRIVER_MODESET drivers.
> 
> The new hooks get plugged into core by adding wrapper functions for
> vblank handling code.  The .get_vblank_counter hook is effectively
> optional, as we provide drm_vblank_no_hw_counter() as the default
> fallback in the wrapper function.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/drm_irq.c | 53 ++++++++++++++++++++++++++++++++++++++------
>  include/drm/drm_crtc.h    | 44 +++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_drv.h     |  9 ++++++++
>  3 files changed, 100 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index e06cf11ebb4a..646b3e57b9ad 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -89,6 +89,21 @@ static void store_vblank(struct drm_device *dev, unsigned
> int pipe, write_sequnlock(&vblank->seqlock);
>  }
> 
> +static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->get_vblank_counter)
> +			return crtc->funcs->get_vblank_counter(crtc);
> +	}
> +
> +	if (dev->driver->get_vblank_counter)
> +		return dev->driver->get_vblank_counter(dev, pipe);
> +
> +	return drm_vblank_no_hw_counter(dev, pipe);
> +}
> +
>  /*
>   * Reset the stored timestamp for the current vblank count to correspond
>   * to the last vblank occurred.
> @@ -112,9 +127,9 @@ static void drm_reset_vblank_timestamp(struct drm_device
> *dev, unsigned int pipe * when drm_vblank_enable() applies the diff
>  	 */
>  	do {
> -		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
> +		cur_vblank = __get_vblank_counter(dev, pipe);
>  		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, 0);
> -	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) &&
> --count > 0); +	} while (cur_vblank != __get_vblank_counter(dev, pipe) 
&&
> --count > 0);
> 
>  	/*
>  	 * Only reinitialize corresponding vblank timestamp if high-precision
> query @@ -168,9 +183,9 @@ static void drm_update_vblank_count(struct
> drm_device *dev, unsigned int pipe, * corresponding vblank timestamp.
>  	 */
>  	do {
> -		cur_vblank = dev->driver->get_vblank_counter(dev, pipe);
> +		cur_vblank = __get_vblank_counter(dev, pipe);
>  		rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, flags);
> -	} while (cur_vblank != dev->driver->get_vblank_counter(dev, pipe) &&
> --count > 0); +	} while (cur_vblank != __get_vblank_counter(dev, pipe) 
&&
> --count > 0);
> 
>  	if (dev->max_vblank_count != 0) {
>  		/* trust the hw counter when it's around */
> @@ -275,6 +290,20 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc)
>  }
>  EXPORT_SYMBOL(drm_accurate_vblank_count);
> 
> +static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->disable_vblank) {
> +			crtc->funcs->disable_vblank(crtc);
> +			return;
> +		}
> +	}
> +
> +	dev->driver->disable_vblank(dev, pipe);
> +}
> +
>  /*
>   * Disable vblank irq's on crtc, make sure that last vblank count
>   * of hardware and corresponding consistent software vblank counter
> @@ -298,7 +327,7 @@ static void vblank_disable_and_save(struct drm_device
> *dev, unsigned int pipe) * hardware potentially runtime suspended.
>  	 */
>  	if (vblank->enabled) {
> -		dev->driver->disable_vblank(dev, pipe);
> +		__disable_vblank(dev, pipe);
>  		vblank->enabled = false;
>  	}
> 
> @@ -1027,6 +1056,18 @@ void drm_crtc_send_vblank_event(struct drm_crtc
> *crtc, }
>  EXPORT_SYMBOL(drm_crtc_send_vblank_event);
> 
> +static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> +{
> +	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +		struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> +
> +		if (crtc->funcs->enable_vblank)
> +			return crtc->funcs->enable_vblank(crtc);
> +	}
> +
> +	return dev->driver->enable_vblank(dev, pipe);
> +}
> +
>  /**
>   * drm_vblank_enable - enable the vblank interrupt on a CRTC
>   * @dev: DRM device
> @@ -1052,7 +1093,7 @@ static int drm_vblank_enable(struct drm_device *dev,
> unsigned int pipe) * timestamps. Filtercode in drm_handle_vblank() will
>  		 * prevent double-accounting of same vblank interval.
>  		 */
> -		ret = dev->driver->enable_vblank(dev, pipe);
> +		ret = __enable_vblank(dev, pipe);
>  		DRM_DEBUG("enabling vblank on crtc %u, ret: %d\n", pipe, ret);
>  		if (ret)
>  			atomic_dec(&vblank->refcount);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 8f0b195e4a59..4323acefa596 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -601,6 +601,50 @@ struct drm_crtc_funcs {
>  	 */
>  	void (*atomic_print_state)(struct drm_printer *p,
>  				   const struct drm_crtc_state *state);
> +
> +	/**
> +	 * @get_vblank_counter:
> +	 *
> +	 * Driver callback for fetching a raw hardware vblank counter for the
> +	 * CRTC. It's meant to be used by new drivers as the replacement of
> +	 * &drm_driver.get_vblank_counter hook.
> +	 *
> +	 * This callback is optional. If a device doesn't have a hardware
> +	 * counter, the driver can simply leave the hook as NULL. The DRM core
> +	 * will account for missed vblank events while interrupts where 
disabled
> +	 * based on system timestamps.
> +	 *
> +	 * Wraparound handling and loss of events due to modesetting is dealt
> +	 * with in the DRM core code, as long as drivers call
> +	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
> +	 * enabling a CRTC.
> +	 *
> +	 * Returns:
> +	 *
> +	 * Raw vblank counter value.
> +	 */
> +	u32 (*get_vblank_counter)(struct drm_crtc *crtc);
> +
> +	/**
> +	 * @enable_vblank:
> +	 *
> +	 * Enable vblank interrupts for the CRTC. It's meant to be used by
> +	 * new drivers as the replacement of &drm_driver.enable_vblank hook.
> +	 *
> +	 * Returns:
> +	 *
> +	 * Zero on success, appropriate errno if the vblank interrupt cannot
> +	 * be enabled.
> +	 */
> +	int (*enable_vblank)(struct drm_crtc *crtc);
> +
> +	/**
> +	 * @disable_vblank:
> +	 *
> +	 * Disable vblank interrupts for the CRTC. It's meant to be used by
> +	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
> +	 */
> +	void (*disable_vblank)(struct drm_crtc *crtc);
>  };
> 
>  /**
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index f2c0040ddc3a..40ae89106594 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -130,6 +130,9 @@ struct drm_driver {
>  	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
>  	 * enabling a CRTC.
>  	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.get_vblank_counter instead.
> +	 *
>  	 * Returns:
>  	 *
>  	 * Raw vblank counter value.
> @@ -142,6 +145,9 @@ struct drm_driver {
>  	 * Enable vblank interrupts for the CRTC specified with the pipe
>  	 * argument.
>  	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.enable_vblank instead.
> +	 *
>  	 * Returns:
>  	 *
>  	 * Zero on success, appropriate errno if the given @crtc's vblank
> @@ -154,6 +160,9 @@ struct drm_driver {
>  	 *
>  	 * Disable vblank interrupts for the CRTC specified with the pipe
>  	 * argument.
> +	 *
> +	 * This is deprecated and should not be used by new drivers.
> +	 * Use &drm_crtc_funcs.disable_vblank instead.
>  	 */
>  	void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 16/23] drm: rcar-du: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 16/23] drm: rcar-du: " Shawn Guo
@ 2017-02-07 14:03   ` Laurent Pinchart
  0 siblings, 0 replies; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 14:03 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

Hi Shawn,

Thank you for the patch.

On Tuesday 07 Feb 2017 17:16:28 Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 29 +++++++++++++++++++----------
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 19 -------------------
>  3 files changed, 19 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index a2ec6d8796a0..edcbe2e3625d
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -529,6 +529,23 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc
> *crtc, .atomic_flush = rcar_du_crtc_atomic_flush,
>  };
> 
> +static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> +
> +	rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
> +	rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
> +
> +	return 0;
> +}
> +
> +static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> +
> +	rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE);
> +}
> +
>  static const struct drm_crtc_funcs crtc_funcs = {
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.destroy = drm_crtc_cleanup,
> @@ -536,6 +553,8 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc
> *crtc, .page_flip = drm_atomic_helper_page_flip,
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank = rcar_du_crtc_enable_vblank,
> +	.disable_vblank = rcar_du_crtc_disable_vblank,
>  };
> 
>  /*
> ---------------------------------------------------------------------------
> -- @@ -650,13 +669,3 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp,
> unsigned int index)
> 
>  	return 0;
>  }
> -
> -void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable)
> -{
> -	if (enable) {
> -		rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
> -		rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
> -	} else {
> -		rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE);
> -	}
> -}
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index 6f08b7e7db06..a7194812997e
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> @@ -66,7 +66,6 @@ enum rcar_du_output {
>  };
> 
>  int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index);
> -void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable);
>  void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc);
>  void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc);
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 094da3ef49d1..192346d4fb34
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -26,7 +26,6 @@
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> 
> -#include "rcar_du_crtc.h"
>  #include "rcar_du_drv.h"
>  #include "rcar_du_kms.h"
>  #include "rcar_du_regs.h"
> @@ -227,22 +226,6 @@ static void rcar_du_lastclose(struct drm_device *dev)
>  	drm_fbdev_cma_restore_mode(rcdu->fbdev);
>  }
> 
> -static int rcar_du_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct rcar_du_device *rcdu = dev->dev_private;
> -
> -	rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], true);
> -
> -	return 0;
> -}
> -
> -static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int
> pipe) -{
> -	struct rcar_du_device *rcdu = dev->dev_private;
> -
> -	rcar_du_crtc_enable_vblank(&rcdu->crtcs[pipe], false);
> -}
> -
>  static const struct file_operations rcar_du_fops = {
>  	.owner		= THIS_MODULE,
>  	.open		= drm_open,
> @@ -259,8 +242,6 @@ static void rcar_du_disable_vblank(struct drm_device
> *dev, unsigned int pipe) .driver_features	= DRIVER_GEM | DRIVER_MODESET 
|
> DRIVER_PRIME
> 
>  				| DRIVER_ATOMIC,
> 
>  	.lastclose		= rcar_du_lastclose,
> -	.enable_vblank		= rcar_du_enable_vblank,
> -	.disable_vblank		= rcar_du_disable_vblank,
>  	.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,

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs Shawn Guo
@ 2017-02-07 14:05   ` Laurent Pinchart
  0 siblings, 0 replies; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-07 14:05 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

Hi Shawn,

Thank you for the patch.

On Tuesday 07 Feb 2017 17:16:30 Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.
> 
> As the result, shmob_drm_crtc_enable_vblank() becomes a static function,
> although it gets moved around a bit to save forward declaration.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 51 +++++++++++++++++++---------
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.h |  1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c  | 19 ------------
>  3 files changed, 35 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index
> 445476551695..8244890e6d53 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -476,10 +476,45 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc
> *crtc, return 0;
>  }
> 
> +static void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev,
> +					 bool enable)
> +{
> +	unsigned long flags;
> +	u32 ldintr;
> +
> +	/* Be careful not to acknowledge any pending interrupt. */
> +	spin_lock_irqsave(&sdev->irq_lock, flags);
> +	ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
> +	if (enable)
> +		ldintr |= LDINTR_VEE;
> +	else
> +		ldintr &= ~LDINTR_VEE;
> +	lcdc_write(sdev, LDINTR, ldintr);
> +	spin_unlock_irqrestore(&sdev->irq_lock, flags);
> +}
> +
> +static int shmob_drm_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct shmob_drm_device *sdev = crtc->dev->dev_private;
> +
> +	shmob_drm_crtc_enable_vblank(sdev, true);
> +
> +	return 0;
> +}
> +
> +static void shmob_drm_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct shmob_drm_device *sdev = crtc->dev->dev_private;
> +
> +	shmob_drm_crtc_enable_vblank(sdev, false);
> +}
> +
>  static const struct drm_crtc_funcs crtc_funcs = {
>  	.destroy = drm_crtc_cleanup,
>  	.set_config = drm_crtc_helper_set_config,
>  	.page_flip = shmob_drm_crtc_page_flip,
> +	.enable_vblank = shmob_drm_enable_vblank,
> +	.disable_vblank = shmob_drm_disable_vblank,
>  };
> 
>  int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
> @@ -594,22 +629,6 @@ int shmob_drm_encoder_create(struct shmob_drm_device
> *sdev) return 0;
>  }
> 
> -void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool
> enable)
> -{
> -	unsigned long flags;
> -	u32 ldintr;
> -
> -	/* Be careful not to acknowledge any pending interrupt. */
> -	spin_lock_irqsave(&sdev->irq_lock, flags);
> -	ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
> -	if (enable)
> -		ldintr |= LDINTR_VEE;
> -	else
> -		ldintr &= ~LDINTR_VEE;
> -	lcdc_write(sdev, LDINTR, ldintr);
> -	spin_unlock_irqrestore(&sdev->irq_lock, flags);
> -}
> -
>  /* ------------------------------------------------------------------------
>   * Connector
>   */
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
> b/drivers/gpu/drm/shmobile/shmob_drm_crtc.h index
> 818b31549ddc..f152973df11c 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.h
> @@ -47,7 +47,6 @@ struct shmob_drm_connector {
>  };
> 
>  int shmob_drm_crtc_create(struct shmob_drm_device *sdev);
> -void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool
> enable);
>  void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc);
>  void shmob_drm_crtc_suspend(struct shmob_drm_crtc *scrtc);
>  void shmob_drm_crtc_resume(struct shmob_drm_crtc *scrtc);
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index d6b0545d252d..34fefa0ba0f0
> 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -23,7 +23,6 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> 
> -#include "shmob_drm_crtc.h"
>  #include "shmob_drm_drv.h"
>  #include "shmob_drm_kms.h"
>  #include "shmob_drm_plane.h"
> @@ -222,22 +221,6 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
> 
> -static int shmob_drm_enable_vblank(struct drm_device *dev, unsigned int
> pipe) -{
> -	struct shmob_drm_device *sdev = dev->dev_private;
> -
> -	shmob_drm_crtc_enable_vblank(sdev, true);
> -
> -	return 0;
> -}
> -
> -static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int
> pipe) -{
> -	struct shmob_drm_device *sdev = dev->dev_private;
> -
> -	shmob_drm_crtc_enable_vblank(sdev, false);
> -}
> -
>  static const struct file_operations shmob_drm_fops = {
>  	.owner		= THIS_MODULE,
>  	.open		= drm_open,
> @@ -256,8 +239,6 @@ static void shmob_drm_disable_vblank(struct drm_device
> *dev, unsigned int pipe) .load			= shmob_drm_load,
>  	.unload			= shmob_drm_unload,
>  	.irq_handler		= shmob_drm_irq,
> -	.enable_vblank		= shmob_drm_enable_vblank,
> -	.disable_vblank		= shmob_drm_disable_vblank,
>  	.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,

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                     ` (5 preceding siblings ...)
  2017-02-07 11:54   ` Alexey Brodkin
@ 2017-02-07 15:21   ` Liviu Dudau
  2017-02-08 19:58   ` Eric Anholt
  7 siblings, 0 replies; 68+ messages in thread
From: Liviu Dudau @ 2017-02-07 15:21 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

On Tue, Feb 07, 2017 at 05:16:14PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Stefan Agner <stefan@agner.ch>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                | 1 -
>  drivers/gpu/drm/arm/hdlcd_drv.c                 | 1 -
>  drivers/gpu/drm/arm/malidp_drv.c                | 1 -

For the HDLCD and Mali DP drivers:

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Thanks for doing this!
Liviu

>  drivers/gpu/drm/armada/armada_drv.c             | 1 -
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    | 1 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         | 1 -
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 -
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 -
>  drivers/gpu/drm/i915/i915_irq.c                 | 1 -
>  drivers/gpu/drm/imx/imx-drm-core.c              | 1 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          | 1 -
>  drivers/gpu/drm/meson/meson_drv.c               | 1 -
>  drivers/gpu/drm/msm/msm_drv.c                   | 1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           | 1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              | 1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           | 1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     | 1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        | 1 -
>  drivers/gpu/drm/sti/sti_drv.c                   | 1 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c               | 1 -
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             | 1 -
>  drivers/gpu/drm/vc4/vc4_drv.c                   | 1 -
>  drivers/gpu/drm/zte/zx_drm_drv.c                | 1 -
>  25 files changed, 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 8d8344ed655e..1926b200e4cb 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -175,7 +175,6 @@ static int arcpgu_unload(struct drm_device *drm)
>  	.dumb_create = drm_gem_cma_dumb_create,
>  	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
>  	.dumb_destroy = drm_gem_dumb_destroy,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>  	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 4ce4f970920b..5d79e87f7421 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -278,7 +278,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
>  	.irq_preinstall = hdlcd_irq_preinstall,
>  	.irq_postinstall = hdlcd_irq_postinstall,
>  	.irq_uninstall = hdlcd_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = hdlcd_enable_vblank,
>  	.disable_vblank = hdlcd_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 8b0672d4aee9..ca6ccd172de3 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -213,7 +213,6 @@ static void malidp_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
>  			   DRIVER_PRIME,
>  	.lastclose = malidp_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = malidp_enable_vblank,
>  	.disable_vblank = malidp_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 63f42d001f33..bb27892012de 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -87,7 +87,6 @@ static void armada_drm_lastclose(struct drm_device *dev)
>  
>  static struct drm_driver armada_drm_driver = {
>  	.lastclose		= armada_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= armada_drm_enable_vblank,
>  	.disable_vblank		= armada_drm_disable_vblank,
>  	.gem_free_object_unlocked = armada_gem_free_object,
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 427bdff425c2..5cba65b5ea16 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -760,7 +760,6 @@ static void atmel_hlcdc_dc_disable_vblank(struct drm_device *dev,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>  	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>  	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = atmel_hlcdc_dc_enable_vblank,
>  	.disable_vblank = atmel_hlcdc_dc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 035d02ecffcd..a1c22eb12f4b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -263,7 +263,6 @@ static void exynos_drm_lastclose(struct drm_device *dev)
>  	.preclose		= exynos_drm_preclose,
>  	.lastclose		= exynos_drm_lastclose,
>  	.postclose		= exynos_drm_postclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= exynos_drm_crtc_enable_vblank,
>  	.disable_vblank		= exynos_drm_crtc_disable_vblank,
>  	.gem_free_object_unlocked = exynos_drm_gem_free_object,
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 04173235f448..b59b816a1d7d 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -203,7 +203,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
>  	.irq_handler		= fsl_dcu_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= fsl_dcu_drm_enable_vblank,
>  	.disable_vblank		= fsl_dcu_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 7e2043f4348c..8cac70454b57 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -84,7 +84,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	.desc			= "hibmc drm driver",
>  	.major			= 1,
>  	.minor			= 0,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= hibmc_enable_vblank,
>  	.disable_vblank		= hibmc_disable_vblank,
>  	.gem_free_object_unlocked = hibmc_gem_free_object,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 9a0678a33e0d..0624fab8046f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -1025,7 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
>  			       IRQF_SHARED, dev->driver->name, acrtc);
>  	if (ret)
>  		return ret;
> -	dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	dev->driver->enable_vblank = ade_enable_vblank;
>  	dev->driver->disable_vblank = ade_disable_vblank;
>  
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 47d6131e977f..5aab08172faf 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4218,7 +4218,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  	if (IS_GEN2(dev_priv)) {
>  		/* Gen2 doesn't have a hardware frame counter */
>  		dev->max_vblank_count = 0;
> -		dev->driver->get_vblank_counter = drm_vblank_no_hw_counter;
>  	} else if (IS_G4X(dev_priv) || INTEL_INFO(dev_priv)->gen >= 5) {
>  		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
>  		dev->driver->get_vblank_counter = g4x_get_vblank_counter;
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 5ae48836652e..4badbb66d69e 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -288,7 +288,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
>  	.gem_prime_vmap		= drm_gem_cma_prime_vmap,
>  	.gem_prime_vunmap	= drm_gem_cma_prime_vunmap,
>  	.gem_prime_mmap		= drm_gem_cma_prime_mmap,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= imx_drm_enable_vblank,
>  	.disable_vblank		= imx_drm_disable_vblank,
>  	.ioctls			= imx_drm_ioctls,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index b5f88e6d078e..ef8675336465 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -256,7 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = mtk_drm_crtc_enable_vblank,
>  	.disable_vblank = mtk_drm_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 6f2fd82ed483..c0a59889c45f 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -129,7 +129,6 @@ static irqreturn_t meson_irq(int irq, void *arg)
>  	/* Vblank */
>  	.enable_vblank		= meson_enable_vblank,
>  	.disable_vblank		= meson_disable_vblank,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  
>  	/* IRQ */
>  	.irq_handler		= meson_irq,
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 70226eaa5cac..cb47f4a14215 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -816,7 +816,6 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
>  	.irq_preinstall     = msm_irq_preinstall,
>  	.irq_postinstall    = msm_irq_postinstall,
>  	.irq_uninstall      = msm_irq_uninstall,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = msm_enable_vblank,
>  	.disable_vblank     = msm_disable_vblank,
>  	.gem_free_object    = msm_gem_free_object,
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index cdfbe0284635..104722a78bd6 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -340,7 +340,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
>  	.irq_handler		= mxsfb_irq_handler,
>  	.irq_preinstall		= mxsfb_irq_preinstall,
>  	.irq_uninstall		= mxsfb_irq_preinstall,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= mxsfb_enable_vblank,
>  	.disable_vblank		= mxsfb_disable_vblank,
>  	.gem_free_object	= drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 9ed2ca0769e3..626df485a03a 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -977,7 +977,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>  	.debugfs_cleanup = nouveau_drm_debugfs_cleanup,
>  #endif
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = nouveau_display_vblank_enable,
>  	.disable_vblank = nouveau_display_vblank_disable,
>  	.get_scanout_position = nouveau_display_scanoutpos,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index afe8f05b927b..da049a7636ad 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -714,7 +714,6 @@ static void dev_lastclose(struct drm_device *dev)
>  		DRIVER_ATOMIC,
>  	.open = dev_open,
>  	.lastclose = dev_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = omap_irq_enable_vblank,
>  	.disable_vblank = omap_irq_disable_vblank,
>  #ifdef CONFIG_DEBUG_FS
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index c05e00872778..094da3ef49d1 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -259,7 +259,6 @@ static void rcar_du_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME
>  				| DRIVER_ATOMIC,
>  	.lastclose		= rcar_du_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rcar_du_enable_vblank,
>  	.disable_vblank		= rcar_du_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index c30d649cb147..39243480c834 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -270,7 +270,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
>  				  DRIVER_PRIME | DRIVER_ATOMIC,
>  	.lastclose		= rockchip_drm_lastclose,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
>  	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
>  	.gem_vm_ops		= &drm_gem_cma_vm_ops,
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 33cec3d42389..d6b0545d252d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -256,7 +256,6 @@ static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	.load			= shmob_drm_load,
>  	.unload			= shmob_drm_unload,
>  	.irq_handler		= shmob_drm_irq,
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= shmob_drm_enable_vblank,
>  	.disable_vblank		= shmob_drm_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 788feed208d7..d4b771d2d10d 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -264,7 +264,6 @@ static void sti_mode_config_init(struct drm_device *dev)
>  	.dumb_destroy = drm_gem_dumb_destroy,
>  	.fops = &sti_driver_fops,
>  
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = sti_crtc_enable_vblank,
>  	.disable_vblank = sti_crtc_disable_vblank,
>  
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 4ce665349f6b..0816c635df20 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -92,7 +92,6 @@ static void sun4i_drv_disable_vblank(struct drm_device *drm, unsigned int pipe)
>  	/* Frame Buffer Operations */
>  
>  	/* VBlank Operations */
> -	.get_vblank_counter	= drm_vblank_no_hw_counter,
>  	.enable_vblank		= sun4i_drv_enable_vblank,
>  	.disable_vblank		= sun4i_drv_disable_vblank,
>  };
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 372d86fbb093..d5bc98e283d9 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -557,7 +557,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
>  			       DRIVER_PRIME | DRIVER_ATOMIC),
>  	.lastclose          = tilcdc_lastclose,
>  	.irq_handler        = tilcdc_irq,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank      = tilcdc_enable_vblank,
>  	.disable_vblank     = tilcdc_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index a459745e96f7..3a8709d85da1 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -139,7 +139,6 @@ static void vc4_lastclose(struct drm_device *dev)
>  
>  	.enable_vblank = vc4_enable_vblank,
>  	.disable_vblank = vc4_disable_vblank,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.get_scanout_position = vc4_crtc_get_scanoutpos,
>  	.get_vblank_timestamp = vc4_crtc_get_vblank_timestamp,
>  
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index 5c6944a1e72c..afd713a954c6 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -71,7 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  	.lastclose = zx_drm_lastclose,
> -	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = zx_vou_enable_vblank,
>  	.disable_vblank = zx_vou_disable_vblank,
>  	.gem_free_object = drm_gem_cma_free_object,
> -- 
> 1.9.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 05/23] drm: malidp: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 05/23] drm: malidp: " Shawn Guo
@ 2017-02-07 15:22   ` Liviu Dudau
  0 siblings, 0 replies; 68+ messages in thread
From: Liviu Dudau @ 2017-02-07 15:22 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard

On Tue, Feb 07, 2017 at 05:16:17PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>


> ---
>  drivers/gpu/drm/arm/malidp_crtc.c | 21 +++++++++++++++++++++
>  drivers/gpu/drm/arm/malidp_drv.c  | 21 ---------------------
>  2 files changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
> index 08e6a71f5d05..bad4d80cb711 100644
> --- a/drivers/gpu/drm/arm/malidp_crtc.c
> +++ b/drivers/gpu/drm/arm/malidp_crtc.c
> @@ -167,6 +167,25 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
>  	.atomic_check = malidp_crtc_atomic_check,
>  };
>  
> +static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
> +	struct malidp_hw_device *hwdev = malidp->dev;
> +
> +	malidp_hw_enable_irq(hwdev, MALIDP_DE_BLOCK,
> +			     hwdev->map.de_irq_map.vsync_irq);
> +	return 0;
> +}
> +
> +static void malidp_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
> +	struct malidp_hw_device *hwdev = malidp->dev;
> +
> +	malidp_hw_disable_irq(hwdev, MALIDP_DE_BLOCK,
> +			      hwdev->map.de_irq_map.vsync_irq);
> +}
> +
>  static const struct drm_crtc_funcs malidp_crtc_funcs = {
>  	.destroy = drm_crtc_cleanup,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -174,6 +193,8 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank = malidp_crtc_enable_vblank,
> +	.disable_vblank = malidp_crtc_disable_vblank,
>  };
>  
>  int malidp_crtc_init(struct drm_device *drm)
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index ca6ccd172de3..5dfcdb05c96e 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -111,25 +111,6 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
>  
> -static int malidp_enable_vblank(struct drm_device *drm, unsigned int crtc)
> -{
> -	struct malidp_drm *malidp = drm->dev_private;
> -	struct malidp_hw_device *hwdev = malidp->dev;
> -
> -	malidp_hw_enable_irq(hwdev, MALIDP_DE_BLOCK,
> -			     hwdev->map.de_irq_map.vsync_irq);
> -	return 0;
> -}
> -
> -static void malidp_disable_vblank(struct drm_device *drm, unsigned int pipe)
> -{
> -	struct malidp_drm *malidp = drm->dev_private;
> -	struct malidp_hw_device *hwdev = malidp->dev;
> -
> -	malidp_hw_disable_irq(hwdev, MALIDP_DE_BLOCK,
> -			      hwdev->map.de_irq_map.vsync_irq);
> -}
> -
>  static int malidp_init(struct drm_device *drm)
>  {
>  	int ret;
> @@ -213,8 +194,6 @@ static void malidp_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
>  			   DRIVER_PRIME,
>  	.lastclose = malidp_lastclose,
> -	.enable_vblank = malidp_enable_vblank,
> -	.disable_vblank = malidp_disable_vblank,
>  	.gem_free_object_unlocked = drm_gem_cma_free_object,
>  	.gem_vm_ops = &drm_gem_cma_vm_ops,
>  	.dumb_create = drm_gem_cma_dumb_create,
> -- 
> 1.9.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 23/23] drm: zte: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 23/23] drm: zte: " Shawn Guo
@ 2017-02-07 15:34   ` Sean Paul
  0 siblings, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-07 15:34 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:35PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.
> 
> The functions are moved around to save forward declaration.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  drivers/gpu/drm/zte/zx_drm_drv.c |  2 --
>  drivers/gpu/drm/zte/zx_vou.c     | 61 +++++++++++++++-------------------------
>  drivers/gpu/drm/zte/zx_vou.h     |  3 --
>  3 files changed, 23 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index afd713a954c6..b24a70ba4b83 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -71,8 +71,6 @@ static void zx_drm_lastclose(struct drm_device *drm)
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  	.lastclose = zx_drm_lastclose,
> -	.enable_vblank = zx_vou_enable_vblank,
> -	.disable_vblank = zx_vou_disable_vblank,
>  	.gem_free_object = drm_gem_cma_free_object,
>  	.gem_vm_ops = &drm_gem_cma_vm_ops,
>  	.dumb_create = drm_gem_cma_dumb_create,
> diff --git a/drivers/gpu/drm/zte/zx_vou.c b/drivers/gpu/drm/zte/zx_vou.c
> index cf92d675feaa..b500c8dd0d9d 100644
> --- a/drivers/gpu/drm/zte/zx_vou.c
> +++ b/drivers/gpu/drm/zte/zx_vou.c
> @@ -470,6 +470,27 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.atomic_flush = zx_crtc_atomic_flush,
>  };
>  
> +static int zx_vou_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
> +	struct zx_vou_hw *vou = crtc_to_vou(crtc);
> +	u32 int_frame_mask = zcrtc->bits->int_frame_mask;
> +
> +	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
> +		       int_frame_mask);
> +
> +	return 0;
> +}
> +
> +static void zx_vou_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct zx_crtc *zcrtc = to_zx_crtc(crtc);
> +	struct zx_vou_hw *vou = crtc_to_vou(crtc);
> +
> +	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
> +		       zcrtc->bits->int_frame_mask, 0);
> +}
> +
>  static const struct drm_crtc_funcs zx_crtc_funcs = {
>  	.destroy = drm_crtc_cleanup,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -477,6 +498,8 @@ static void zx_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank = zx_vou_enable_vblank,
> +	.disable_vblank = zx_vou_disable_vblank,
>  };
>  
>  static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
> @@ -553,44 +576,6 @@ static int zx_crtc_init(struct drm_device *drm, struct zx_vou_hw *vou,
>  	return 0;
>  }
>  
> -int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe)
> -{
> -	struct drm_crtc *crtc;
> -	struct zx_crtc *zcrtc;
> -	struct zx_vou_hw *vou;
> -	u32 int_frame_mask;
> -
> -	crtc = drm_crtc_from_index(drm, pipe);
> -	if (!crtc)
> -		return 0;
> -
> -	vou = crtc_to_vou(crtc);
> -	zcrtc = to_zx_crtc(crtc);
> -	int_frame_mask = zcrtc->bits->int_frame_mask;
> -
> -	zx_writel_mask(vou->timing + TIMING_INT_CTRL, int_frame_mask,
> -		       int_frame_mask);
> -
> -	return 0;
> -}
> -
> -void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe)
> -{
> -	struct drm_crtc *crtc;
> -	struct zx_crtc *zcrtc;
> -	struct zx_vou_hw *vou;
> -
> -	crtc = drm_crtc_from_index(drm, pipe);
> -	if (!crtc)
> -		return;
> -
> -	vou = crtc_to_vou(crtc);
> -	zcrtc = to_zx_crtc(crtc);
> -
> -	zx_writel_mask(vou->timing + TIMING_INT_CTRL,
> -		       zcrtc->bits->int_frame_mask, 0);
> -}
> -
>  void zx_vou_layer_enable(struct drm_plane *plane)
>  {
>  	struct zx_crtc *zcrtc = to_zx_crtc(plane->state->crtc);
> diff --git a/drivers/gpu/drm/zte/zx_vou.h b/drivers/gpu/drm/zte/zx_vou.h
> index 57e3c31ee6a5..97d72bfce982 100644
> --- a/drivers/gpu/drm/zte/zx_vou.h
> +++ b/drivers/gpu/drm/zte/zx_vou.h
> @@ -61,9 +61,6 @@ struct vou_div_config {
>  void zx_vou_config_dividers(struct drm_crtc *crtc,
>  			    struct vou_div_config *configs, int num);
>  
> -int zx_vou_enable_vblank(struct drm_device *drm, unsigned int pipe);
> -void zx_vou_disable_vblank(struct drm_device *drm, unsigned int pipe);
> -
>  void zx_vou_layer_enable(struct drm_plane *plane);
>  void zx_vou_layer_disable(struct drm_plane *plane);
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs Shawn Guo
@ 2017-02-07 15:35   ` Sean Paul
  0 siblings, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-07 15:35 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:29PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> With the vblank hooks in struct drm_crtc_funcs, we do not need to
> maintain struct rockchip_crtc_funcs and the related registration
> functions.  Remove them.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 51 -----------------------------
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 14 --------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  9 ++---
>  3 files changed, 2 insertions(+), 72 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 39243480c834..7719b9cd5b74 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -74,55 +74,6 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
>  	arm_iommu_detach_device(dev);
>  }
>  
> -int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
> -				 const struct rockchip_crtc_funcs *crtc_funcs)
> -{
> -	int pipe = drm_crtc_index(crtc);
> -	struct rockchip_drm_private *priv = crtc->dev->dev_private;
> -
> -	if (pipe >= ROCKCHIP_MAX_CRTC)
> -		return -EINVAL;
> -
> -	priv->crtc_funcs[pipe] = crtc_funcs;
> -
> -	return 0;
> -}
> -
> -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc)
> -{
> -	int pipe = drm_crtc_index(crtc);
> -	struct rockchip_drm_private *priv = crtc->dev->dev_private;
> -
> -	if (pipe >= ROCKCHIP_MAX_CRTC)
> -		return;
> -
> -	priv->crtc_funcs[pipe] = NULL;
> -}
> -
> -static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev,
> -					   unsigned int pipe)
> -{
> -	struct rockchip_drm_private *priv = dev->dev_private;
> -	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> -
> -	if (crtc && priv->crtc_funcs[pipe] &&
> -	    priv->crtc_funcs[pipe]->enable_vblank)
> -		return priv->crtc_funcs[pipe]->enable_vblank(crtc);
> -
> -	return 0;
> -}
> -
> -static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev,
> -					     unsigned int pipe)
> -{
> -	struct rockchip_drm_private *priv = dev->dev_private;
> -	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> -
> -	if (crtc && priv->crtc_funcs[pipe] &&
> -	    priv->crtc_funcs[pipe]->enable_vblank)
> -		priv->crtc_funcs[pipe]->disable_vblank(crtc);
> -}
> -
>  static int rockchip_drm_bind(struct device *dev)
>  {
>  	struct drm_device *drm_dev;
> @@ -270,8 +221,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev)
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM |
>  				  DRIVER_PRIME | DRIVER_ATOMIC,
>  	.lastclose		= rockchip_drm_lastclose,
> -	.enable_vblank		= rockchip_drm_crtc_enable_vblank,
> -	.disable_vblank		= rockchip_drm_crtc_disable_vblank,
>  	.gem_vm_ops		= &drm_gem_cma_vm_ops,
>  	.gem_free_object_unlocked = rockchip_gem_free_object,
>  	.dumb_create		= rockchip_gem_dumb_create,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> index fb6226cf84b7..9f9bc959b108 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> @@ -31,16 +31,6 @@
>  struct drm_device;
>  struct drm_connector;
>  
> -/*
> - * Rockchip drm private crtc funcs.
> - * @enable_vblank: enable crtc vblank irq.
> - * @disable_vblank: disable crtc vblank irq.
> - */
> -struct rockchip_crtc_funcs {
> -	int (*enable_vblank)(struct drm_crtc *crtc);
> -	void (*disable_vblank)(struct drm_crtc *crtc);
> -};
> -
>  struct rockchip_crtc_state {
>  	struct drm_crtc_state base;
>  	int output_type;
> @@ -58,16 +48,12 @@ struct rockchip_crtc_state {
>  struct rockchip_drm_private {
>  	struct drm_fb_helper fbdev_helper;
>  	struct drm_gem_object *fbdev_bo;
> -	const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
>  	struct drm_atomic_state *state;
>  
>  	struct list_head psr_list;
>  	spinlock_t psr_list_lock;
>  };
>  
> -int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
> -				 const struct rockchip_crtc_funcs *crtc_funcs);
> -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc);
>  int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
>  				   struct device *dev);
>  void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index fb5f001f51c3..ffee8d8c3794 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -853,11 +853,6 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
>  	spin_unlock_irqrestore(&vop->irq_lock, flags);
>  }
>  
> -static const struct rockchip_crtc_funcs private_crtc_funcs = {
> -	.enable_vblank = vop_crtc_enable_vblank,
> -	.disable_vblank = vop_crtc_disable_vblank,
> -};
> -
>  static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
>  				const struct drm_display_mode *mode,
>  				struct drm_display_mode *adjusted_mode)
> @@ -1112,6 +1107,8 @@ static void vop_crtc_destroy_state(struct drm_crtc *crtc,
>  	.reset = vop_crtc_reset,
>  	.atomic_duplicate_state = vop_crtc_duplicate_state,
>  	.atomic_destroy_state = vop_crtc_destroy_state,
> +	.enable_vblank = vop_crtc_enable_vblank,
> +	.disable_vblank = vop_crtc_disable_vblank,
>  };
>  
>  static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
> @@ -1283,7 +1280,6 @@ static int vop_create_crtc(struct vop *vop)
>  	init_completion(&vop->dsp_hold_completion);
>  	init_completion(&vop->line_flag_completion);
>  	crtc->port = port;
> -	rockchip_register_crtc_funcs(crtc, &private_crtc_funcs);
>  
>  	return 0;
>  
> @@ -1302,7 +1298,6 @@ static void vop_destroy_crtc(struct vop *vop)
>  	struct drm_device *drm_dev = vop->drm_dev;
>  	struct drm_plane *plane, *tmp;
>  
> -	rockchip_unregister_crtc_funcs(crtc);
>  	of_node_put(crtc->port);
>  
>  	/*
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 09/23] drm: fsl-dcu: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 09/23] drm: fsl-dcu: " Shawn Guo
@ 2017-02-08  5:01   ` Stefan Agner
  2017-02-08 12:04     ` Daniel Vetter
  0 siblings, 1 reply; 68+ messages in thread
From: Stefan Agner @ 2017-02-08  5:01 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, dri-devel,
	Laurent Pinchart, Daniel Vetter, Marek Vasut, Alexey Brodkin,
	Russell King, Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers,
	Ben Skeggs, Jyri Sarha, Maxime Ripard

On 2017-02-07 01:16, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Stefan Agner <stefan@agner.ch>

Acked-by: Stefan Agner <stefan@agner.ch>

> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 26 ++++++++++++++++++++++++++
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c  | 25 -------------------------
>  2 files changed, 26 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> index deb57435cc89..cc4e944a1d3c 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> @@ -137,6 +137,30 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct
> drm_crtc *crtc)
>  	.mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb,
>  };
>  
> +static int fsl_dcu_drm_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct drm_device *dev = crtc->dev;
> +	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> +	unsigned int value;
> +
> +	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> +	value &= ~DCU_INT_MASK_VBLANK;
> +	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> +
> +	return 0;
> +}
> +
> +static void fsl_dcu_drm_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct drm_device *dev = crtc->dev;
> +	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> +	unsigned int value;
> +
> +	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> +	value |= DCU_INT_MASK_VBLANK;
> +	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> +}
> +
>  static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs = {
>  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> @@ -144,6 +168,8 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct
> drm_crtc *crtc)
>  	.page_flip = drm_atomic_helper_page_flip,
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.set_config = drm_atomic_helper_set_config,
> +	.enable_vblank = fsl_dcu_drm_crtc_enable_vblank,
> +	.disable_vblank = fsl_dcu_drm_crtc_disable_vblank,
>  };
>  
>  int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index b59b816a1d7d..b5391c124c64 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -154,29 +154,6 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> -static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -	unsigned int value;
> -
> -	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> -	value &= ~DCU_INT_MASK_VBLANK;
> -	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> -
> -	return 0;
> -}
> -
> -static void fsl_dcu_drm_disable_vblank(struct drm_device *dev,
> -				       unsigned int pipe)
> -{
> -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> -	unsigned int value;
> -
> -	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> -	value |= DCU_INT_MASK_VBLANK;
> -	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> -}
> -
>  static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>  {
>  	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> @@ -203,8 +180,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
>  	.irq_handler		= fsl_dcu_drm_irq,
> -	.enable_vblank		= fsl_dcu_drm_enable_vblank,
> -	.disable_vblank		= fsl_dcu_drm_disable_vblank,
>  	.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,
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (22 preceding siblings ...)
  2017-02-07  9:16 ` [PATCH v3 23/23] drm: zte: " Shawn Guo
@ 2017-02-08 11:30 ` Tomi Valkeinen
  2017-02-08 18:10   ` Laurent Pinchart
  2017-02-08 15:49 ` Sean Paul
  24 siblings, 1 reply; 68+ messages in thread
From: Tomi Valkeinen @ 2017-02-08 11:30 UTC (permalink / raw)
  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,
	Maxime Ripard


[-- Attachment #1.1.1.1: Type: text/plain, Size: 1288 bytes --]

Hi,

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.

 Tomi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.1.2: 0001-drm-omap-use-vblank-hooks-in-struct-drm_crtc_funcs.patch --]
[-- Type: text/x-diff; name="0001-drm-omap-use-vblank-hooks-in-struct-drm_crtc_funcs.patch", Size: 4691 bytes --]

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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 09/23] drm: fsl-dcu: use vblank hooks in struct drm_crtc_funcs
  2017-02-08  5:01   ` Stefan Agner
@ 2017-02-08 12:04     ` Daniel Vetter
  0 siblings, 0 replies; 68+ messages in thread
From: Daniel Vetter @ 2017-02-08 12:04 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, dri-devel,
	Laurent Pinchart, Daniel Vetter, Marek Vasut, Alexey Brodkin,
	Russell King, Xinliang Liu, Tomi Valkeinen, Mali DP Maintainers,
	Ben Skeggs, Jyri Sarha, Maxime Ripard, Shawn Guo

On Tue, Feb 07, 2017 at 09:01:22PM -0800, Stefan Agner wrote:
> On 2017-02-07 01:16, Shawn Guo wrote:
> > From: Shawn Guo <shawn.guo@linaro.org>
> > 
> > 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: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Stefan Agner <stefan@agner.ch>
> 
> Acked-by: Stefan Agner <stefan@agner.ch>

Merged up to this one to drm-misc for 4.12, I'll give the others some more
time for maintainer acks.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 26 ++++++++++++++++++++++++++
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c  | 25 -------------------------
> >  2 files changed, 26 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> > index deb57435cc89..cc4e944a1d3c 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> > @@ -137,6 +137,30 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct
> > drm_crtc *crtc)
> >  	.mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb,
> >  };
> >  
> > +static int fsl_dcu_drm_crtc_enable_vblank(struct drm_crtc *crtc)
> > +{
> > +	struct drm_device *dev = crtc->dev;
> > +	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> > +	unsigned int value;
> > +
> > +	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> > +	value &= ~DCU_INT_MASK_VBLANK;
> > +	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> > +
> > +	return 0;
> > +}
> > +
> > +static void fsl_dcu_drm_crtc_disable_vblank(struct drm_crtc *crtc)
> > +{
> > +	struct drm_device *dev = crtc->dev;
> > +	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> > +	unsigned int value;
> > +
> > +	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> > +	value |= DCU_INT_MASK_VBLANK;
> > +	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> > +}
> > +
> >  static const struct drm_crtc_funcs fsl_dcu_drm_crtc_funcs = {
> >  	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> >  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> > @@ -144,6 +168,8 @@ static void fsl_dcu_drm_crtc_mode_set_nofb(struct
> > drm_crtc *crtc)
> >  	.page_flip = drm_atomic_helper_page_flip,
> >  	.reset = drm_atomic_helper_crtc_reset,
> >  	.set_config = drm_atomic_helper_set_config,
> > +	.enable_vblank = fsl_dcu_drm_crtc_enable_vblank,
> > +	.disable_vblank = fsl_dcu_drm_crtc_disable_vblank,
> >  };
> >  
> >  int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > index b59b816a1d7d..b5391c124c64 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > @@ -154,29 +154,6 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
> >  	return IRQ_HANDLED;
> >  }
> >  
> > -static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
> > -{
> > -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> > -	unsigned int value;
> > -
> > -	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> > -	value &= ~DCU_INT_MASK_VBLANK;
> > -	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> > -
> > -	return 0;
> > -}
> > -
> > -static void fsl_dcu_drm_disable_vblank(struct drm_device *dev,
> > -				       unsigned int pipe)
> > -{
> > -	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> > -	unsigned int value;
> > -
> > -	regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> > -	value |= DCU_INT_MASK_VBLANK;
> > -	regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> > -}
> > -
> >  static void fsl_dcu_drm_lastclose(struct drm_device *dev)
> >  {
> >  	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> > @@ -203,8 +180,6 @@ static void fsl_dcu_drm_lastclose(struct drm_device *dev)
> >  	.load			= fsl_dcu_load,
> >  	.unload			= fsl_dcu_unload,
> >  	.irq_handler		= fsl_dcu_drm_irq,
> > -	.enable_vblank		= fsl_dcu_drm_enable_vblank,
> > -	.disable_vblank		= fsl_dcu_drm_disable_vblank,
> >  	.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,

-- 
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

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 10/23] drm: hibmc: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 10/23] drm: hibmc: " Shawn Guo
@ 2017-02-08 15:39   ` Sean Paul
  2017-02-16  3:28   ` Xinliang Liu
  1 sibling, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-08 15:39 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:22PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
>  2 files changed, 20 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index c655883d3613..59542bddc980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>  	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>  }
>  
> +static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +	struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> +	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +
> +	return 0;
> +}
> +
> +static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +	struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> +	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
>  	.page_flip = drm_atomic_helper_page_flip,
>  	.set_config = drm_atomic_helper_set_config,
> @@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.reset = drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +	.enable_vblank = hibmc_crtc_enable_vblank,
> +	.disable_vblank = hibmc_crtc_disable_vblank,
>  };
>  
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8cac70454b57..2ffdbf9801bd 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,26 +37,6 @@
>  	.llseek		= no_llseek,
>  };
>  
> -static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct hibmc_drm_private *priv =
> -		(struct hibmc_drm_private *)dev->dev_private;
> -
> -	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> -	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -
> -	return 0;
> -}
> -
> -static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	struct hibmc_drm_private *priv =
> -		(struct hibmc_drm_private *)dev->dev_private;
> -
> -	writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> -	       priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -}
> -
>  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
>  	struct drm_device *dev = (struct drm_device *)arg;
> @@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	.desc			= "hibmc drm driver",
>  	.major			= 1,
>  	.minor			= 0,
> -	.enable_vblank		= hibmc_enable_vblank,
> -	.disable_vblank		= hibmc_disable_vblank,
>  	.gem_free_object_unlocked = hibmc_gem_free_object,
>  	.dumb_create            = hibmc_dumb_create,
>  	.dumb_map_offset        = hibmc_dumb_mmap_offset,
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
  2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
                   ` (23 preceding siblings ...)
  2017-02-08 11:30 ` [PATCH v3 00/23] Add vblank hooks to " Tomi Valkeinen
@ 2017-02-08 15:49 ` Sean Paul
  2017-02-09  8:36   ` Shawn Guo
  24 siblings, 1 reply; 68+ messages in thread
From: Sean Paul @ 2017-02-08 15:49 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:12PM +0800, 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.
> 

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 -
>  drivers/gpu/drm/meson/meson_crtc.c              |  22 +++++
>  drivers/gpu/drm/meson/meson_drv.c               |  21 -----
>  drivers/gpu/drm/msm/msm_drv.c                   |   1 -
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c               |   1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c           |   1 -
>  drivers/gpu/drm/omapdrm/omap_drv.c              |   1 -
>  drivers/gpu/drm/qxl/qxl_display.c               |  16 ++++
>  drivers/gpu/drm/qxl/qxl_drv.c                   |  18 -----
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c          |  29 ++++---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h          |   1 -
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           |  20 -----
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     |  52 ------------
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h     |  14 ----
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c     |   9 +--
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c       |  51 ++++++++----
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.h       |   1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        |  20 -----
>  drivers/gpu/drm/sti/sti_drv.c                   |   1 -
>  drivers/gpu/drm/sun4i/sun4i_crtc.c              |  24 ++++++
>  drivers/gpu/drm/sun4i/sun4i_drv.c               |  28 -------
>  drivers/gpu/drm/tegra/dc.c                      |  15 +++-
>  drivers/gpu/drm/tegra/drm.c                     |  38 ---------
>  drivers/gpu/drm/tegra/drm.h                     |   3 -
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c            |  11 +++
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             |  13 ---
>  drivers/gpu/drm/vc4/vc4_crtc.c                  |   8 +-
>  drivers/gpu/drm/vc4/vc4_drv.c                   |   3 -
>  drivers/gpu/drm/vc4/vc4_drv.h                   |   2 -
>  drivers/gpu/drm/zte/zx_drm_drv.c                |   3 -
>  drivers/gpu/drm/zte/zx_vou.c                    |  61 ++++++--------
>  drivers/gpu/drm/zte/zx_vou.h                    |   3 -
>  include/drm/drm_crtc.h                          |  44 ++++++++++
>  include/drm/drm_drv.h                           |  16 +++-
>  include/drm/drm_irq.h                           |   1 -
>  62 files changed, 481 insertions(+), 710 deletions(-)
> 
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
  2017-02-08 11:30 ` [PATCH v3 00/23] Add vblank hooks to " Tomi Valkeinen
@ 2017-02-08 18:10   ` Laurent Pinchart
  2017-02-08 18:24     ` Daniel Vetter
  0 siblings, 1 reply; 68+ messages in thread
From: Laurent Pinchart @ 2017-02-08 18:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Mali DP Maintainers, Ben Skeggs, Jyri Sarha, dri-devel,
	Maxime Ripard, Shawn Guo

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.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
  2017-02-08 18:10   ` Laurent Pinchart
@ 2017-02-08 18:24     ` Daniel Vetter
  0 siblings, 0 replies; 68+ messages in thread
From: Daniel Vetter @ 2017-02-08 18:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Neil Armstrong, Daniel Vetter, Liviu Dudau, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard, Shawn Guo

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
-- 
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

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 22/23] drm: vc4: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 22/23] drm: vc4: " Shawn Guo
@ 2017-02-08 19:56   ` Eric Anholt
  0 siblings, 0 replies; 68+ messages in thread
From: Eric Anholt @ 2017-02-08 19:56 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 359 bytes --]

Shawn Guo <shawnguo@kernel.org> writes:

> From: Shawn Guo <shawn.guo@linaro.org>
>
> 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.

Thanks for doing this cleanup!

Reviewed-by: Eric Anholt <eric@anholt.net>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code
  2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
                     ` (6 preceding siblings ...)
  2017-02-07 15:21   ` Liviu Dudau
@ 2017-02-08 19:58   ` Eric Anholt
  7 siblings, 0 replies; 68+ messages in thread
From: Eric Anholt @ 2017-02-08 19:58 UTC (permalink / raw)
  To: Shawn Guo, Daniel Vetter
  Cc: Neil Armstrong, Liviu Dudau, Laurent Pinchart, Daniel Vetter,
	Marek Vasut, Alexey Brodkin, Russell King, Xinliang Liu,
	Tomi Valkeinen, Mali DP Maintainers, Ben Skeggs, Jyri Sarha,
	dri-devel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 516 bytes --]

Shawn Guo <shawnguo@kernel.org> writes:

> From: Shawn Guo <shawn.guo@linaro.org>
>
> Core code already makes drm_driver.get_vblank_counter hook optional by
> letting drm_vblank_no_hw_counter be the default implementation for the
> function hook.  So the drm_vblank_no_hw_counter assignment in the driver
> code becomes redundant and can be removed now.

Thanks.  Missing this hook was actually a problem in vc4 for a while, so
it's nice to have sensible defaults.  For vc4:

Acked-by: Eric Anholt <eric@anholt.net>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs
  2017-02-08 15:49 ` Sean Paul
@ 2017-02-09  8:36   ` Shawn Guo
  0 siblings, 0 replies; 68+ messages in thread
From: Shawn Guo @ 2017-02-09  8:36 UTC (permalink / raw)
  To: Sean Paul
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

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 <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.
> > 
> 
> 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

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 11/23] drm: kirin: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 11/23] drm: kirin: " Shawn Guo
@ 2017-02-16  3:23   ` Xinliang Liu
  2017-02-21 16:20     ` Sean Paul
  0 siblings, 1 reply; 68+ messages in thread
From: Xinliang Liu @ 2017-02-16  3:23 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On 7 February 2017 at 17:16, Shawn Guo <shawnguo@kernel.org> wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>

Thanks Shawn for the rework patches,
For the kirin,
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 0624fab8046f..c96c228a9898 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -302,9 +302,8 @@ static void ade_set_medianoc_qos(struct ade_crtc *acrtc)
>                            SOCKET_QOS_EN, SOCKET_QOS_EN);
>  }
>
> -static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> -       struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
>         struct ade_crtc *acrtc = to_ade_crtc(crtc);
>         struct ade_hw_ctx *ctx = acrtc->ctx;
>         void __iomem *base = ctx->base;
> @@ -318,9 +317,8 @@ static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
>         return 0;
>  }
>
> -static void ade_disable_vblank(struct drm_device *dev, unsigned int pipe)
> +static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> -       struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
>         struct ade_crtc *acrtc = to_ade_crtc(crtc);
>         struct ade_hw_ctx *ctx = acrtc->ctx;
>         void __iomem *base = ctx->base;
> @@ -570,6 +568,8 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
>         .set_property = drm_atomic_helper_crtc_set_property,
>         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state   = drm_atomic_helper_crtc_destroy_state,
> +       .enable_vblank  = ade_crtc_enable_vblank,
> +       .disable_vblank = ade_crtc_disable_vblank,
>  };
>
>  static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> @@ -1025,8 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
>                                IRQF_SHARED, dev->driver->name, acrtc);
>         if (ret)
>                 return ret;
> -       dev->driver->enable_vblank = ade_enable_vblank;
> -       dev->driver->disable_vblank = ade_disable_vblank;
>
>         return 0;
>  }
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 10/23] drm: hibmc: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 10/23] drm: hibmc: " Shawn Guo
  2017-02-08 15:39   ` Sean Paul
@ 2017-02-16  3:28   ` Xinliang Liu
  1 sibling, 0 replies; 68+ messages in thread
From: Xinliang Liu @ 2017-02-16  3:28 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On 7 February 2017 at 17:16, Shawn Guo <shawnguo@kernel.org> wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> 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: Shawn Guo <shawn.guo@linaro.org>
> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>

Thanks Shawn for the rework patches,
For the hibmc,
Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>

Thanks,
-xinliang

> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 20 ++++++++++++++++++++
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 ----------------------
>  2 files changed, 20 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> index c655883d3613..59542bddc980 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -423,6 +423,24 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>         spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>  }
>
> +static int hibmc_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> +       struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> +              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +
> +       return 0;
> +}
> +
> +static void hibmc_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> +       struct hibmc_drm_private *priv = crtc->dev->dev_private;
> +
> +       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> +              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> +}
> +
>  static const struct drm_crtc_funcs hibmc_crtc_funcs = {
>         .page_flip = drm_atomic_helper_page_flip,
>         .set_config = drm_atomic_helper_set_config,
> @@ -430,6 +448,8 @@ static void hibmc_crtc_atomic_flush(struct drm_crtc *crtc,
>         .reset = drm_atomic_helper_crtc_reset,
>         .atomic_duplicate_state =  drm_atomic_helper_crtc_duplicate_state,
>         .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> +       .enable_vblank = hibmc_crtc_enable_vblank,
> +       .disable_vblank = hibmc_crtc_disable_vblank,
>  };
>
>  static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 8cac70454b57..2ffdbf9801bd 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,26 +37,6 @@
>         .llseek         = no_llseek,
>  };
>
> -static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -       struct hibmc_drm_private *priv =
> -               (struct hibmc_drm_private *)dev->dev_private;
> -
> -       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(1),
> -              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -
> -       return 0;
> -}
> -
> -static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -       struct hibmc_drm_private *priv =
> -               (struct hibmc_drm_private *)dev->dev_private;
> -
> -       writel(HIBMC_RAW_INTERRUPT_EN_VBLANK(0),
> -              priv->mmio + HIBMC_RAW_INTERRUPT_EN);
> -}
> -
>  irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *)arg;
> @@ -84,8 +64,6 @@ irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>         .desc                   = "hibmc drm driver",
>         .major                  = 1,
>         .minor                  = 0,
> -       .enable_vblank          = hibmc_enable_vblank,
> -       .disable_vblank         = hibmc_disable_vblank,
>         .gem_free_object_unlocked = hibmc_gem_free_object,
>         .dumb_create            = hibmc_dumb_create,
>         .dumb_map_offset        = hibmc_dumb_mmap_offset,
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 11/23] drm: kirin: use vblank hooks in struct drm_crtc_funcs
  2017-02-16  3:23   ` Xinliang Liu
@ 2017-02-21 16:20     ` Sean Paul
  0 siblings, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-21 16:20 UTC (permalink / raw)
  To: Xinliang Liu
  Cc: Marek Vasut, Neil Armstrong, Daniel Vetter, Alexey Brodkin,
	Liviu Dudau, Russell King, dri-devel, Xinliang Liu, Ben Skeggs,
	Tomi Valkeinen, Mali DP Maintainers, Jyri Sarha, Daniel Vetter,
	Maxime Ripard, Shawn Guo, Laurent Pinchart

On Thu, Feb 16, 2017 at 11:23:39AM +0800, Xinliang Liu wrote:
> On 7 February 2017 at 17:16, Shawn Guo <shawnguo@kernel.org> wrote:
> > From: Shawn Guo <shawn.guo@linaro.org>
> >
> > 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: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
> 
> Thanks Shawn for the rework patches,
> For the kirin,
> Reviewed-by: Xinliang Liu <xinliang.liu@linaro.org>

Applied to -misc

Thanks,

Sean

> 
> Thanks,
> -xinliang
> 
> > ---
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > index 0624fab8046f..c96c228a9898 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > @@ -302,9 +302,8 @@ static void ade_set_medianoc_qos(struct ade_crtc *acrtc)
> >                            SOCKET_QOS_EN, SOCKET_QOS_EN);
> >  }
> >
> > -static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
> > +static int ade_crtc_enable_vblank(struct drm_crtc *crtc)
> >  {
> > -       struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> >         struct ade_crtc *acrtc = to_ade_crtc(crtc);
> >         struct ade_hw_ctx *ctx = acrtc->ctx;
> >         void __iomem *base = ctx->base;
> > @@ -318,9 +317,8 @@ static int ade_enable_vblank(struct drm_device *dev, unsigned int pipe)
> >         return 0;
> >  }
> >
> > -static void ade_disable_vblank(struct drm_device *dev, unsigned int pipe)
> > +static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
> >  {
> > -       struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
> >         struct ade_crtc *acrtc = to_ade_crtc(crtc);
> >         struct ade_hw_ctx *ctx = acrtc->ctx;
> >         void __iomem *base = ctx->base;
> > @@ -570,6 +568,8 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
> >         .set_property = drm_atomic_helper_crtc_set_property,
> >         .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> >         .atomic_destroy_state   = drm_atomic_helper_crtc_destroy_state,
> > +       .enable_vblank  = ade_crtc_enable_vblank,
> > +       .disable_vblank = ade_crtc_disable_vblank,
> >  };
> >
> >  static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> > @@ -1025,8 +1025,6 @@ static int ade_drm_init(struct platform_device *pdev)
> >                                IRQF_SHARED, dev->driver->name, acrtc);
> >         if (ret)
> >                 return ret;
> > -       dev->driver->enable_vblank = ade_enable_vblank;
> > -       dev->driver->disable_vblank = ade_disable_vblank;
> >
> >         return 0;
> >  }
> > --
> > 1.9.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 15/23] drm: qxl: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 15/23] drm: qxl: " Shawn Guo
@ 2017-02-21 16:21   ` Sean Paul
  0 siblings, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-21 16:21 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Dave Airlie, Daniel Vetter, Maxime Ripard,
	Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:27PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>

Applied to -misc

Thanks,

Sean

> Cc: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/qxl/qxl_display.c | 16 ++++++++++++++++
>  drivers/gpu/drm/qxl/qxl_drv.c     | 18 ------------------
>  2 files changed, 16 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index 1094cd33eb06..2ce805a7ce5e 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -548,6 +548,19 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
>  	return 0;
>  }
>  
> +static u32 qxl_noop_get_vblank_counter(struct drm_crtc *crtc)
> +{
> +	return 0;
> +}
> +
> +static int qxl_noop_enable_vblank(struct drm_crtc *crtc)
> +{
> +	return 0;
> +}
> +
> +static void qxl_noop_disable_vblank(struct drm_crtc *crtc)
> +{
> +}
>  
>  static const struct drm_crtc_funcs qxl_crtc_funcs = {
>  	.cursor_set2 = qxl_crtc_cursor_set2,
> @@ -555,6 +568,9 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc,
>  	.set_config = drm_crtc_helper_set_config,
>  	.destroy = qxl_crtc_destroy,
>  	.page_flip = qxl_crtc_page_flip,
> +	.get_vblank_counter = qxl_noop_get_vblank_counter,
> +	.enable_vblank = qxl_noop_enable_vblank,
> +	.disable_vblank = qxl_noop_disable_vblank,
>  };
>  
>  void qxl_user_framebuffer_destroy(struct drm_framebuffer *fb)
> diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
> index 8e17c241e63c..48d51a2f3bd8 100644
> --- a/drivers/gpu/drm/qxl/qxl_drv.c
> +++ b/drivers/gpu/drm/qxl/qxl_drv.c
> @@ -247,21 +247,6 @@ static int qxl_pm_restore(struct device *dev)
>  	return qxl_drm_resume(drm_dev, false);
>  }
>  
> -static u32 qxl_noop_get_vblank_counter(struct drm_device *dev,
> -				       unsigned int pipe)
> -{
> -	return 0;
> -}
> -
> -static int qxl_noop_enable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -	return 0;
> -}
> -
> -static void qxl_noop_disable_vblank(struct drm_device *dev, unsigned int pipe)
> -{
> -}
> -
>  static const struct dev_pm_ops qxl_pm_ops = {
>  	.suspend = qxl_pm_suspend,
>  	.resume = qxl_pm_resume,
> @@ -281,9 +266,6 @@ static void qxl_noop_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  static struct drm_driver qxl_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
>  			   DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
> -	.get_vblank_counter = qxl_noop_get_vblank_counter,
> -	.enable_vblank = qxl_noop_enable_vblank,
> -	.disable_vblank = qxl_noop_disable_vblank,
>  
>  	.set_busid = drm_pci_set_busid,
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs
  2017-02-07  9:16 ` [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs Shawn Guo
@ 2017-02-21 16:21   ` Sean Paul
  0 siblings, 0 replies; 68+ messages in thread
From: Sean Paul @ 2017-02-21 16:21 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Marek Vasut, dri-devel, Neil Armstrong, Daniel Vetter,
	Tomi Valkeinen, Liviu Dudau, Russell King, Jyri Sarha,
	Xinliang Liu, Alexey Brodkin, Mali DP Maintainers,
	Laurent Pinchart, Daniel Vetter, Maxime Ripard, Ben Skeggs

On Tue, Feb 07, 2017 at 05:16:25PM +0800, Shawn Guo wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> 
> 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: Shawn Guo <shawn.guo@linaro.org>

Applied to -misc

Thanks,

Sean

> Cc: CK Hu <ck.hu@mediatek.com>
> ---
>  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  | 3 ---
>  3 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index a73de1e669c2..69982f5a6198 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -168,9 +168,8 @@ static void mtk_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  	state->pending_config = true;
>  }
>  
> -int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
> +static int mtk_drm_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> -	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
>  	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
>  	struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
>  
> @@ -179,9 +178,8 @@ int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
>  	return 0;
>  }
>  
> -void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe)
> +static void mtk_drm_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> -	struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
>  	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
>  	struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
>  
> @@ -436,6 +434,8 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
>  	.atomic_duplicate_state	= mtk_drm_crtc_duplicate_state,
>  	.atomic_destroy_state	= mtk_drm_crtc_destroy_state,
>  	.gamma_set		= drm_atomic_helper_legacy_gamma_set,
> +	.enable_vblank		= mtk_drm_crtc_enable_vblank,
> +	.disable_vblank		= mtk_drm_crtc_disable_vblank,
>  };
>  
>  static const struct drm_crtc_helper_funcs mtk_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
> index a1550fa3c9d2..9d9410c67ae9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.h
> @@ -23,8 +23,6 @@
>  #define MTK_MAX_BPC	10
>  #define MTK_MIN_BPC	3
>  
> -int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe);
> -void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe);
>  void mtk_drm_crtc_commit(struct drm_crtc *crtc);
>  void mtk_crtc_ddp_irq(struct drm_crtc *crtc, struct mtk_ddp_comp *ovl);
>  int mtk_drm_crtc_create(struct drm_device *drm_dev,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index ef8675336465..f5a1fd9b3ecc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -256,9 +256,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  			   DRIVER_ATOMIC,
>  
> -	.enable_vblank = mtk_drm_crtc_enable_vblank,
> -	.disable_vblank = mtk_drm_crtc_disable_vblank,
> -
>  	.gem_free_object_unlocked = mtk_drm_gem_free_object,
>  	.gem_vm_ops = &drm_gem_cma_vm_ops,
>  	.dumb_create = mtk_drm_gem_dumb_create,
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2017-02-21 16:21 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07  9:16 [PATCH v3 00/23] Add vblank hooks to struct drm_crtc_funcs Shawn Guo
2017-02-07  9:16 ` [PATCH v3 01/23] drm: add " Shawn Guo
2017-02-07 10:38   ` Andrzej Hajda
2017-02-07 10:52     ` Daniel Vetter
2017-02-07 11:50       ` Thierry Reding
2017-02-07 11:04   ` Thierry Reding
2017-02-07 14:01   ` Laurent Pinchart
2017-02-07  9:16 ` [PATCH v3 02/23] drm: remove drm_vblank_no_hw_counter assignment from driver code Shawn Guo
2017-02-07  9:27   ` Maxime Ripard
2017-02-07  9:46   ` Boris Brezillon
2017-02-07 10:09   ` Neil Armstrong
2017-02-07 10:22   ` Russell King - ARM Linux
2017-02-07 10:42   ` Laurent Pinchart
2017-02-07 10:44     ` Russell King - ARM Linux
2017-02-07 10:58       ` Laurent Pinchart
2017-02-07 11:01       ` Thierry Reding
2017-02-07 11:54   ` Alexey Brodkin
2017-02-07 15:21   ` Liviu Dudau
2017-02-08 19:58   ` Eric Anholt
2017-02-07  9:16 ` [PATCH v3 03/23] drm: unexport function drm_vblank_no_hw_counter() Shawn Guo
2017-02-07 10:56   ` Laurent Pinchart
2017-02-07  9:16 ` [PATCH v3 04/23] drm: hdlcd: use vblank hooks in struct drm_crtc_funcs Shawn Guo
2017-02-07  9:16 ` [PATCH v3 05/23] drm: malidp: " Shawn Guo
2017-02-07 15:22   ` Liviu Dudau
2017-02-07  9:16 ` [PATCH v3 06/23] drm: armada: " Shawn Guo
2017-02-07 10:23   ` Russell King - ARM Linux
2017-02-07  9:16 ` [PATCH v3 07/23] drm: atmel: " Shawn Guo
2017-02-07  9:46   ` Boris Brezillon
2017-02-07  9:16 ` [PATCH v3 08/23] drm: exynos: " Shawn Guo
2017-02-07 10:47   ` Andrzej Hajda
2017-02-07  9:16 ` [PATCH v3 09/23] drm: fsl-dcu: " Shawn Guo
2017-02-08  5:01   ` Stefan Agner
2017-02-08 12:04     ` Daniel Vetter
2017-02-07  9:16 ` [PATCH v3 10/23] drm: hibmc: " Shawn Guo
2017-02-08 15:39   ` Sean Paul
2017-02-16  3:28   ` Xinliang Liu
2017-02-07  9:16 ` [PATCH v3 11/23] drm: kirin: " Shawn Guo
2017-02-16  3:23   ` Xinliang Liu
2017-02-21 16:20     ` Sean Paul
2017-02-07  9:16 ` [PATCH v3 12/23] drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs Shawn Guo
2017-02-07 10:10   ` Philipp Zabel
2017-02-07  9:16 ` [PATCH v3 13/23] drm: mediatek: use vblank hooks in struct drm_crtc_funcs Shawn Guo
2017-02-21 16:21   ` Sean Paul
2017-02-07  9:16 ` [PATCH v3 14/23] drm: meson: " Shawn Guo
2017-02-07 10:09   ` Neil Armstrong
2017-02-07  9:16 ` [PATCH v3 15/23] drm: qxl: " Shawn Guo
2017-02-21 16:21   ` Sean Paul
2017-02-07  9:16 ` [PATCH v3 16/23] drm: rcar-du: " Shawn Guo
2017-02-07 14:03   ` Laurent Pinchart
2017-02-07  9:16 ` [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs Shawn Guo
2017-02-07 15:35   ` Sean Paul
2017-02-07  9:16 ` [PATCH v3 18/23] drm: shmobile: use vblank hooks in struct drm_crtc_funcs Shawn Guo
2017-02-07 14:05   ` Laurent Pinchart
2017-02-07  9:16 ` [PATCH v3 19/23] drm: sun4i: " Shawn Guo
2017-02-07  9:28   ` Maxime Ripard
2017-02-07  9:16 ` [PATCH v3 20/23] drm: tegra: " Shawn Guo
2017-02-07 11:02   ` Thierry Reding
2017-02-07  9:16 ` [PATCH v3 21/23] drm: tilcdc: " Shawn Guo
2017-02-07  9:38   ` Jyri Sarha
2017-02-07  9:16 ` [PATCH v3 22/23] drm: vc4: " Shawn Guo
2017-02-08 19:56   ` Eric Anholt
2017-02-07  9:16 ` [PATCH v3 23/23] drm: zte: " Shawn Guo
2017-02-07 15:34   ` Sean Paul
2017-02-08 11:30 ` [PATCH v3 00/23] Add vblank hooks to " Tomi Valkeinen
2017-02-08 18:10   ` Laurent Pinchart
2017-02-08 18:24     ` Daniel Vetter
2017-02-08 15:49 ` Sean Paul
2017-02-09  8:36   ` Shawn Guo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.