From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F1E3CF34B0 for ; Thu, 3 Oct 2024 15:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0PsSUe13vUmvfeVgUF25EfqEOfrNl5riWAxPbSeMrXA=; b=rz9WD1Qs7l3fAG 9TLmyZhxdfXd14uaeD5+F+LxTa34aFIUTxXnXkwWE4YOx1WnO/sasvpNw69z7L6RVo+tIjT96Oa/2 7mT+gemUJdOwCYbCUd+47jZESz03CNEPvKGL3LJHL6KOEqqL/YRMA1eIf9yOvKWDnjSKQFzR4JH26 2kJxSMHnCRH6Rwb1h7svqMKqktR0F7T5SoTgg7bXrAm4qRdK8bbz0TCOcsoEBCTR0nvUvjL6m5xH6 ZVfB5jz+fvzaAHbb9VM/1nsK0XanTvgoDaRvnhVuFouICFfD1iGWqg+4bPtzKu+cn3+lwnMmpg0EW ChA7aGBs68oAQD1lePRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swO13-00000009fJk-2xAD; Thu, 03 Oct 2024 15:45:21 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swO10-00000009fHH-1OE3; Thu, 03 Oct 2024 15:45:19 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 6E6A6E0002; Thu, 3 Oct 2024 15:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727970315; 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=KEG391uPbET+smFrjuUd3Gbf+SfD/X5R0PGVdaNVyDQ=; b=TICrwrFPqNQr0FkllJojskNhDNyxJBBjJ7p1KfIigSpe1yz5eAAGd2ZrO2BidvC6/A+Qom NZAd/9RJSz1RiDd3lLdtADp5nqX9bQyWNoBMaYmxSJhOSDe0T0fZ3BzR0Se1uCIXgHLatP 0EnPqF616SrgdCpZaDlShmBrP13ZbIXW9Bj7Oi5IuZvb8HSqOh6m1SReSPJmtquU99Yk9c wA7Vpopy8iwsQYMzzsZgtNT4idP5iRQdLFv3pdXkbJyEmdQQR3dqplUNNyYzH1sATd/MpW BCY3lPJp+f+t7R9s2mNyuYyLKxVcwMtVAupvHPO8B9IX4HLM2IwIi9MsvKSHrQ== Date: Thu, 3 Oct 2024 17:45:10 +0200 From: Louis Chauvet To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Liviu Dudau , Russell King , Inki Dae , Patrik Jakobsson , Alain Volmat , Sandy Huang , Jyri Sarha , Alexey Brodkin , Hans de Goede , =?iso-8859-1?Q?Ma=EDra?= Canal , Zack Rusin , amd-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure Message-ID: Mail-Followup-To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Liviu Dudau , Russell King , Inki Dae , Patrik Jakobsson , Alain Volmat , Sandy Huang , Jyri Sarha , Alexey Brodkin , Hans de Goede , =?iso-8859-1?Q?Ma=EDra?= Canal , Zack Rusin , amd-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, xen-devel@lists.xenproject.org References: <20241002182200.15363-1-ville.syrjala@linux.intel.com> <20241002182200.15363-3-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-GND-Sasl: louis.chauvet@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241003_084518_663393_CCFE7E2E X-CRM114-Status: GOOD ( 30.92 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Le 03/10/24 - 18:29, Ville Syrj=E4l=E4 a =E9crit : > On Thu, Oct 03, 2024 at 05:07:35PM +0200, Louis Chauvet wrote: > > = > > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/v= kms/vkms_crtc.c > > > > > index a40295c18b48..780681ea77e4 100644 > > > > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > > > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > > > > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *= crtc) > > > > > struct drm_vblank_crtc *vblank =3D drm_crtc_vblank_crtc(crtc); > > > > > struct vkms_output *out =3D drm_crtc_to_vkms_output(crtc); > > > > > = > > > > > - drm_calc_timestamping_constants(crtc, &crtc->mode); > > > > > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode); > > > > = > > > > drm_calc_timestamping_constants(crtc, &crtc->state->mode); > > > = > > > This one doesn't look safe. You want to call that during your atomic > > > commit already. > > > = > > = > > This was already not safe with the previous implementation? Or it is on= ly = > > unsafe because now I use state->mode instead of legacy.mode? > = > Yeah, if you want to look at obj->state then you need the corresponding > lock. > = > obj->state is also not necessarily the correct state you want because > a parallel commit could have already swapped in a new state but the > hardware is still on the old state. > = > Basically 99.9% of code should never even look at obj->state, and > instead should always use the for_each_new__in_state() > and drm_atomic_get_new__state() stuff. Currently that is a > pipe dream though because a lot of drivers haven't been fixed to > do things properly. If we ever manage to fix everything then we > could remove the stall hacks from drm_atomic_helper_swap_state() > and allow a commit pipeline of arbitrary length. > > > = > > After inspecting the code, I think I don't need to call it as: > > = > > In `vkms_atomic_commit_tail` (used in = > > `@vkms_mode_config_helpers.atomic_commit_tail`), we call = > > `drm_atomic_helper_commit_modeset_disables`, which call = > > `drm_atomic_helper_calc_timestamping_constants` which call = > > `drm_calc_timestamping_constants` for every CRTC. > = > Slightly odd place for it, but I think that's just because it was > originally part of drm_atomic_helper_update_legacy_modeset_state() > and I didn't bother looking for a better home for it when I split > it out. But seems like it should work fine as is. I just send a patch for this! Thanks for your help! [1]:https://lore.kernel.org/all/20241003-remove-legacy-v1-1-0b7db1f1a1a6@bo= otlin.com/ = > > = > > I tested kms_vblank, all of them are SUCCESS/SKIP, do you know other te= sts = > > that can trigger bugs? > = > You would explicitly have to race commits against vblank_enable. > Could of course sprinkle sleep()s around to widen the race window > if you're really keen to hit it. > = > -- = > Ville Syrj=E4l=E4 > Intel -- = Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic