Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3685749rwe; Mon, 17 Apr 2023 01:48:27 -0700 (PDT) X-Google-Smtp-Source: AKy350YNNz980Blqxafe6vkJCoXKZ8xZ8rGz9iixVwn4cVd7Z2MYYSEuJMD5PSug84zFAKJvZOUs X-Received: by 2002:a05:6a20:9298:b0:cc:d7ec:b7c with SMTP id q24-20020a056a20929800b000ccd7ec0b7cmr13640202pzg.4.1681721306912; Mon, 17 Apr 2023 01:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681721306; cv=none; d=google.com; s=arc-20160816; b=A9PvJVY/XFmm+IrJ7BCtRISiiYnZqmpLznqUJ8us9u/+5DkLjealrz3jq+WqQ06bkG 5fCZMwgOBx9nIoIqaVii+uOk2oKd1Igh3L1CpQ07duNHAM2AkI6BYOSUL3CLRVEWGwNf 00lOE7unU7Ai4FoK9n1zKiUVpHFDu7tcXx6F0eDrS++SSUw9iG3XboakCkzPOWieMUms M7QWztOCOwC9P78T30M+TAdApb/l09de6gdf/jg34C59QxYZMD0EJGhiKyT4bG3fMX/Y LNDJS8lqkIpXmUWSzfcq91SpvymBBYgC7ng8TSTHnGeFgPUy5wpgxZs7QXc1lnyKHWzo 0vLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=EGeTqvncBeEQnZPNQq+/DWYJPeyj5AKOr7ilYpTXEqg=; b=HDDWMJujT6qaINbN4EcHQS2bA+sUefQ+Lfvip1LVP4Gf4TBVXwBDUlp9q0UmW9QyBU VEtKy8vQQp5DN1sBCBqjrZl2vAq957f0FRWDt4ipahWg97cgnKeHJRLVuUPdF/HqPwpy y5vkGcYK/gYNRf8OdUj5P7ti65m980PPbrgY3VSm99yG4HPXWl+AVY/UoV9VcOCzpCHk szyQwjf02vbU/wTJb9+goXHO4bfvUgzF9yAIRIII6QPBTyet8KDMSi8Tewhmk57sCk+R yUarSL+9pl38wGGBj3mei/PhlEl5h9WWokel+FhDd/aQoAmHslQKONKfKNUGH6M0U6a2 l/Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020aa796d4000000b0062d9eed7d25si11311063pfq.57.2023.04.17.01.48.13; Mon, 17 Apr 2023 01:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbjDQIoB convert rfc822-to-8bit (ORCPT + 99 others); Mon, 17 Apr 2023 04:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjDQIn7 (ORCPT ); Mon, 17 Apr 2023 04:43:59 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C77A8E49 for ; Mon, 17 Apr 2023 01:43:53 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1poKSO-000303-Km; Mon, 17 Apr 2023 10:43:28 +0200 Message-ID: <3e47f0d1017fe4c9f71a5de65f32c6ba1662efe2.camel@pengutronix.de> Subject: Re: [PATCH 1/6] drm: bridge: samsung-dsim: Support multi-lane calculations From: Lucas Stach To: Adam Ford , dri-devel@lists.freedesktop.org Cc: Krzysztof Kozlowski , aford@beaconembedded.com, Laurent Pinchart , Andrzej Hajda , Fabio Estevam , m.szyprowski@samsung.com, marex@denx.de, Robert Foss , David Airlie , Jernej Skrabec , Jagan Teki , NXP Linux Team , devicetree@vger.kernel.org, Daniel Vetter , Jonas Karlman , Sascha Hauer , Inki Dae , Rob Herring , linux-arm-kernel@lists.infradead.org, Neil Armstrong , linux-kernel@vger.kernel.org, Pengutronix Kernel Team , Shawn Guo Date: Mon, 17 Apr 2023 10:43:25 +0200 In-Reply-To: <20230415104104.5537-1-aford173@gmail.com> References: <20230415104104.5537-1-aford173@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adam, Am Samstag, dem 15.04.2023 um 05:40 -0500 schrieb Adam Ford: > If there is more than one lane, the HFP, HBP, and HSA is calculated in > bytes/pixel, then they are divided amongst the different lanes with some > additional overhead. This is necessary to achieve higher resolutions while > keeping the pixel clocks lower as the number of lanes increase. > In the testing I did to come up with my patch "drm: bridge: samsung- dsim: fix blanking packet size calculation" the number of lanes didn't make any difference. My testing might be flawed, as I could only measure the blanking after translation from MIPI DSI to DPI, so I'm interested to know what others did here. How did you validate the blanking with your patch? Would you have a chance to test my patch and see if it works or breaks in your setup? Regards, Lucas > Signed-off-by: Adam Ford > --- > drivers/gpu/drm/bridge/samsung-dsim.c | 40 +++++++++++++++++++++++---- > 1 file changed, 34 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c > index e0a402a85787..1ccbad4ea577 100644 > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > @@ -215,6 +215,7 @@ > #define DSI_RX_FIFO_SIZE 256 > #define DSI_XFER_TIMEOUT_MS 100 > #define DSI_RX_FIFO_EMPTY 0x30800002 > +#define DSI_HSYNC_PKT_OVERHEAD 6 > > #define OLD_SCLK_MIPI_CLK_NAME "pll_clk" > > @@ -879,13 +880,40 @@ static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) > | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); > samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); > > - reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) > - | DSIM_MAIN_HBP(m->htotal - m->hsync_end); > - samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > + /* > + * If there is more than one lane, the HFP, HBP, and HSA > + * is calculated in bytes/pixel, then they are divided > + * amongst the different lanes with some additional > + * overhead correction > + */ > + if (dsi->lanes > 1) { > + u32 hfp, hbp, hsa; > + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format) / 8; > + > + hfp = ((m->hsync_start - m->hdisplay) * bpp) / dsi->lanes; > + hfp -= (hfp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; > + > + hbp = ((m->htotal - m->hsync_end) * bpp) / dsi->lanes; > + hbp -= (hbp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; > > - reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) > - | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); > - samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > + hsa = ((m->hsync_end - m->hsync_start) * bpp) / dsi->lanes; > + hsa -= (hsa > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; > + > + reg = DSIM_MAIN_HFP(hfp) | DSIM_MAIN_HBP(hbp); > + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > + > + reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) > + | DSIM_MAIN_HSA(hsa); > + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > + } else { > + reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) > + | DSIM_MAIN_HBP(m->htotal - m->hsync_end); > + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); > + > + reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) > + | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); > + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); > + } > } > reg = DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | > DSIM_MAIN_VRESOL(m->vdisplay, num_bits_resol);