From patchwork Mon Jan 20 12:20:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11341959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A952B159A for ; Mon, 20 Jan 2020 12:22:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 903B62073D for ; Mon, 20 Jan 2020 12:22:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 903B62073D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itW3H-0001BA-Nq; Mon, 20 Jan 2020 12:21:07 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itW3F-0001Aw-Q8 for xen-devel@lists.xenproject.org; Mon, 20 Jan 2020 12:21:05 +0000 X-Inumbo-ID: 4effbb73-3b7f-11ea-b95e-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4effbb73-3b7f-11ea-b95e-12813bfff9fa; Mon, 20 Jan 2020 12:20:56 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BEAB6AD46; Mon, 20 Jan 2020 12:20:54 +0000 (UTC) From: Thomas Zimmermann To: airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, hdegoede@redhat.com, david@lechnology.com, noralf@tronnes.org, sean@poorly.run, oleksandr_andrushchenko@epam.com, sam@ravnborg.org, laurent.pinchart@ideasonboard.com, emil.velikov@collabora.com Date: Mon, 20 Jan 2020 13:20:48 +0100 Message-Id: <20200120122051.25178-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200120122051.25178-1-tzimmermann@suse.de> References: <20200120122051.25178-1-tzimmermann@suse.de> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 1/4] drm: Add drm_crtc_has_vblank() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org, Thomas Zimmermann , dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The new interface drm_crtc_has_vblank() return true if vblanking has been initialized for a certain CRTC, or false otherwise. This function will be useful for initializing CRTC state. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/drm_vblank.c | 21 +++++++++++++++++++++ include/drm/drm_vblank.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 1659b13b178c..c20102899411 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -501,6 +501,27 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs) } EXPORT_SYMBOL(drm_vblank_init); +/** + * drm_crtc_has_vblank - test if vblanking has been initialized for + * a CRTC + * @crtc: the CRTC + * + * Drivers may call this function to test if vblank support is + * initialized for a CRTC. For most hardware this means that vblanking + * can also be enabled on the CRTC. + * + * Returns: + * True if vblanking has been initialized for the given CRTC, false + * otherwise. + */ +bool drm_crtc_has_vblank(const struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + + return crtc->index < dev->num_crtcs; +} +EXPORT_SYMBOL(drm_crtc_has_vblank); + /** * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC * @crtc: which CRTC's vblank waitqueue to retrieve diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h index c16c44052b3d..531a6bc12b7e 100644 --- a/include/drm/drm_vblank.h +++ b/include/drm/drm_vblank.h @@ -206,6 +206,7 @@ struct drm_vblank_crtc { }; int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs); +bool drm_crtc_has_vblank(const struct drm_crtc *crtc); u64 drm_crtc_vblank_count(struct drm_crtc *crtc); u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, ktime_t *vblanktime);