From patchwork Wed May 18 20:29:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9122071 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 958669F37F for ; Wed, 18 May 2016 20:30:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B91072034F for ; Wed, 18 May 2016 20:30:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C1D3F202AE for ; Wed, 18 May 2016 20:30:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A26BB6E0EF; Wed, 18 May 2016 20:30:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66A866E0EF for ; Wed, 18 May 2016 20:30:04 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id r12so15806829wme.0 for ; Wed, 18 May 2016 13:30:04 -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=xQgwcQeAIxDcMECi1Ck/7horKBRa2PbyjbzNl1niF1U=; b=NrJPRf9tarj+ajBU9nXxaEw5gkYzQdkX8XvBm6xiB6zrV95alIws0Yc/W47gaS+JOF xC+HerVtgygCCR8XCmK8dHvK43qSsce5nF4qjrCv81APheswEF5JK7mzxFlbU7Ui5bAp Lx4fe+C04aA7VcXHZp3Eyqtz8N7cTZVB+IDKU= 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=xQgwcQeAIxDcMECi1Ck/7horKBRa2PbyjbzNl1niF1U=; b=M6G+ohrHCKJ/lauB5Vq3Nb7QcCcf65IXWJD7O23tUep23xBR89y1+c1CRJARCxGj7L Qr4TA6UAsqBLPdADiwBehw9athYNX9n9lJtQpWvq8/mq1IwUCed50R1Qw/qf3xE6Z+dp irGgSDyDAbZORpUmNrZckZbX/41VXJtpTAQvga45q0LOX/yvwKqrvE4GTDLuT5PIh7XZ uPoyTZlyHyuhnYE3Qd/7Bd2tHQ9ykbrp7RPTC+ymKxxHh1woSXnMqSJ3PCXPyvmQaZna /6T04NUAK6QQWJP86nqw7mRlf6YvLwFqLWys8utMUw9DWUPwDW1gbE8fPod6ZfCDFZPw uW9g== X-Gm-Message-State: AOPr4FULII1aboW2wBoZEUBLYjzUs/qR2xLqA/G2pmajrD4Rz/A2H1yH06OsJZ02QOKicQ== X-Received: by 10.28.72.132 with SMTP id v126mr9792015wma.49.1463603401706; Wed, 18 May 2016 13:30:01 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id jd4sm10472232wjb.43.2016.05.18.13.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 May 2016 13:30:00 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm: Nuke ->vblank_disable_allowed Date: Wed, 18 May 2016 22:29:57 +0200 Message-Id: <1463603397-23551-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1463600858-22218-1-git-send-email-daniel.vetter@ffwll.ch> References: <1463600858-22218-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Laurent Pinchart , Tomi Valkeinen , Daniel Vetter , Intel Graphics Development , Liviu Dudau , Daniel Vetter , Alex Deucher , Russell King 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=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=no 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 This was added in commit 0a3e67a4caac273a3bfc4ced3da364830b1ab241 Author: Jesse Barnes Date: Tue Sep 30 12:14:26 2008 -0700 drm: Rework vblank-wait handling to allow interrupt reduction. to stay backwards-compatible with old UMS code that didn't even tell the kernel when it did a modeset, so that the kernel could save/restore vblank counters. At worst this means vblanks will be somewhat funky on a setup that very likely no one still runs. So let's just nuke it. Plan B would be to set it unconditionally in drm_vblank_init for kms drivers, instead of in each driver separately. So if this patch breaks anything please only restore the hunks in drmP.h and drm_irq.c, plus add a check for DRIVER_MODESET in drm_vblank_init. Stumbled over this in a discussion on irc with Chris. v2: Remove leftover debug gunk from psr hacking (Alex). Cc: Chris Wilson Cc: Alex Deucher Cc: Liviu Dudau Cc: Russell King Cc: Thierry Reding Cc: Eric Anholt Cc: Laurent Pinchart Cc: Inki Dae Cc: Tomi Valkeinen Cc: Mark Yao Cc: Sascha Hauer Cc: Philipp Zabel Signed-off-by: Daniel Vetter Reviewed-by: Alex Deucher Acked-by: Liviu Dudau Acked-by: Laurent Pinchart Tested-by: Laurent Pinchart --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 1 - drivers/gpu/drm/arm/hdlcd_drv.c | 1 - drivers/gpu/drm/armada/armada_drv.c | 1 - drivers/gpu/drm/drm_irq.c | 6 ------ drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 ------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 1 - drivers/gpu/drm/gma500/psb_drv.c | 1 - drivers/gpu/drm/i915/i915_dma.c | 3 --- drivers/gpu/drm/imx/imx-drm-core.c | 7 ------- drivers/gpu/drm/radeon/radeon_irq_kms.c | 1 - drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 ------- drivers/gpu/drm/tegra/drm.c | 1 - drivers/gpu/drm/vc4/vc4_kms.c | 2 -- include/drm/drmP.h | 8 -------- 14 files changed, 47 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 9266c7b69808..835a3fa8d8df 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -219,7 +219,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev) if (r) { return r; } - adev->ddev->vblank_disable_allowed = true; /* enable msi */ adev->irq.msi_enabled = false; diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 2112f0b105e3..4f909378d581 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -379,7 +379,6 @@ static int hdlcd_drm_bind(struct device *dev) DRM_ERROR("failed to initialise vblank\n"); goto err_vblank; } - drm->vblank_disable_allowed = true; drm_mode_config_reset(drm); drm_kms_helper_poll_init(drm); diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 531fcb946346..cb21c0b6374a 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -113,7 +113,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) goto err_comp; dev->irq_enabled = true; - dev->vblank_disable_allowed = 1; ret = armada_fbdev_init(dev); if (ret) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index d1b5fc20b2f8..1a0ae89087e8 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -348,9 +348,6 @@ static void vblank_disable_fn(unsigned long arg) unsigned int pipe = vblank->pipe; unsigned long irqflags; - if (!dev->vblank_disable_allowed) - return; - spin_lock_irqsave(&dev->vbl_lock, irqflags); if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) { DRM_DEBUG("disabling vblank on crtc %u\n", pipe); @@ -437,8 +434,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs) "get_vblank_timestamp == NULL\n"); } - dev->vblank_disable_allowed = false; - return 0; err: @@ -1555,7 +1550,6 @@ static void drm_legacy_vblank_post_modeset(struct drm_device *dev, if (vblank->inmodeset) { spin_lock_irqsave(&dev->vbl_lock, irqflags); - dev->vblank_disable_allowed = true; drm_reset_vblank_timestamp(dev, pipe); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 21c719e8e02b..2dd820e23b0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -212,13 +212,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) */ dev->irq_enabled = true; - /* - * with vblank_disable_allowed = true, vblank interrupt will be disabled - * by drm timer once a current process gives up ownership of - * vblank event.(after drm_vblank_put function is called) - */ - dev->vblank_disable_allowed = true; - /* init kms poll for handling hpd */ drm_kms_helper_poll_init(dev); diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 2e58dfd74ae1..33727d5d826a 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -80,7 +80,6 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) dev_err(dev->dev, "failed to initialize vblank\n"); goto done; } - dev->vblank_disable_allowed = true; ret = fsl_dcu_drm_irq_init(dev); if (ret < 0) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 4e1c6850520e..82b8ce418b27 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -374,7 +374,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) drm_irq_install(dev, dev->pdev->irq); - dev->vblank_disable_allowed = true; dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ dev->driver->get_vblank_counter = psb_get_vblank_counter; diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index a8c79f6512a4..fd06bff216ff 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -515,9 +515,6 @@ static int i915_load_modeset_init(struct drm_device *dev) intel_modeset_gem_init(dev); - /* Always safe in the mode setting case. */ - /* FIXME: do pre/post-mode set stuff in core KMS code */ - dev->vblank_disable_allowed = true; if (INTEL_INFO(dev)->num_pipes == 0) return 0; diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 2453fb1c68a7..1080019e7b17 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -252,13 +252,6 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) if (ret) goto err_kms; - /* - * with vblank_disable_allowed = true, vblank interrupt will be - * disabled by drm timer once a current process gives up ownership - * of vblank event. (after drm_vblank_put function is called) - */ - drm->vblank_disable_allowed = true; - platform_set_drvdata(drm->platformdev, drm); /* Now try and bind all our sub-components */ diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 1e9304d1c88f..c084cadcbf21 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c @@ -291,7 +291,6 @@ int radeon_irq_kms_init(struct radeon_device *rdev) if (r) { return r; } - rdev->ddev->vblank_disable_allowed = true; /* enable msi */ rdev->msi_enabled = 0; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index ced1e5f93cda..09a4d429c0f0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -217,13 +217,6 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags) if (ret) goto err_kms_helper_poll_fini; - /* - * with vblank_disable_allowed = true, vblank interrupt will be disabled - * by drm timer once a current process gives up ownership of - * vblank event.(after drm_vblank_put function is called) - */ - drm_dev->vblank_disable_allowed = true; - drm_mode_config_reset(drm_dev); ret = rockchip_drm_fbdev_init(drm_dev); diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 679905544181..b59c3bf0df44 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -180,7 +180,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags) /* syncpoints are used for full 32-bit hardware VBLANK counters */ drm->max_vblank_count = 0xffffffff; - drm->vblank_disable_allowed = true; err = drm_vblank_init(drm, drm->mode_config.num_crtc); if (err < 0) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index d423ba10239a..cb37751bc99f 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -207,8 +207,6 @@ int vc4_kms_load(struct drm_device *dev) dev->mode_config.preferred_depth = 24; dev->mode_config.async_page_flip = true; - dev->vblank_disable_allowed = true; - drm_mode_config_reset(dev); vc4->fbdev = drm_fbdev_cma_init(dev, 32, diff --git a/include/drm/drmP.h b/include/drm/drmP.h index f0d1450d4ea5..30dc7d8c403f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -819,14 +819,6 @@ struct drm_device { int irq; /* - * At load time, disabling the vblank interrupt won't be allowed since - * old clients may not call the modeset ioctl and therefore misbehave. - * Once the modeset ioctl *has* been called though, we can safely - * disable them when unused. - */ - bool vblank_disable_allowed; - - /* * If true, vblank interrupt will be disabled immediately when the * refcount drops to zero, as opposed to via the vblank disable * timer.