From patchwork Wed May 27 09:04:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6488201 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3F1DEC0433 for ; Wed, 27 May 2015 09:02:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B78D2069D for ; Wed, 27 May 2015 09:02:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C301B206D9 for ; Wed, 27 May 2015 09:02:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F49A72111; Wed, 27 May 2015 02:02:14 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by gabe.freedesktop.org (Postfix) with ESMTP id B78E26E3C9 for ; Wed, 27 May 2015 02:02:11 -0700 (PDT) Received: by wgme6 with SMTP id e6so3462336wgm.2 for ; Wed, 27 May 2015 02:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=quO7Vwr2FXZXXbVpwgVc8t7tBkzSSgJUUX+OEnMkyOs=; b=g9s8wdLmR7MQTZMTTJzjwF4f+98Ru+ILF9gMGImWexDFdp3iaOsJChRkoQkWxeZ9Mw LvF+ZbS9j027XkbaDNbafddfJmIk3IMcCsMGqxXbuaHiCiL2uvHG4h+tipnC6N30L2q3 qrvP3zt/gSYO8dyZDBi23CLeVjix6cQ6hbsmo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=quO7Vwr2FXZXXbVpwgVc8t7tBkzSSgJUUX+OEnMkyOs=; b=aW1m9Gl5/Qr2/B2K/QFTe8+Me3K49unJRpwCUhqTJLhwxh+ARf+Vmx3Of2z9bqYUIc CzhyU0dOkAdL+smrQ0rdYHWLUs3j205nTIKbCOPKaj4NUFuYj/Vb4b3XJCtVP5tUaYe7 wCinvLRInIfbwkG2SbVzGI1IOiVHCrsJsYtfaROOM5N9HVehleSoXHR21R5WBngkBxY+ kRi3mUFaU/k2NMnAnJbw2sAHOizvmXXLz65iRmY8kLUcyQaGEpSPyui1p1bI3NvvFgz3 AoQHhW2/Yd95Mg8BmoKeV7d01kAneeyoDl0wSlHBhGE1KMEi7wuAWyyI/kMDzDa9s3vd 9Wsw== X-Gm-Message-State: ALoCoQn/75zzxjkx8oT6KOllEIQsDGqYQ8OBrpMp7Hn/QiUanA0gSE6iR/qr47hhSiwCFI0aQGBq X-Received: by 10.181.29.100 with SMTP id jv4mr3885465wid.4.1432717331105; Wed, 27 May 2015 02:02:11 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by mx.google.com with ESMTPSA id ck16sm25782290wjb.37.2015.05.27.02.02.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 May 2015 02:02:10 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 3/3] drm/irq: Make drm_vblank_pre/post_modeset internal Date: Wed, 27 May 2015 11:04:31 +0200 Message-Id: <1432717471-7879-3-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432717471-7879-1-git-send-email-daniel.vetter@ffwll.ch> References: <1432717471-7879-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter 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" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Now that all drivers are switched over to drm_vblank_on/off we can relegate pre/post_modeset to the purely drm_irq.c internal role of supporting on userspace. As usual switch to the drm_legacy_ prefix to make it clear this is for old drivers only. Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 2 -- drivers/gpu/drm/drm_irq.c | 41 ++++------------------------------------- include/drm/drmP.h | 4 ---- 3 files changed, 4 insertions(+), 43 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index b6fc354a20e7..5eef6323dbb3 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -3803,8 +3803,6 @@ int num_ioctls; drm_helper_connector_dpms() in reaction to fbdev blanking events. Do drivers that don't implement (or just don't use) fbcon compatibility need to call those functions themselves? -- KMS drivers must call drm_vblank_pre_modeset() and drm_vblank_post_modeset() - around mode setting. Should this be done in the DRM core? - vblank_disable_allowed is set to 1 in the first drm_vblank_post_modeset() call and never set back to 0. It seems to be safe to permanently set it to 1 in drm_vblank_init() for KMS driver, and it might be safe for UMS drivers as diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 1967e7fc9805..038c8b3256da 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1359,30 +1359,7 @@ void drm_crtc_vblank_on(struct drm_crtc *crtc) } EXPORT_SYMBOL(drm_crtc_vblank_on); -/** - * drm_vblank_pre_modeset - account for vblanks across mode sets - * @dev: DRM device - * @crtc: CRTC in question - * - * Account for vblank events across mode setting events, which will likely - * reset the hardware frame counter. - * - * This is done by grabbing a temporary vblank reference to ensure that the - * vblank interrupt keeps running across the modeset sequence. With this the - * software-side vblank frame counting will ensure that there are no jumps or - * discontinuities. - * - * Unfortunately this approach is racy and also doesn't work when the vblank - * interrupt stops running, e.g. across system suspend resume. It is therefore - * highly recommended that drivers use the newer drm_vblank_off() and - * drm_vblank_on() instead. drm_vblank_pre_modeset() only works correctly when - * using "cooked" software vblank frame counters and not relying on any hardware - * counters. - * - * Drivers must call drm_vblank_post_modeset() when re-enabling the same crtc - * again. - */ -void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) +static void drm_legacy_vblank_pre_modeset(struct drm_device *dev, int crtc) { struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; @@ -1406,17 +1383,8 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) vblank->inmodeset |= 0x2; } } -EXPORT_SYMBOL(drm_vblank_pre_modeset); -/** - * drm_vblank_post_modeset - undo drm_vblank_pre_modeset changes - * @dev: DRM device - * @crtc: CRTC in question - * - * This function again drops the temporary vblank reference acquired in - * drm_vblank_pre_modeset. - */ -void drm_vblank_post_modeset(struct drm_device *dev, int crtc) +static void drm_legacy_vblank_post_modeset(struct drm_device *dev, int crtc) { struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; unsigned long irqflags; @@ -1436,7 +1404,6 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc) vblank->inmodeset = 0; } } -EXPORT_SYMBOL(drm_vblank_post_modeset); /* * drm_modeset_ctl - handle vblank event counter changes across mode switch @@ -1469,10 +1436,10 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, switch (modeset->cmd) { case _DRM_PRE_MODESET: - drm_vblank_pre_modeset(dev, crtc); + drm_legacy_vblank_pre_modeset(dev, crtc); break; case _DRM_POST_MODESET: - drm_vblank_post_modeset(dev, crtc); + drm_legacy_vblank_post_modeset(dev, crtc); break; default: return -EINVAL; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index df6d9970d9a4..bf22298559d1 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -962,10 +962,6 @@ static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; } -/* Modesetting support */ -extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); -extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); - /* Stub support (drm_stub.h) */ extern struct drm_master *drm_master_get(struct drm_master *master); extern void drm_master_put(struct drm_master **master);