From patchwork Thu Oct 9 05:43:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 5056511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96117C11AB for ; Thu, 9 Oct 2014 05:43:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 703A42015D for ; Thu, 9 Oct 2014 05:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F91E2012F for ; Thu, 9 Oct 2014 05:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750752AbaJIFnf (ORCPT ); Thu, 9 Oct 2014 01:43:35 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:11468 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbaJIFnd convert rfc822-to-8bit (ORCPT ); Thu, 9 Oct 2014 01:43:33 -0400 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Wed, 08 Oct 2014 22:44:03 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 08 Oct 2014 22:43:19 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 08 Oct 2014 22:43:19 -0700 Received: from HKMAIL102.nvidia.com (10.18.16.11) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.342.0; Wed, 8 Oct 2014 22:43:33 -0700 Received: from [10.19.57.128] (10.19.57.128) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 9 Oct 2014 05:43:29 +0000 Message-ID: <54362066.9000504@nvidia.com> Date: Thu, 9 Oct 2014 14:43:02 +0900 From: Alexandre Courbot Organization: NVIDIA User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Andrzej Hajda , Inki Dae , Joonyoung Shim , Thierry Reding CC: , Daniel Vetter , Seung-Woo Kim , , , Kyungmin Park , Kukjin Kim , Benjamin Gaignard , Russell King , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH] drm/exynos: fix vblank handling during dpms off References: <542B9A0E.7020206@samsung.com> <1412151287-12845-1-git-send-email-a.hajda@samsung.com> <542D13CC.5000304@samsung.com> <542D2E7C.1020904@samsung.com> <542D3C96.7000400@samsung.com> In-Reply-To: <542D3C96.7000400@samsung.com> X-NVConfidentiality: public X-Originating-IP: [10.19.57.128] X-ClientProxiedBy: DRBGMAIL104.nvidia.com (10.18.16.23) To HKMAIL102.nvidia.com (10.18.16.11) 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 On 10/02/2014 08:52 PM, Andrzej Hajda wrote: > Hi, > > +CC possible victims > > On 10/02/2014 12:52 PM, Inki Dae wrote: >> On 2014? 10? 02? 17:58, Joonyoung Shim wrote: >>> Hi Andrzej, >>> >>> On 10/01/2014 05:14 PM, Andrzej Hajda wrote: >>>> The patch disables vblanks during dpms off only if pagefilp has >>>> not been finished. It also replaces drm_vblank_off with drm_crtc_vblank_put. >>>> It fixes issue with page_flip ioctl not being able to acquire vblank counter. >>> This problem isn't related with pageflip, it just causes from >>> 7ffd7a68511c710b84db3548a1997fd2625f580a commit (drm: Always reject >>> drm_vblank_get() after drm_vblank_off()). >>> >>> We need to use drm_vblank_on() as a counterpart to drm_vblank_off() >>> after the commit . > > This patch should break also other drivers, it seems at least following > drms could be affected: > armada, sti, tegra. Indeed we (tegra) have just been hit by this. The problem seems to come from the fact that we have been using drm_vblank_pre_modeset, drm_vblank_post_modeset and drm_vblank_off conjointly. All these functions depend on the value of vblank->inmodeset, and 7ffd7a68511 increases the vblank reference counter only in drm_vblank_off, which can result in the acquired reference never being released. The following seems to fix this for Tegra, by stopping using drm_vblank_pre/post_modeset and relying on drm_vblank_off/on instead: Thierry, does this look ok to you? But there might be another issue, which is that calls to drm_vblank_get() will return -EINVAL if invoked between drm_blank_off and drm_blank_on. Is this really the desired behavior? Can it at least happen? If so, how are drivers supposed to react to this situation? --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b08df07cad47..3955d81236d0 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -739,7 +739,6 @@ static const struct drm_crtc_funcs tegra_crtc_funcs = { static void tegra_crtc_disable(struct drm_crtc *crtc) { - struct tegra_dc *dc = to_tegra_dc(crtc); struct drm_device *drm = crtc->dev; struct drm_plane *plane; @@ -755,7 +754,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) } } - drm_vblank_off(drm, dc->pipe); + drm_crtc_vblank_off(crtc); } static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, @@ -844,7 +843,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, u32 value; int err; - drm_vblank_pre_modeset(crtc->dev, dc->pipe); + drm_crtc_vblank_off(crtc); err = tegra_crtc_setup_clk(crtc, mode); if (err) { @@ -946,7 +945,7 @@ static void tegra_crtc_commit(struct drm_crtc *crtc) value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); - drm_vblank_post_modeset(crtc->dev, dc->pipe); + drm_crtc_vblank_on(crtc); } static void tegra_crtc_load_lut(struct drm_crtc *crtc)