From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D765192580 for ; Tue, 14 Jan 2025 16:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873583; cv=none; b=K9EYISvDgNq0CuJHOHCu4QiHksZcovDMW9XvcwOAkwNDJ7eKPdNQQKopDgTBqweB907YCcvT/Yz6E6LcSYxxOZH/5G461MIGnlKDQilZRUAtHrMaujm7Pqf46ytnMBGOviUsU5cc5CCOL1v0wHe7VyYeG8f/zjNgKcqHeHUqWzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873583; c=relaxed/simple; bh=5VyXoQKxUrpax9SvM9G5/PJBAbAgUuAfOj1RuNdblDc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JGGudsUrm5sViHUKM2rD1JIxqunow5WuJ3gCV3kJxzhILAl0TnHoPDHjG0rTrMayGihpTYw4pJ7iSxKdnK7LhHr805mhRyvaaQ29f7ZFTvw+vlxfwPoagcA00LFFpQr/dUf3d4Uqqp5f1XdRD5/sm1zSoqUqe//sdmXRUwhimf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=bk80hWTs; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bk80hWTs" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736873578; 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=5VyXoQKxUrpax9SvM9G5/PJBAbAgUuAfOj1RuNdblDc=; b=bk80hWTsnBMcwcqztokimJkzKlxkuPB0BeAD6meFt6cODXl66+iG98JL8Ot5iL+g+jDh4b IZtBsj7p4I7gQdJuYJpMGLo9sWFY110zc6O0r6YtKgYpH3TpSwsm3kiRKEWUYDk6qIpGPK IVrE1pDEW5JuzUE2WORGB8II1ojkSPs= Date: Tue, 14 Jan 2025 22:22:51 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v7 11/12] drm/atomic-helper: Re-order bridge chain pre-enable and post-disable To: Maxime Ripard Cc: Tomi Valkeinen , Dmitry Baryshkov , Laurent Pinchart , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Nishanth Menon , Vignesh Raghavendra , Devarsh Thakkar , Praneeth Bajjuri , Udit Kumar , Jayesh Choudhary , DRI Development List , Linux Kernel List References: <20250114055626.18816-1-aradhya.bhatia@linux.dev> <20250114055626.18816-12-aradhya.bhatia@linux.dev> <4518320e-4699-4026-adbe-b28514bde544@ideasonboard.com> <4d2bf1a9-37d8-4f9e-b855-b372179258f2@linux.dev> <20250114-hypersonic-amiable-seagull-2d9f8d@houat> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Aradhya Bhatia In-Reply-To: <20250114-hypersonic-amiable-seagull-2d9f8d@houat> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT On 1/14/25 22:13, Maxime Ripard wrote: > On Tue, Jan 14, 2025 at 10:05:56PM +0530, Aradhya Bhatia wrote: >> >> >> On 1/14/25 18:34, Tomi Valkeinen wrote: >>> Hi, >>> >>> On 14/01/2025 13:24, Dmitry Baryshkov wrote: >>>> On Tue, Jan 14, 2025 at 11:26:25AM +0530, Aradhya Bhatia wrote: >>>>> Move the bridge pre_enable call before crtc enable, and the bridge >>>>> post_disable call after the crtc disable. >>>>> >>>>> The sequence of enable after this patch will look like: >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[n]_pre_enable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0... >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[1]_pre_enable >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0crtc_enable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0encoder_enable >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[1]_enable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0... >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[n]_enable >>>>> >>>>> And, the disable sequence for the display pipeline will look like: >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[n]_disable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0... >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[1]_disable >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0encoder_disable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0crtc_disable >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[1]_post_disable >>>>> =C2=A0=C2=A0=C2=A0=C2=A0... >>>>> =C2=A0=C2=A0=C2=A0=C2=A0bridge[n]_post_disable >>>>> >>>>> The definition of bridge pre_enable hook says that, >>>>> "The display pipe (i.e. clocks and timing signals) feeding this bri= dge >>>>> will not yet be running when this callback is called". >>>>> >>>>> Since CRTC is also a source feeding the bridge, it should not be en= abled >>>>> before the bridges in the pipeline are pre_enabled. Fix that by >>>>> re-ordering the sequence of bridge pre_enable and bridge post_disab= le. >>>> >>>> The patch contains both refactoring of the corresponding functions a= nd >>>> changing of the order. Please split it into two separate commits. >>>> >>>>> >>>>> Signed-off-by: Aradhya Bhatia >>>>> Signed-off-by: Aradhya Bhatia >>>>> --- >>>>> =C2=A0 drivers/gpu/drm/drm_atomic_helper.c | 300 +++++++++++++++++-= ---------- >>>>> =C2=A0 1 file changed, 181 insertions(+), 119 deletions(-) >>>>> >>>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >>>>> b/drivers/gpu/drm/drm_atomic_helper.c >>>>> index 5186d2114a50..ad6290a4a528 100644 >>>>> --- a/drivers/gpu/drm/drm_atomic_helper.c >>>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c >>>>> @@ -74,6 +74,12 @@ >>>>> =C2=A0=C2=A0 * also shares the &struct drm_plane_helper_funcs funct= ion table >>>>> with the plane >>>>> =C2=A0=C2=A0 * helpers. >>>>> =C2=A0=C2=A0 */ >>>>> + >>>>> +enum bridge_chain_operation_type { >>>>> +=C2=A0=C2=A0=C2=A0 DRM_BRIDGE_PRE_ENABLE_OR_POST_DISABLE, >>>>> +=C2=A0=C2=A0=C2=A0 DRM_BRIDGE_ENABLE_OR_DISABLE, >>>>> +}; >>>>> + >>>> >>>> I have mixed feelings towards this approach. I doubt that it actuall= y >>>> helps. Would you mind replacing it with just 'bool pre_enable' / 'bo= ol >>>> post_disable' arguments? >>> >>> If my memory serves, I suggested the enum. I don't like it too much >>> either. But neither do I like the boolean that much, as this is not a= >>> yes/no, on/off case... Then again, maybe boolean is fine here, as the= >>> "off" case is the "normal/default" case so it's still ok-ish. >>> >>> But this doesn't matter much, I think. It's internal, and can be >>> trivially adjusted later. >>> >> >> Alright! I will drop the enum reference entirely, and just use the >> booleans. >=20 > Whatever you do, I think that we're at a point where the bridge chain > traversal is complicated enough that we'll want to have tests for all > cases. > I don't think I follow. Which all cases are you referring to? Regards Aradhya