Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp463849lqb; Fri, 24 May 2024 04:09:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpWJuVhFVkfxom2cMKWI2unzJEVnI7U3RXTi49LFw3ElQ1z/9yl6w83uFSWVDi0t45neYNxE15olt2o6p0uRlpM0j+KOEwb0Q8swUjcA== X-Google-Smtp-Source: AGHT+IHe7UJL/q8pnz6odBoUp5yafqZlwdxq1geG3eTQjTgQTU9kr6qWsYhZdyBwNMZo6MKscTad X-Received: by 2002:a17:90a:8a15:b0:2bb:a88:8efd with SMTP id 98e67ed59e1d1-2bf5e185872mr1656697a91.12.1716548956527; Fri, 24 May 2024 04:09:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716548956; cv=pass; d=google.com; s=arc-20160816; b=l7BZChND1NifYeojnVUq6Ysy4HJyTKis8J6vtjIP8X2V6WaYFJha4NsVdcUJdVL14y /nI9S6gV3oxlSo/vICXFqhPEK16Wmu+Gb+b9X/VcHbKv1ZfbHxDP12CiAxQHqXfE22sX ayzDXwqKH//Jr+8GqVBT7hcBqTyaNI2y+mOLZFuwZXS5yEPT8lWs9F9B21WWLTVktAfs hN2bTWmwZVfcAYI2eKJEjqPCiPBu5pp00kE5DSmNTRt+SqxpXR7Kh8Qu54pXldu0Ho+B UkYlU7ALS1l90FK9ovwHxC58OCVHpPsOD9rHkf3foM4KJPyMWhpFo03fsmJJ69/oOSrJ VfTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=MzuQhoSyM1xymektG2r7GA3lDYRYUkIhwJOnrDgdovY=; fh=Utvgd2IBP1Wpc34yylf7GfgtU7cPSX0vbwkoklsS9IY=; b=tRbAa1ZJdW/wqhwHjIOKZjXS8B4oyIlVMb5XzhvUO0m4G9QRYWqE/ingER+G0mSTEZ FxdCXMtk8elPtQRHCKFBS7n+6tbeEBrlfPrYuWyUVesb8JwqQ4n2SwXsOy1WVYtNzMNp 91YueaofzFk6MPPYOcQTmOgobCxBlYM7SgNyZiOw+aHhgfJmsYWMUZd/wMgzpaeyCshh vqKJwDzj0hcZbj+vqSHMgOBvgFf0/ukpRPzCkgGRBkhK7pZfz3VknBJRoXWw5D6+vU8V s/p80oYVxGdRp+o3dPPc6dKeq3LK7UiTfGFzPAD4/A8S5JVBf6ULnMHMzOybjZ0OHduR VKmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RBdlo+b6; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188637-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9e4371si12014375ad.546.2024.05.24.04.09.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 04:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RBdlo+b6; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188637-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188637-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA9F3282353 for ; Fri, 24 May 2024 11:09:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BCDA85C76; Fri, 24 May 2024 11:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="RBdlo+b6" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 9CB7942078 for ; Fri, 24 May 2024 11:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548947; cv=none; b=XQx/98NHfgAvAdalASAIt5T8j28qv71l9AoUP5x7LFErru4BRQe7Syoem64/G+FR2sT1J6cX/+olKajklUJgybE/TWG9kRysOS+2xP3IYfOqjQIRxRsqRSyALkk1zajZcmcIR+ZPMyNEWbdOwCH1IK3KYd3LIKiNBNGzezY+U/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548947; c=relaxed/simple; bh=rn9YRk5eG8ZY8mbR8dGpjOxuH4c3Z+VFNQjatRUvllg=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=dHPBFtjRPzINUzaQlv3dMN76Q3j7B+p9CgwKHYJ5zE+XUXP6/fu5Uiv6KydSRYG38umXv72x40fFCHnQb0psmJnszFgccHyT4P66fyAiSGTptiuT0oCUChE1cnX0gwfo0qPCy6gbBXWQsix4Zo3anC/caRNSK+Jw+cGPq18/yWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=RBdlo+b6; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44OB8Nlo030281; Fri, 24 May 2024 06:08:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716548903; bh=MzuQhoSyM1xymektG2r7GA3lDYRYUkIhwJOnrDgdovY=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=RBdlo+b6Qn8pduCS6QzmH6qM61UWs7D2uoYpkellbCYBYUOLW0RX2dFd35W66XJiM uGyJsuKWGSSVnlBg7zq5eQ9+RuGEq/p8T8fs3H/vyC7i/u5AH4ENe0kcLcm7YuIlzo IpVKy1AH6RjS+7prwVC8Ah2razCTkMtSIG229qRo= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44OB8NCl043568 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 May 2024 06:08:23 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 24 May 2024 06:08:23 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 24 May 2024 06:08:23 -0500 Received: from [172.24.227.31] (uda0496377.dhcp.ti.com [172.24.227.31]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44OB8ECf047117; Fri, 24 May 2024 06:08:15 -0500 Message-ID: <1a6b8a83-b378-4869-b536-0fca76e428bf@ti.com> Date: Fri, 24 May 2024 16:38:13 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/7] drm/bridge: Introduce early_enable and late disable To: Maxime Ripard CC: Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Jyri Sarha , Thomas Zimmermann , David Airlie , Daniel Vetter , DRI Development List , Linux Kernel List , Sam Ravnborg , Thierry Reding , Kieran Bingham , Boris Brezillon , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra References: <20240511153051.1355825-1-a-bhatia1@ti.com> <20240511153051.1355825-7-a-bhatia1@ti.com> <20240516-bipedal-keen-taipan-eedbe7@penduick> <20240521-realistic-imposing-lemur-aac3ad@houat> Content-Language: en-US From: Aradhya Bhatia In-Reply-To: <20240521-realistic-imposing-lemur-aac3ad@houat> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Hi Maxime, On 21/05/24 18:45, Maxime Ripard wrote: > Hi, > > On Thu, May 16, 2024 at 03:10:15PM GMT, Aradhya Bhatia wrote: >>>> /** >>>> * @pre_enable: >>>> * >>>> @@ -285,6 +319,26 @@ struct drm_bridge_funcs { >>>> */ >>>> void (*enable)(struct drm_bridge *bridge); >>>> >>>> + /** >>>> + * @atomic_early_enable: >>>> + * >>>> + * This callback should enable the bridge. It is called right before >>>> + * the preceding element in the display pipe is enabled. If the >>>> + * preceding element is a bridge this means it's called before that >>>> + * bridge's @atomic_early_enable. If the preceding element is a >>>> + * &drm_crtc it's called right before the crtc's >>>> + * &drm_crtc_helper_funcs.atomic_enable hook. >>>> + * >>>> + * The display pipe (i.e. clocks and timing signals) feeding this bridge >>>> + * will not yet be running when this callback is called. The bridge can >>>> + * enable the display link feeding the next bridge in the chain (if >>>> + * there is one) when this callback is called. >>>> + * >>>> + * The @early_enable callback is optional. >>>> + */ >>>> + void (*atomic_early_enable)(struct drm_bridge *bridge, >>>> + struct drm_bridge_state *old_bridge_state); >>>> + >>>> /** >>>> * @atomic_pre_enable: >>>> * >>>> @@ -361,6 +415,21 @@ struct drm_bridge_funcs { >>>> void (*atomic_post_disable)(struct drm_bridge *bridge, >>>> struct drm_bridge_state *old_bridge_state); >>>> >>>> + /** >>>> + * @atomic_late_disable: >>>> + * >>>> + * This callback should disable the bridge. It is called right after the >>>> + * preceding element in the display pipe is disabled. If the preceding >>>> + * element is a bridge this means it's called after that bridge's >>>> + * @atomic_late_disable. If the preceding element is a &drm_crtc it's >>>> + * called right after the crtc's &drm_crtc_helper_funcs.atomic_disable >>>> + * hook. >>>> + * >>>> + * The @atomic_late_disable callback is optional. >>>> + */ >>>> + void (*atomic_late_disable)(struct drm_bridge *bridge, >>>> + struct drm_bridge_state *old_bridge_state); >>>> + >>> >>> But more importantly, I don't quite get the use case you're trying to >>> solve here. >>> >>> If I got the rest of your series, the Cadence DSI bridge needs to be >>> powered up before its source is started. You can't use atomic_enable or >>> atomic_pre_enable because it would start the source before the DSI >>> bridge. Is that correct? >>> >> >> That's right. I cannot use bridge_atomic_pre_enable / >> bridge_atomic_enable here. But that's because my source is CRTC, which >> gets enabled via crtc_atomic_enable. >> >> >>> If it is, then how is it different from what >>> drm_atomic_bridge_chain_pre_enable is doing? The assumption there is >>> that it starts enabling bridges last to first, to it should be enabled >>> before anything starts. >>> >>> The whole bridge enabling order code starts to be a bit of a mess, so it >>> would be great if you could list all the order variations we have >>> currently, and why none work for cdns-dsi. >>> >> >> Of course! I can elaborate on the order. >> >> Without my patches (and given there isn't any bridge setting the >> "pre_enable_prev_first" flag) the order of enable for any single display >> chain, looks like this - >> >> crtc_enable >> >> bridge[n]_pre_enable >> --- >> bridge[1]_pre_enable >> >> encoder_enable >> >> bridge[1]_enable >> --- >> bridge[n]_enable >> >> The tidss enables at the crtc_enable level, and hence is the first >> entity with stream on. cdns-dsi doesn't stand a chance with >> bridge_atmoic_pre_enable / bridge_atmoic_enable hooks. And there is no >> bridge call happening before crtc currently. > > Thanks for filling the blanks :) > > I assume that since cdns-dsi is a bridge, and it only has a simple > encoder implementation, for it to receive some video signal we need to > enable the CRTC before the bridge. > > If so, I think that's the original intent between the bridge pre_enable. > The original documentation had: > > pre_enable: this contains things needed to be done for the bridge > before this contains things needed to be done for the bridge before > this contains things needed to be done for the bridge before. > > and the current one has: > > The display pipe (i.e. clocks and timing signals) feeding this bridge > will not yet be running when this callback is called. The bridge must > not enable the display link feeding the next bridge in the chain (if > there is one) when this callback is called. > > I would say the CRTC is such a source, even more so now that the encoder > is usually transparent, so I think we should instead move the crtc > enable call after the bridge pre_enable. Hmm, if I understand you right, the newer sequence of calls will look like this, bridge[n]_pre_enable --- bridge[1]_pre_enable crtc_enable encoder_enable bridge[1]_enable --- bridge[n]_enable I do agree with this. This makes sense. CRTC is indeed such a source, and should ideally be enabled after the bridges are pre_enabled. > > Would that work? > So, this could potentially work, yes. The cdns-dsi would get pre_enabled after all bridges after cdns-dsi are pre_enabled. But over a quick test with BBAI64 + RPi Panel, I don't see any issue. However, the one concern that I have right now, is about breaking any existing (albeit faulty) implementation which relies on CRTC being enabled before the bridges are pre_enabled. =) Regards Aradhya