Received: by 10.223.176.5 with SMTP id f5csp2709419wra; Mon, 29 Jan 2018 02:41:45 -0800 (PST) X-Google-Smtp-Source: AH8x224yXkhUOjzGsbsNIjUR2khrc0kX7iDnoDUdWhro2AKUB8p+Z29eTi9XKs9XDLZayIYzPudv X-Received: by 2002:a17:902:6a16:: with SMTP id m22-v6mr22376869plk.142.1517222505372; Mon, 29 Jan 2018 02:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517222505; cv=none; d=google.com; s=arc-20160816; b=irtpKFO8cV0955hTY/6bZWocPavwcf+ZtmfH2S2s2y68Az4rkh7zeBw2wkglYzaPVt fqSz13Oq6JUVMRXmNrt5FIllqLTpqVUdm+xW0Rfi+D/q05LvltfaZ4KCujw4r0X31P7q o/BOFcNL1fDDVXmUXN0qI98mxzOI+00787kTGdv9gQ6mn7Ih9ZUSvvxVHkg4bgOVCWNL ZhGWmaf/OLwwtGd4foPOB7AwUVnoGxMrE5Vy+ieswLmsGCPDgbvXuOjJNi88kQqOIXcU qFTR3FxKbeuysA+pCDhPtufqP3vm+HuXLFDwDb4aupgR74wJPa/+nG7KCccIIrSXK22Q kaBA== 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=JXoHwJm3ioFYoik9W8cCQcAY+4SuL9Z7OytqBKYWJOs=; b=lUOpnjt74CjpFFTM9B5C5sIf5gZAjFUimbw09vuOe3fDcC2hGdkWepWuZlaFJkGoEa z0h3jR+qqpgKZ/Cjwy8NmfngQBYVhCAYQWb2oL9SVRIuLkyY049o1iIa1crJk5VZdUa2 6Mo7YYvRPFaLYG45DzxP0A/ME01B3r6LOAcNjM0UzHKMkwtNnwON47OlD9PFoG8DXpno M9tCEJbW43n95K3wR/ct7YV0dGwIN7tKtqPf3ovfpoRdHruqXl59igKdkj+1RMdyqd6y rheILojklhPJf0G+3jc8MKViJJTM3wnUQiKRNB68Gq1YRpOb84SbM1tPv3+TQjzkFBGt pRrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=eCsa4kkb; 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 t79si2981552pfg.318.2018.01.29.02.41.30; Mon, 29 Jan 2018 02:41:45 -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=eCsa4kkb; 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 S1751784AbeA2Kjs (ORCPT + 99 others); Mon, 29 Jan 2018 05:39:48 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:53739 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbeA2Kjr (ORCPT ); Mon, 29 Jan 2018 05:39:47 -0500 Received: from avalon.localnet (unknown [IPv6:2a02:a03f:52fb:2b00:ac86:2f77:64c9:83c0]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id C722A201BD; Mon, 29 Jan 2018 11:38:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1517222317; bh=24581AY/S5jT1ieQgLxENn/JnP7LcAl0f1ZzPHEITrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eCsa4kkbVxk6QrTe3LyXum4n8NmbrMf6gf8FeMzX+OE9Fnx7Vg5fgIA/T8bUAwk/5 x+iZFOE21aWs1+Qb9Rc072Sl+yo3inswJ8xZ0dpr5f0+kHxrkSGdJqwLsOR2DPnPoU Hcylm4c8mwPpVSMM/RwIAa7Tud+Fz2IkK+EmB8Oc= From: Laurent Pinchart To: Philippe CORNU Cc: Archit Taneja , Andrzej Hajda , David Airlie , Brian Norris , Benjamin Gaignard , Bhumika Goyal , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Sandy Huang , Heiko Stubner , "linux-arm-kernel@lists.infradead.org" , "linux-rockchip@lists.infradead.org" , Yannick FERTRE , Vincent ABRIOU , Alexandre TORGUE , Maxime Coquelin , Ludovic BARRE , Mickael REULIER , "daniel.vetter@ffwll.ch" Subject: Re: [PATCH] drm/bridge/synopsys: dsi: use adjusted_mode in mode_set Date: Mon, 29 Jan 2018 12:40:01 +0200 Message-ID: <108376394.4I4zMjzv2j@avalon> Organization: Ideas on Board Oy In-Reply-To: <114a9fc1-3f31-decd-6bdc-803dc88b3b3c@st.com> References: <20180125155504.8611-1-philippe.cornu@st.com> <2782155.lsFkNecG25@avalon> <114a9fc1-3f31-decd-6bdc-803dc88b3b3c@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 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. > Many thanks, > Philippe :-) > [1] https://patchwork.freedesktop.org/patch/200240/ > [2] https://patchwork.freedesktop.org/patch/200720/ > > > Daniel, what's your opinion on this ? > > > >> --- > >> 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