Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3702727pxt; Tue, 10 Aug 2021 09:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4xmvZHl9vhiylINn0qWLWVKx9W4ZckxHDoKp5Ep32bvPYWd2JaEXUeTM4Fw8Iqb1jba4w X-Received: by 2002:a5d:9304:: with SMTP id l4mr175950ion.167.1628612625219; Tue, 10 Aug 2021 09:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628612625; cv=none; d=google.com; s=arc-20160816; b=RN4Ma4OIWyVnIuxYIPP/WErgIiYPX6yuDG0wowFSF2D4iRZRgVghO/VrB4hw3oIYDi zDcxC1LgeFqrhzuJonTlnML6Iug0GykwT0at9NHHGd7kePC8SaZaMzsJXgToJz6ahKNS PoBokKJNEZ0lrVh3leyYm9ABZobcZ3eB8IiZsTDXrY+Sf1ZwzLPgRizcN2+wX4xfQxq4 2kxiQ1pIU+lYnBbBBidRqZ6r7Y9HWhHRl/Ft+4dm7S2A9viiqLLlbgmDQsljD2K9ucQU JQ/fWvbU0Sfq9oA+s775f0k+c2gBU6/LDQJxR2who8gjBKx64M8m+3F7TLU2bP2CZ3ZL HlzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date; bh=XctCRRGpluSkL4q+RXEAzeDwNcT7ts7WjzkNwBE7PBA=; b=cbZwBzO/8MrX3RaGW5xTndqDmFVQdP8jRvm34GM1SMYShucSzqKq5Rq/Fe+ExcLxbM oC7b4U7Y95LvoBpcyKIOIaKa9ij/a6GaTjqm5Ns1TqQ1mwSHGx3mudisy5F98hs8Sqm0 9uga6RtUjxQmVAWp3nh1w1v/dAVEVgPHG9oHZ5n4ebgSZu/gq48H2fWk0Mp0wGrzF04M MpgJRSzlt9IKVt9BPHCtRcMMUYlR9cexindEx0iGtojXJw2ro+jasnvg/5OSohx8clvE DPD3BPH88AyLbMAYJsj5FxY3bpyUugNmU6i+aIqV6FoxqsMXgj61yK3+jauAxsRfFflj VujA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si1199930iow.33.2021.08.10.09.23.34; Tue, 10 Aug 2021 09:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236476AbhHJKqg convert rfc822-to-8bit (ORCPT + 99 others); Tue, 10 Aug 2021 06:46:36 -0400 Received: from aposti.net ([89.234.176.197]:47546 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236505AbhHJKqf (ORCPT ); Tue, 10 Aug 2021 06:46:35 -0400 Date: Tue, 10 Aug 2021 12:46:05 +0200 From: Paul Cercueil Subject: Re: [PATCH 3/8] drm/ingenic: Use standard drm_atomic_helper_commit_tail To: Daniel Vetter Cc: David Airlie , "H . Nikolaus Schaller" , Paul Boddie , list@opendingux.net, Sam Ravnborg , linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: References: <20210808134526.119198-1-paul@crapouillou.net> <20210808134526.119198-4-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, Le mar., ao?t 10 2021 at 12:20:38 +0200, Daniel Vetter a ?crit : > On Sun, Aug 08, 2021 at 03:45:21PM +0200, Paul Cercueil wrote: >> By making the CRTC's .vblank_enable() function return an error when >> it >> is known that the hardware won't deliver a VBLANK, we can drop the >> ingenic_drm_atomic_helper_commit_tail() function and use the >> standard >> drm_atomic_helper_commit_tail() function instead. >> >> Signed-off-by: Paul Cercueil >> --- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 28 >> ++++------------------- >> 1 file changed, 4 insertions(+), 24 deletions(-) >> >> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> index bc71ba44ccf4..3ed7c27a8dde 100644 >> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> @@ -706,29 +706,6 @@ static int >> ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder, >> } >> } >> >> -static void ingenic_drm_atomic_helper_commit_tail(struct >> drm_atomic_state *old_state) >> -{ >> - /* >> - * Just your regular drm_atomic_helper_commit_tail(), but only >> calls >> - * drm_atomic_helper_wait_for_vblanks() if priv->no_vblank. >> - */ >> - struct drm_device *dev = old_state->dev; >> - struct ingenic_drm *priv = drm_device_get_priv(dev); >> - >> - drm_atomic_helper_commit_modeset_disables(dev, old_state); >> - >> - drm_atomic_helper_commit_planes(dev, old_state, 0); >> - >> - drm_atomic_helper_commit_modeset_enables(dev, old_state); >> - >> - drm_atomic_helper_commit_hw_done(old_state); >> - >> - if (!priv->no_vblank) >> - drm_atomic_helper_wait_for_vblanks(dev, old_state); >> - >> - drm_atomic_helper_cleanup_planes(dev, old_state); >> -} >> - >> static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg) >> { >> struct ingenic_drm *priv = drm_device_get_priv(arg); >> @@ -749,6 +726,9 @@ static int ingenic_drm_enable_vblank(struct >> drm_crtc *crtc) >> { >> struct ingenic_drm *priv = drm_crtc_get_priv(crtc); >> >> + if (priv->no_vblank) >> + return -EWOULDBLOCK; > > I think other drivers return EINVAL here. I'm not sure exactly this is > specified, but the errno here is visible to userspace. > > Maybe would be good to update the kerneldoc for this hook? > > Anyway this is great, with the errno fixed: > > Reviewed-by: Daniel Vetter I thought about it afterwards, that my error code wasn't great. In my mind it was "the driver will hang while waiting for vblank" hence -EWOULDBLOCK ;) I'll need to v2 anyway so I'll change it to -EINVAL then. Cheers, -Paul > >> + >> regmap_update_bits(priv->map, JZ_REG_LCD_CTRL, >> JZ_LCD_CTRL_EOF_IRQ, JZ_LCD_CTRL_EOF_IRQ); >> >> @@ -856,7 +836,7 @@ static const struct drm_mode_config_funcs >> ingenic_drm_mode_config_funcs = { >> }; >> >> static struct drm_mode_config_helper_funcs >> ingenic_drm_mode_config_helpers = { >> - .atomic_commit_tail = ingenic_drm_atomic_helper_commit_tail, >> + .atomic_commit_tail = drm_atomic_helper_commit_tail, >> }; >> >> static void ingenic_drm_unbind_all(void *d) >> -- >> 2.30.2 >> > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch