From patchwork Tue Dec 16 16:53:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 5502231 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 80EB19F444 for ; Tue, 16 Dec 2014 16:54:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81FBA20A2A for ; Tue, 16 Dec 2014 16:54:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64B2320A1E for ; Tue, 16 Dec 2014 16:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbaLPQyV (ORCPT ); Tue, 16 Dec 2014 11:54:21 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:58379 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbaLPQyT (ORCPT ); Tue, 16 Dec 2014 11:54:19 -0500 Received: by mail-pa0-f54.google.com with SMTP id fb1so14507588pad.27 for ; Tue, 16 Dec 2014 08:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BP2xrTUpFtm8P059VfbmkjTiJ4TyojlT5hisHv7wrD8=; b=wDRM3j3+m+Z86mbvx1Xkccv3v0RFYdAJfojz+/Lj5GNuXdNY9zWTcS1mD2nIfOXlu6 iUtXdRMmxcwDV1tFzcHZiG+sSakLpniGLXIdRBxjDN7YBVEUTVbIETG9ahk7+Dh1+eTr /Q4o/dOUlao2Z4ftFF2NDKO4iEC4R/UD+ucwbZIb7spTLRMaMcHjGbxsjM0hWD6fMnRq Aa1q9Fi0F5atCBKelm8f10HFEQemsOo20UU95l+HyI2aJE2UkY/Q7xhOU6610w6yR/nl N4ev4x/W8JcdVRAnAOycM/ZE0rfKzJXMcN/Gz1HsraTXygeGtrCW0rQLVShgFw3aBf+p EeYA== X-Received: by 10.66.122.100 with SMTP id lr4mr61899453pab.56.1418748859061; Tue, 16 Dec 2014 08:54:19 -0800 (PST) Received: from localhost ([216.228.120.20]) by mx.google.com with ESMTPSA id tm3sm1515782pac.12.2014.12.16.08.54.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2014 08:54:18 -0800 (PST) From: Thierry Reding To: dri-devel@lists.freedesktop.org Cc: Daniel Vetter , Inki Dae , Philipp Zabel , Gerd Hoffmann , Mark Yao , Benjamin Gaignard , linux-samsung-soc@vger.kernel.org Subject: [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time() Date: Tue, 16 Dec 2014 17:53:32 +0100 Message-Id: <1418748815-15434-10-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418748815-15434-1-git-send-email-thierry.reding@gmail.com> References: <1418748815-15434-1-git-send-email-thierry.reding@gmail.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 From: Thierry Reding This function is the KMS native variant of drm_vblank_count_and_time(). It takes a struct drm_crtc * instead of a struct drm_device * and an index of the CRTC. Eventually the goal is to access vblank data through the CRTC only so that the per-CRTC data can be moved to struct drm_crtc. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 9c32a1d7aec2..b34900a8e172 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -877,6 +877,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count); * vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. + * + * This is the legacy version of drm_crtc_vblank_count_and_time(). */ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, struct timeval *vblanktime) @@ -902,6 +904,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, } EXPORT_SYMBOL(drm_vblank_count_and_time); +/** + * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value + * and the system timestamp corresponding to that vblank counter value + * @crtc: which counter to retrieve + * @vblanktime: Pointer to struct timeval to receive the vblank timestamp. + * + * Fetches the "cooked" vblank count value that represents the number of + * vblank events since the system was booted, including lost events due to + * modesetting activity. Returns corresponding system timestamp of the time + * of the vblank interval that corresponds to the current vblank counter value. + * + * This is the native KMS version of drm_vblank_count_and_time(). + */ +u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, + struct timeval *vblanktime) +{ + return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc), + vblanktime); +} +EXPORT_SYMBOL(drm_crtc_vblank_count_and_time); + static void send_vblank_event(struct drm_device *dev, struct drm_pending_vblank_event *e, unsigned long seq, struct timeval *now) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index de3d3f7091fb..7baef1dff5f3 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1072,6 +1072,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe); extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc); extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, struct timeval *vblanktime); +extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, + struct timeval *vblanktime); extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe, struct drm_pending_vblank_event *e); extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,