Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp768269imm; Wed, 8 Aug 2018 05:33:30 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzM9lx3tKjJkrM/OpkC4dvCuo1uXye7oAxmvi/Jl/T+6/ppS4Xk7E8XH8jfjX3AXqGuU/cZ X-Received: by 2002:a17:902:143:: with SMTP id 61-v6mr2404226plb.171.1533731610101; Wed, 08 Aug 2018 05:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533731610; cv=none; d=google.com; s=arc-20160816; b=DwuspEvnzbh1CQayynSmN+p4WQHslxXl/mIaTBurDg9OEJtJdB1AZkjyktbfErLgFw lTFSKsqmnrGWB1A6TY17Sy4l4lMQa/ueQn7o1RBgj6AxV1pT6ckKHZLxfZRRhYRyuggQ ecG20N7dDzgiLz4bjgzVzYujYorvrRlO5XwNRZ+ZGBdkNHjRfnJ7Al8dGwuOVC5jcENR huUKoJIIJBahnDvazw/whTd/li74g6io0MIbKgnBHEZzDROnJF+GldEMD1R71CYpljQW NHE/3gHo0/aeDYlBxAvO0Z4sZEHNtbnUQTqgqHvCX2E02IBNY9UBjOPeHTaO/c8Qp7HT ZIcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=oe1/ra72lVF/uKvSoP7wPC5FYEjDHD4dgV/hHYcEUD0=; b=tmuscV0SkOXGxuzZfE8gX/j4frcATCLdvdK1qYJb5qDhCmLENu/7l7byYnR9gbyM8t Veae9uXK+hQaBe32GZRKwCj/OmDV9wU6nDGdld1a1KWBUiE3qA2XR1oRgvyVFlcPBlaC yzn+v8lIO8FN07fFlKzLlzZNyfkktSD0/lTBWzgjrMHpfukU+YENTfa0Pa7U5ImZFLZa rq8lLNEP3ne0k9v31Xz8exBdS0bYdvuOd3qpXjrcBQBR9vjcp1XktqoX+vJbmBcCcsbY OyhS6Sjoc/WAJNfG7TK3AS92zulEz3ZgqqnnlPLj41RcHhu0GOEWKdu42F38p8SUyWhK Qr5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=i8wA79DB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d127-v6si4563976pfa.189.2018.08.08.05.33.15; Wed, 08 Aug 2018 05:33:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=i8wA79DB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727204AbeHHOuU (ORCPT + 99 others); Wed, 8 Aug 2018 10:50:20 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:47256 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbeHHOuT (ORCPT ); Wed, 8 Aug 2018 10:50:19 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 38FDA5C0076; Wed, 8 Aug 2018 14:30:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1533731448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oe1/ra72lVF/uKvSoP7wPC5FYEjDHD4dgV/hHYcEUD0=; b=i8wA79DBII6MqnlY0n6/Afwz34h1qAxTdG+giUV4m/mBdp69ygTihT5cx8/PFcWhorYKtP ADro41lP+p+/ygOKSME0rB3AwAPIl19l1Li/RFqOrLBrqgpiaGW4C0TJ9ch7baOah2lF6Z 8KphhXx+X4e44m+X9EJTZPnOfnlq8Qs= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Wed, 08 Aug 2018 14:30:48 +0200 From: Stefan Agner To: Leonard Crestez Cc: "A.s. Dong" , marex@denx.de, linux-kernel@vger.kernel.org, dl-linux-imx , Robert Chiras , Marius-cristian Vlad , Fabio Estevam , p.zabel@pengutronix.de, dri-devel@lists.freedesktop.org, shawnguo@kernel.org, Anson Huang , kernel@pengutronix.de, Mirela Rabulea Subject: Re: [PATCH v3 4/4] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm In-Reply-To: <174c00104b40ebe1f6495e679e115948bb561889.camel@nxp.com> References: <174c00104b40ebe1f6495e679e115948bb561889.camel@nxp.com> Message-ID: <7a2ca85d38f0edc4033a426cca31b04b@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.08.2018 10:00, Leonard Crestez wrote: > On Tue, 2018-08-07 at 21:01 +0200, Stefan Agner wrote: >> On 06.08.2018 21:31, Leonard Crestez wrote: >> > The lcdif block is only powered on when display is active so plane >> > updates when not enabled are not valid. Writing to an unpowered IP block >> > is mostly ignored but can trigger bus errors on some chips. >> > >> > Prevent this situation by switching to drm_atomic_helper_commit_tail_rpm >> > and having the drm core ensure atomic_plane_update is only called while >> > the crtc is active. This avoids having to keep track of "enabled" bits >> > inside the mxsfb driver. >> > >> > This also requires handling the vblank event for disable from >> > ~~mxsfb_pipe_update~~ **mxsfb_pipe_disable**. >> >> Hm, I don't think this is a new requirement. Simple KMS Helper Reference >> clearly states that it should be called from update. >> >> Probably using drm_atomic_helper_commit_tail_rpm just exacerbates an >> issue which we haven't seen before... >> >> Since I think it is a general fix, I'd rather prefer have it in a >> separate commit. > > I wrote the commit message wrong, what I meant is that it requires > handling the vblank event from *disable*. > > Switching to atomic_helper_commit_tail_rpm means atomic_update is no > longer called when !state->active so nobody dispatches the last vblank > event for disabling the crtc. This causes a warning in > drm_atomic_helper_commit_hw_done on disable. Hm, I see, atomic_helper_commit_tail_rpm() uses DRM_PLANE_COMMIT_ACTIVE_ONLY, which leads to update() not being called for Simple KMS (since simple KMS uses the plane atomic_update() hook). I was looking in other drivers such as drivers/gpu/drm/pl111/pl111_display.c and was wondering why they do not need that in disable. But it makes sense since they do not use atomic_helper_commit_tail_rpm(), update does get called. Also note that pl111_display_update() uses drm_crtc_send_vblank_event() too if the crtc gets disabled: if (crtc->state->active && drm_crtc_vblank_get(crtc) == 0) drm_crtc_arm_vblank_event(crtc, event); else drm_crtc_send_vblank_event(crtc, event); The other users of atomic_helper_commit_tail_rpm(), exynos and sun4i, call drm_crtc_send_vblank_event() in the CRTC atomic_disable() hook. The Simple KMS equivalent of that is the disable hook. So it is really the change to _rpm() which requires to add drm_crtc_send_vblank_event() in disable. Having this two changes in a single commit indeed makes sense and is correct, sorry about the noise! Just fix the commit, and than I am fine with this. Reviewed-by: Stefan Agner -- Stefan > > Looking through the docs there seems to be a lot of complexity behind > vblank events so maybe I'm missing something.