From patchwork Tue Feb 7 09:16:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 93548 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2107667qgi; Tue, 7 Feb 2017 01:21:51 -0800 (PST) X-Received: by 10.99.159.2 with SMTP id g2mr19006470pge.178.1486459311766; Tue, 07 Feb 2017 01:21:51 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d30si3490331plj.218.2017.02.07.01.21.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 01:21:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6FAD6E62F; Tue, 7 Feb 2017 09:21:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id C027F6E62F for ; Tue, 7 Feb 2017 09:21:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B63CF20142; Tue, 7 Feb 2017 09:21:18 +0000 (UTC) Received: from localhost.localdomain (li411-102.members.linode.com [106.187.91.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 155DE20303; Tue, 7 Feb 2017 09:21:08 +0000 (UTC) From: Shawn Guo To: Daniel Vetter Subject: [PATCH v3 20/23] drm: tegra: use vblank hooks in struct drm_crtc_funcs Date: Tue, 7 Feb 2017 17:16:32 +0800 Message-Id: <1486458995-31018-21-git-send-email-shawnguo@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> References: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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@lists.freedesktop.org, Maxime Ripard X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Shawn Guo 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 Cc: Thierry Reding Acked-by: Thierry Reding --- 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,