Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp150990rwr; Thu, 4 May 2023 00:22:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rz05oXq6fAAQBgFZqpywRcX0tuhhMbamw96SSkVFbir2dOWPlxld1YXZbmuqy08Wklnn9 X-Received: by 2002:a05:6a20:a5aa:b0:f0:f96a:bf36 with SMTP id bc42-20020a056a20a5aa00b000f0f96abf36mr1242000pzb.43.1683184956206; Thu, 04 May 2023 00:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683184956; cv=none; d=google.com; s=arc-20160816; b=jwQX5vu38QhKUc4ZjcMVV3Hqk8gjCK1RdBovVlH5XFj7/kmxWdk8yNgP27+0nWs5n/ jcGREmvzFBGR6Cac7+m/zMx+v2DoBLEKK1d2/oDFyoR/n2CpfeAdS7bnqNEmionZxpie j4bkR53mRjftKl9Gxml0/mmzDNL5KhIBgoTPTdGIXBC3+OBEoWmlLwHbijXgf4mtH2fK 0+I9X00G+69iVguMKvKgoLyVZzGxjzHm2RJiG2uK7FDQ/2DhZZGUs4xwMu4wB9xlQwJp t/ID5Hke7kI6If1Y2HZZQxHj18DS80Az8b9aus9+M/Lu22V3mLPMebOc8BmQ33DoUVK/ EuiQ== 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=0vEGEZsewnRr2GgoUFIa1xSj21O1AD7A+MCOwPtcCBc=; b=QJOKLgjTGoxc8Ak0wgVaE/6+s1tW9K3OZ5lyKtgGsp8bWjou9RHwQylfJRyvtokfj0 y9VHQm/B5nrKp+s8+l3e8g9jWjIUita+s5NZKXO5E3f3gjFeY5VAvf7c+Gj93rw+y5B1 ohYLo/xS5ulSyT96DhGxa+FwzaoY3JUhnJSDBBK5llyeh4KrpmUd8fImokY7zEqFaurZ w73ye8tDajxP3KX/RC54VUjzS8RdZoozGAR6DEOXkCN+hxMrnCHg3ClyozvQtfqv/ZK/ 3exygNLTg6whw0ovVavnCRPtfI3k2b+CFBisYrz+nUYTKkh8HCSj4zGUcW/QSAQxB7fp WtKw== 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 v10-20020a63610a000000b00528d90d40d9si12410895pgb.763.2023.05.04.00.22.23; Thu, 04 May 2023 00:22:36 -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 S229892AbjEDHPZ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 4 May 2023 03:15:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjEDHPX (ORCPT ); Thu, 4 May 2023 03:15:23 -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 AACC62D5E for ; Thu, 4 May 2023 00:15:21 -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 1puTB8-0007Hz-VW; Thu, 04 May 2023 09:15:03 +0200 Message-ID: <9f98e3b5194640cf578d2aa290c6d0ff9ab92369.camel@pengutronix.de> Subject: Re: [PATCH V2 1/6] drm: bridge: samsung-dsim: fix blanking packet size calculation From: Lucas Stach To: Jagan Teki , Adam Ford Cc: dri-devel@lists.freedesktop.org, m.szyprowski@samsung.com, aford@beaconembedded.com, dario.binacchi@amarulasolutions.com, Inki Dae , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Frieder Schrempf , Marek Vasut , linux-kernel@vger.kernel.org Date: Thu, 04 May 2023 09:14:57 +0200 In-Reply-To: References: <20230423121232.1345909-1-aford173@gmail.com> <20230423121232.1345909-2-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=ham 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 Am Mittwoch, dem 03.05.2023 um 22:05 +0530 schrieb Jagan Teki: > On Mon, Apr 24, 2023 at 3:17 PM Adam Ford wrote: > > > > On Mon, Apr 24, 2023 at 4:03 AM Jagan Teki wrote: > > > > > > On Sun, Apr 23, 2023 at 5:42 PM Adam Ford wrote: > > > > > > > > From: Lucas Stach > > > > > > > > Scale the blanking packet sizes to match the ratio between HS clock > > > > and DPI interface clock. The controller seems to do internal scaling > > > > to the number of active lanes, so we don't take those into account. > > > > > > > > Signed-off-by: Lucas Stach > > > > Signed-off-by: Adam Ford > > > > --- > > > > drivers/gpu/drm/bridge/samsung-dsim.c | 18 +++++++++++++++--- > > > > 1 file changed, 15 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c > > > > index e0a402a85787..2be3b58624c3 100644 > > > > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > > > > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > > > > @@ -874,17 +874,29 @@ static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) > > > > u32 reg; > > > > > > > > if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { > > > > + int byte_clk_khz = dsi->burst_clk_rate / 1000 / 8; > > > > + int hfp = (m->hsync_start - m->hdisplay) * byte_clk_khz / m->clock; > > > > > > I do not quite understand why it depends on burst_clk_rate, would you > > > please explain? does it depends on bpp something like this > > > > > > mipi_dsi_pixel_format_to_bpp(format) / 8 > > > > The pixel clock is currently set to the burst clock rate. Dividing > > the clock by 1000 gets the pixel clock in KHz, and dividing by 8 > > converts bits to bytes. > > Later in the series, I change the clock from the burst clock to the > > cached value returned from samsung_dsim_set_pll. > > Okay. > > > > > > > > > > + int hbp = (m->htotal - m->hsync_end) * byte_clk_khz / m->clock; > > > > + int hsa = (m->hsync_end - m->hsync_start) * byte_clk_khz / m->clock; > > > > + > > > > + /* remove packet overhead when possible */ > > > > + hfp = max(hfp - 6, 0); > > > > + hbp = max(hbp - 6, 0); > > > > + hsa = max(hsa - 6, 0); > > > > > > 6 blanking packet overhead here means, 4 bytes + payload + 2 bytes > > > format? does this packet overhead depends on the respective porch's > > > like hpf, hbp and hsa has different packet overheads? > > > > Lucas might be able to explain this better. However, it does match > > the values of the downstream NXP kernel, and I tried playing with > > these values manually, and 6 appeared to be the only number that > > seemed to work for me too. I abandoned my approach for Lucas' > > implementation, because it seemed more clear than mine. > > Maybe Lucas can chime in, since this is really his patch. > > Lucan, any inputs? > The blanking packets are are MIPI long packets, so 4 byte header, payload, 2 bytes footer. I experimented with different blanking sizes and haven't found that it would make any difference. I don't think any real-world horizontal blanking sizes would require multiple packets to be sent. Regards, Lucas