Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5067453imm; Tue, 7 Aug 2018 12:03:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe6osWQyQzfeMJ35mOuOv6TuA4LYcfmtGZU5XfJkkGDNezxp2A6AFAv2hOvu8jLznanAC22 X-Received: by 2002:a63:f657:: with SMTP id u23-v6mr19906533pgj.258.1533668623914; Tue, 07 Aug 2018 12:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533668623; cv=none; d=google.com; s=arc-20160816; b=MfutJYrrotUmiJ0xx0y/qt/pL20tVWhRorxGsTl5J6JovbcLs6DdYnkSSj7O8AGXnf sIA6osOoF1CCa0hlzXGidZ1PRQYatvIxxUXS59aWVTth0qLFlEH5JNlGRfkZdeB9BYXo AOYry3z5gCw+FUCyji4w3+iAdNIMdkWS55giYM7xdx108i6s34zBr9t8HNAt7txt4Epx DhNb9ecbNcKLi0Cm5YMdp9I5P5/Nk5CHGtbFL1DhE4XsCcBZy8YwW4z5+yCaQ4nb+tNu 2akdOzYGkIYgsirULcm0GdicgeXuYAytFzCRndXYt2/8KNRuj36rvUrkcKEZEzeaugjK KumQ== 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=Gian+ODqz/9V5I1yF8So0gFFLgyxycvvhkEjfrY8QDM=; b=BLO08M5jj+HJFljsqu8SpCFYv3WGdBGXzF7WeYnLdT1Fii/wu0bLISyhj2Jlg/2rvY ban3e32unw6WQ+mCPNTp7USrhTti//7F4JELGRInF57bGFJ3rcTjx3jyvvLNExyeUa2v fOW98Hl+E97Jqj3AXbTwTSEsv4YPQhvM+/7FBtTGA0P7flQ/Hp+6pnQD6yx7SJ0W5Csl nXQb2LPGhHPIxSJqzhiimcZZapq6i3qwNMTfU/hHMjb+QfrkZrrG1k5TnbS2wmZvfPZb NerIqQfrYu/8H6BZFDpdA/sWuzO0TxUmG1sVZiAn6v28d/pxsu5ocFhedhPy7ZAm8NkI eRLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=FPf0uRXl; 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 h5-v6si2061214pfd.112.2018.08.07.12.03.28; Tue, 07 Aug 2018 12:03:43 -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=FPf0uRXl; 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 S2390463AbeHGVRs (ORCPT + 99 others); Tue, 7 Aug 2018 17:17:48 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:40740 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390044AbeHGVRr (ORCPT ); Tue, 7 Aug 2018 17:17:47 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 82B4F5C0187; Tue, 7 Aug 2018 21:01:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1533668519; 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=Gian+ODqz/9V5I1yF8So0gFFLgyxycvvhkEjfrY8QDM=; b=FPf0uRXl9UEtQjxuzGzQqHzWj8Jjw/idBVavEyIeSlMH/6Kj1Ls82GSx70x4RBopuDHfuX ofsTw3pqQCVhx+61fjKElxalEbbocNF3c2sFjo6AfD6/wkEVsLQH/eM+OxoJ39FAoGwCZo iZAgbFfLfM2bEVxhn1l65RwcY0dkeGI= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Tue, 07 Aug 2018 21:01:59 +0200 From: Stefan Agner To: Leonard Crestez Cc: Philipp Zabel , Marek Vasut , Shawn Guo , Fabio Estevam , Robert Chiras , Mirela Rabulea , Anson Huang , dri-devel@lists.freedesktop.org, Dong Aisheng , linux-imx@nxp.com, kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm In-Reply-To: References: Message-ID: 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 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. Hm, I don't think this is a new requirement. Simple KMS Helper Reference clearly states that it should be called from update: https://www.kernel.org/doc/html/v4.17/gpu/drm-kms-helpers.html#simple-kms-helper-reference 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. > > Signed-off-by: Leonard Crestez > Suggested-by: Stefan Agner > --- > drivers/gpu/drm/mxsfb/mxsfb_drv.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c > b/drivers/gpu/drm/mxsfb/mxsfb_drv.c > index d797dfd40d98..5777e730085b 100644 > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c > @@ -96,10 +96,14 @@ static const struct drm_mode_config_funcs > mxsfb_mode_config_funcs = { > .fb_create = drm_gem_fb_create, > .atomic_check = drm_atomic_helper_check, > .atomic_commit = drm_atomic_helper_commit, > }; > > +static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = { > + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, > +}; > + > static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, > struct drm_crtc_state *crtc_state, > struct drm_plane_state *plane_state) > { > struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); > @@ -113,15 +117,25 @@ static void mxsfb_pipe_enable(struct > drm_simple_display_pipe *pipe, > > static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe) > { Shouldn't that be in mxsfb_pipe_update? -- Stefan > struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe); > struct drm_device *drm = pipe->plane.dev; > + struct drm_crtc *crtc = &pipe->crtc; > + struct drm_pending_vblank_event *event; > > drm_panel_disable(mxsfb->panel); > mxsfb_crtc_disable(mxsfb); > drm_panel_unprepare(mxsfb->panel); > pm_runtime_put_sync(drm->dev); > + > + spin_lock_irq(&drm->event_lock); > + event = crtc->state->event; > + if (event) { > + crtc->state->event = NULL; > + drm_crtc_send_vblank_event(crtc, event); > + } > + spin_unlock_irq(&drm->event_lock); > } > > static void mxsfb_pipe_update(struct drm_simple_display_pipe *pipe, > struct drm_plane_state *plane_state) > { > @@ -232,10 +246,11 @@ static int mxsfb_load(struct drm_device *drm, > unsigned long flags) > drm->mode_config.min_width = MXSFB_MIN_XRES; > drm->mode_config.min_height = MXSFB_MIN_YRES; > drm->mode_config.max_width = MXSFB_MAX_XRES; > drm->mode_config.max_height = MXSFB_MAX_YRES; > drm->mode_config.funcs = &mxsfb_mode_config_funcs; > + drm->mode_config.helper_private = &mxsfb_mode_config_helpers; > > drm_mode_config_reset(drm); > > pm_runtime_get_sync(drm->dev); > ret = drm_irq_install(drm, platform_get_irq(pdev, 0));