Received: by 10.223.176.5 with SMTP id f5csp1888907wra; Thu, 8 Feb 2018 05:16:09 -0800 (PST) X-Google-Smtp-Source: AH8x224tYHDd1X1giXs2AuU61HoPA60I/KGS8sWG25cjvdrr1/HOBFPE43Nx3t5mzg783L2plS9O X-Received: by 2002:a17:902:9a04:: with SMTP id v4-v6mr623833plp.252.1518095769795; Thu, 08 Feb 2018 05:16:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518095769; cv=none; d=google.com; s=arc-20160816; b=QGu+yG66j9X0qFdQOKFoCsi0be0qm+/gakn1diFspRmFGdwOYoScYwozx+pDO46UUm g8BYent2RJGcAAxZaWOAzq99e5oabmis5j+4Y8mnzLloU5VQBzPaq/1MO/OoBmVh4391 d9Pb45FBJ56xyLu2uQeh+Gge3F27r6qnyEiGg7YvlMmLZheAdr7i0UJnEQ8oIRIEKoWk HRSxkvtilG8wNyYI6NMDdxYxmeEG96EpQKy3+5FxCOmnnlG9WpgrLDBmlsRl5g5zbqNI H75IdN4MT/Y4H6sNSh0AyLrJ+253uq9TKUEuqRmtrmhax5UAkEYCDJRi9aUsscrgXJ+X 4kbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=9Zi4JUkkuICDnbvEkODx+zgM4cyIAZ1voJsvh3eCm20=; b=vAHJzYaUF1CIwf6oBR5cRpYtC3Cbl51ooViSQ/m5XwKT8eJy2xuUAFdlxTxP/NATCe 5MvAr5AqysvzdC+SQUjvADJVChY/+y+IQQiMptF7u8OYmI/ppddZZ7Expog74R8N/mKP /jbAej0b1h6Yu40Lh0b9ShapHrWEn/R6eHDoMARV4xdW9rMd7y2AuIVsgojgo0/Hbn70 /knWya0Z5SEh6Mh7z4Bwb1Hr1D6pbiV4DYmCA/uM478sx/ld6pNG2pTTW0WZb7xOI5E+ bafqf82YzCw2qRburLubJODP6EibAIwM52SjHUp6r0aA/1nVa/fXFr4F9LZoDyYv5fPC 47Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=OwfR2XCS; 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 h7si1118312pgs.562.2018.02.08.05.15.55; Thu, 08 Feb 2018 05:16:09 -0800 (PST) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=OwfR2XCS; 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 S1751700AbeBHNPO (ORCPT + 99 others); Thu, 8 Feb 2018 08:15:14 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:46167 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbeBHNPN (ORCPT ); Thu, 8 Feb 2018 08:15:13 -0500 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 2F87E2005E; Thu, 8 Feb 2018 14:13:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1518095628; bh=EswHrIEsDU1f8p2E9iPYvSka/KrQk/ErC4ipCiSW/xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwfR2XCSLZ6xjf+MW04itDnQyWUPrFJ8LEwYDnDMsMTVgYgbbmunXhtgZqknS07B9 ZsH5Y21Mj9KIZDPqX7p2VDWkenCpLtI6CDHQvC8Gmqpu74nNoNju4KGzTS6AeFZ8c+ 3syWmAVgbSj64HcCiKogCOrVE9/WpK6i6C/slQ6Q= From: Laurent Pinchart To: Philippe CORNU Cc: "daniel.vetter@ffwll.ch" , Maxime Coquelin , "linux-rockchip@lists.infradead.org" , David Airlie , Brian Norris , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Yannick FERTRE , "linux-arm-kernel@lists.infradead.org" , Ludovic BARRE , Mickael REULIER , Vincent ABRIOU , Bhumika Goyal , Alexandre TORGUE , Archit Taneja , Andrzej Hajda , Benjamin Gaignard Subject: Re: [PATCH] drm/bridge/synopsys: dsi: use adjusted_mode in mode_set Date: Thu, 08 Feb 2018 15:15:40 +0200 Message-ID: <1802436.kt7XbhHcH5@avalon> Organization: Ideas on Board Oy In-Reply-To: <7ec671c2-a777-5dcd-dcc9-e026fff89900@st.com> References: <20180125155504.8611-1-philippe.cornu@st.com> <108376394.4I4zMjzv2j@avalon> <7ec671c2-a777-5dcd-dcc9-e026fff89900@st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Philippe, On Saturday, 3 February 2018 00:41:26 EET Philippe CORNU wrote: > On 01/29/2018 11:40 AM, Laurent Pinchart wrote: > > On Monday, 29 January 2018 12:17:37 EET Philippe CORNU wrote: > >> On 01/29/2018 10:46 AM, Laurent Pinchart wrote: > >>> On Thursday, 25 January 2018 17:55:04 EET Philippe Cornu wrote: > >>>> The "adjusted_mode" clock value (ie the real pixel clock) is more > >>>> accurate than "mode" clock value (ie the panel/bridge requested > >>>> clock value). It offers a better preciseness for timing > >>>> computations and allows to reduce the extra dsi bandwidth in > >>>> burst mode (from ~20% to ~10-12%, hw platform dependant). > >>>> > >>>> Signed-off-by: Philippe Cornu > >>> > >>> The adjusted mode is documented as > >>> > >>> /** > >>> * @adjusted_mode: > >>> * > >>> * Internal display timings which can be used by the driver to handle > >>> * differences between the mode requested by userspace in @mode and > >>> what > >>> * is actually programmed into the hardware. It is purely driver > >>> * implementation defined what exactly this adjusted mode means. > >>> Usually > >>> * it is used to store the hardware display timings used between the > >>> * CRTC and encoder blocks. > >>> */ > >>> > >>> This is easy to handle when the CRTC and encoder are controlled by the > >>> same driver, as the field is "implementation defined" by a single > >>> driver. However, when using bridges, there are two drivers involved, and > >>> they must both agree to meaningfully use the adjusted mode. I can't see > >>> how to do so without standardizing the meaning of the adjusted mode > >>> field. > >> > >> This is exactly the reason why my first implementation used the dsi > >> bridge "optional pixel clock" instead of the adjusted_mode (see [1]) > >> > >> But after digging more into the drm source code, I think using > >> adjusted_mode instead of the pixel clock here brings more advantages > >> because: > >> * adjusted_mode is an argument of bridge mode_set() probably for being > >> used in any manner, maybe like this :) > >> * if the bridge "user" (crtc or a master bridge drivers) does not need > >> to modify its adjusted_mode then mode & adjusted_mode mode_set() > >> arguments will have the same values so "no consequence" for the bridge. > >> * if the bridge "user" (crtc or master bridge drivers) needs to adjust > >> any value of the mode then this adjustment is available for the bridge. > > > > Remember that there can be multiple chained bridges, and a single > > adjusted mode field. > > > >> * rockchip crtc updates a part of the mode (the clock), stm is doing the > >> same (see [2]) but any future "user" of the dw_mipi_dsi bridge can > >> adjust something else (blankings...) and the dw_mipi_dsi bridge will be > >> then aware of... > >> > >> But maybe it is a wrong usage of the "adjusted_mode offer"... > > > > I don't disagree that there's a need for using adjusted values, but I > > believe we need to create a clear API to do so. Using the adjust_mode > > field as-is when it's clearly documented as being implementation-defined > > is asking for trouble. > > Laurent, do you think we can use "adjusted mode" here in this small > patch as the actual 2 "users" of this bridge (rockchip & stm) use both > "adjusted mode" in their crtc? The Synopsys DSI driver might only be used by two display controller drivers today, it is nonetheless a standard bridge driver that should not make any assumption of a particular use of the adjusted_mode in particular display controller drivers. To use the adjusted_mode value in bridge drivers we need to standardize its usage, otherwise we'll end up with incompatibilities between bridge drivers and display controller drivers. > >> [1] https://patchwork.freedesktop.org/patch/200240/ > >> [2] https://patchwork.freedesktop.org/patch/200720/ > >> > >>> Daniel, what's your opinion on this ? > > Daniel, any opinion on the adjusted_mode usage? > > >>>> --- > >>>> Note: This patch replaces "drm/bridge/synopsys: dsi: add optional > >>>> pixel clock" > >>>> > >>>> drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 12 ++++++------ > >>>> 1 file changed, 6 insertions(+), 6 deletions(-) > >>>> > >>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>>> b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index > >>>> ed8af32f8e52..b926b62e9e33 100644 > >>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > >>>> @@ -707,20 +707,20 @@ static void dw_mipi_dsi_bridge_mode_set(struct > >>>> drm_bridge *bridge, > >>>> > >>>> clk_prepare_enable(dsi->pclk); > >>>> > >>>> - ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags, > >>>> + ret = phy_ops->get_lane_mbps(priv_data, adjusted_mode, > >>>> dsi->mode_flags, > >>>> dsi->lanes, dsi->format, &dsi->lane_mbps); > >>>> if (ret) > >>>> DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n"); > >>>> > >>>> pm_runtime_get_sync(dsi->dev); > >>>> dw_mipi_dsi_init(dsi); > >>>> > >>>> - dw_mipi_dsi_dpi_config(dsi, mode); > >>>> + dw_mipi_dsi_dpi_config(dsi, adjusted_mode); > >>>> dw_mipi_dsi_packet_handler_config(dsi); > >>>> dw_mipi_dsi_video_mode_config(dsi); > >>>> - dw_mipi_dsi_video_packet_config(dsi, mode); > >>>> + dw_mipi_dsi_video_packet_config(dsi, adjusted_mode); > >>>> dw_mipi_dsi_command_mode_config(dsi); > >>>> - dw_mipi_dsi_line_timer_config(dsi, mode); > >>>> - dw_mipi_dsi_vertical_timing_config(dsi, mode); > >>>> + dw_mipi_dsi_line_timer_config(dsi, adjusted_mode); > >>>> + dw_mipi_dsi_vertical_timing_config(dsi, adjusted_mode); > >>>> dw_mipi_dsi_dphy_init(dsi); > >>>> dw_mipi_dsi_dphy_timing_config(dsi); > >>>> > >>>> @@ -734,7 +734,7 @@ static void dw_mipi_dsi_bridge_mode_set(struct > >>>> drm_bridge *bridge, > >>>> > >>>> dw_mipi_dsi_dphy_enable(dsi); > >>>> > >>>> - dw_mipi_dsi_wait_for_two_frames(mode); > >>>> + dw_mipi_dsi_wait_for_two_frames(adjusted_mode); > >>>> > >>>> /* Switch to cmd mode for panel-bridge pre_enable & panel prepare > >>>> */ > >>>> dw_mipi_dsi_set_mode(dsi, 0); -- Regards, Laurent Pinchart