All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Guo <shawnguo@kernel.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Marek Vasut <marex@denx.de>,
	Alexey Brodkin <abrodkin@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Xinliang Liu <z.liuxinliang@hisilicon.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Mali DP Maintainers <malidp@foss.arm.com>,
	Ben Skeggs <bskeggs@redhat.com>, Jyri Sarha <jsarha@ti.com>,
	dri-devel@lists.freedesktop.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: [PATCH v3 08/23] drm: exynos: use vblank hooks in struct drm_crtc_funcs
Date: Tue,  7 Feb 2017 17:16:20 +0800	[thread overview]
Message-ID: <1486458995-31018-9-git-send-email-shawnguo@kernel.org> (raw)
In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org>

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

  parent reply	other threads:[~2017-02-07  9:18 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Shawn Guo [this message]
2017-02-07 10:47   ` [PATCH v3 08/23] drm: exynos: " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486458995-31018-9-git-send-email-shawnguo@kernel.org \
    --to=shawnguo@kernel.org \
    --cc=abrodkin@synopsys.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux@armlinux.org.uk \
    --cc=liviu.dudau@arm.com \
    --cc=malidp@foss.arm.com \
    --cc=marex@denx.de \
    --cc=maxime.ripard@free-electrons.com \
    --cc=narmstrong@baylibre.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=z.liuxinliang@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.