Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4541438rdb; Tue, 12 Dec 2023 02:29:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJIXYJE97UHKz+gn/5OY5w2wG63m0rZs0sKzX2BmEx+v00Zm+00nCFBDc0z9365lkaqrJI X-Received: by 2002:a17:902:c406:b0:1d0:cf22:c6ca with SMTP id k6-20020a170902c40600b001d0cf22c6camr3273335plk.52.1702376968318; Tue, 12 Dec 2023 02:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702376968; cv=none; d=google.com; s=arc-20160816; b=sRpoGshkDADqBnfzIm4nwZba99i41ZNb8N3kBF6LrGqKDzUxB5uzelmt1Eea0MSovp Q+WQt0QmTnuZyRsxLn+KgLwGU9/000SXv/A+zzKe8W2599tZzUQ2bLZGYRm8XN1v3peF BAhl8RCohJ6dI19zCjd+AJ+cVg3vaeATss2RLy7YHKYHMG9W/rPKIlV+oLYPSj6ZsJRG E5ksmeTXJXP/yudyBqap+9Tp0NYjuRhzo8FQedrluOI2w0RXXUArtMNJl301cJzEtH+R CN9hxYBVjAMTCMr19wgefTOR1o1mzNOyVxoGx/tqVxY13H2BNWt2QirHkUrynp8ZaHF1 JRpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HHmbx/TAJnGNEEz0o7g8cBj5c1EY3ZNmozjuVxS5uaw=; fh=wgnSZM/NoXlLmv9FLTZ8p0Qa5VB4Ykfu13AKpG9pqDE=; b=KdzyEtCWl1NtUN2XtzvRMUpeZWp01CxZ086ZMbIxnM9U17oMzq5wQ9/U9AR4d8ra4Q VDzjvkdTS039Cx9I5SPS65rA+R9xa+ikS00mOI9EPcuX6CToK6xAvXXDhggFyZel1z2c 3azpIlJDjTAgl7AvIwE0zHgtOQ2O8A5KYhbMFnS12gxDlET/w0qw8djOCR4EvUfRu15s iAag67v+LZrnBYc5MF7gIHb6ri7DNKL7PUethjHmS8RStCSZT7EQbBl+Du3tTRhyUhqm GrdZKZzZn35kPzNvzMlaPDdQKUxSC+vLOOGrv4H62G0P9j1gPNIgzEKy2iD007vDX43g 1lhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zc3mT6EO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u12-20020a17090341cc00b001d09e26a715si7498478ple.89.2023.12.12.02.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:29:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zc3mT6EO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id B021280BAAB5; Tue, 12 Dec 2023 02:29:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbjLLK3I (ORCPT + 99 others); Tue, 12 Dec 2023 05:29:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbjLLK3G (ORCPT ); Tue, 12 Dec 2023 05:29:06 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E02D2 for ; Tue, 12 Dec 2023 02:29:12 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5c6734e0c22so2683587a12.0 for ; Tue, 12 Dec 2023 02:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702376951; x=1702981751; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HHmbx/TAJnGNEEz0o7g8cBj5c1EY3ZNmozjuVxS5uaw=; b=Zc3mT6EOiFdPj3Aou0tS5NxRXcidukYZ0EFefyByswGqZrCwliUDrqIVXGvccLxdJ9 h6h5BxX+RFzeRBoNZsvk8BKFdTT8uigLF1QZ8+2TIYpD94AgW2Uv2MEggTdYgW2B0fxO G+GS5979ohcYNnF3eSOJhGQhamHnJoQj8eEAA4GTloMUXTWgFwqDLVEZP13ckbgEmvqc DYg9wvdNruH9YBWe32Zc+YBEkjXAVkJiwlPGn++Noy0tFp5XIxUPzdfj4V3GNegKnqrt jU1prFXQcyK48MwcJ1JSbC8U0jOdJgR6h2o6fTsCP4OPbB/t7CXeC4YmT+E0s9+5UfSW 1Iaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702376951; x=1702981751; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HHmbx/TAJnGNEEz0o7g8cBj5c1EY3ZNmozjuVxS5uaw=; b=iUbnPyCdOAFiI29B0FuFaQh5+mqB6HnthxiBNwk7zl+HOJr+lYvuTiZTWly588s9mg xSd97R5MR1q8oLqXBLWNeb36kr+x4JdEhniacxxfnRSLXGT2W/70XWSy0k6mWr7i8ZA/ EqFmTOwWZwVGAsXKiKu4ve3MRgRFNoSb3ChxfW9Ij6QZnC5tdhfIcoGxGttUplQnlcbk BV2/ULjnlqUaxUVcFptDRjPFvAU3Li/QXWWmp9kQ+pEg/iM333Jbv+gzP4gkHzznE2vs aiS0bHgL6abXDfUXbpjl1GO3JRDdEtH7UgSuzcnPgQdRv9ghWJDyYPcdEE+Hd9RwGEWc IM5Q== X-Gm-Message-State: AOJu0YzLV06+QvI+wqovdEbbqiVld0fZIh/7dSgDx8InkXnxFVtDxP0o v9Vllgfo4q5HBFw7uAGMaEHh11AEoHRvjdbtLe8= X-Received: by 2002:a17:90a:8a0e:b0:286:a944:abb2 with SMTP id w14-20020a17090a8a0e00b00286a944abb2mr2532263pjn.20.1702376951377; Tue, 12 Dec 2023 02:29:11 -0800 (PST) MIME-Version: 1.0 References: <20231212033259.189718-1-aford173@gmail.com> <20231212033259.189718-2-aford173@gmail.com> In-Reply-To: <20231212033259.189718-2-aford173@gmail.com> From: Adam Ford Date: Tue, 12 Dec 2023 04:29:00 -0600 Message-ID: Subject: Re: [PATCH 2/2] drm/bridge: samsung-dsim: Fix porch calcalcuation rounding To: dri-devel@lists.freedesktop.org Cc: aford@beaconembedded.com, Frieder Schrempf , Inki Dae , Jagan Teki , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Michael Tretter , Marco Felsch , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:29:25 -0800 (PST) On Mon, Dec 11, 2023 at 9:33=E2=80=AFPM Adam Ford wrot= e: > > When using video sync pulses, the HFP, HBP, and HSA are divided between > the available lanes if there is more than one lane. For certain > timings and lane configurations, the HFP may not be evenly divisible. > If the HFP is rounded down, it ends up being too small which can cause > some monitors to not sync properly. In these instances, adjust htotal > and hsync to round the HFP up, and recalculate the htotal. > For anyone who's following this, I added a note which I apparently forgot to save: This adds support for 720p60 in the i.MX8M Plus. NXP uses a look-up table in their downstream code to accomplish this. Using this calculation, the driver can adjust without the need for a complicated table and should be flexible for different timings and resolutions depending on the monitor. I don't have a DSI analyzer, and this appears to only work on i.MX8M Plus but not Mini and Nano for some reason, despite their having a similar DSI bridge. When Frieder teste this, he reported no changes on the Kontrol BL i.MX8MM: "So at least there is no negative impact in this case" If someone else has an i.MX8MP, I would appreciate any feedback. thanks adam > Tested-by: Frieder Schrempf # Kontron BL i.= MX8MM with HDMI monitor > Signed-off-by: Adam Ford > > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/brid= ge/samsung-dsim.c > index 239d253a7d71..f5795da1d8bb 100644 > --- a/drivers/gpu/drm/bridge/samsung-dsim.c > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c > @@ -1628,6 +1628,27 @@ static int samsung_dsim_atomic_check(struct drm_br= idge *bridge, > adjusted_mode->flags |=3D (DRM_MODE_FLAG_PHSYNC | DRM_MOD= E_FLAG_PVSYNC); > } > > + /* > + * When using video sync pulses, the HFP, HBP, and HSA are divide= d between > + * the available lanes if there is more than one lane. For certa= in > + * timings and lane configurations, the HFP may not be evenly div= isible. > + * If the HFP is rounded down, it ends up being too small which c= an cause > + * some monitors to not sync properly. In these instances, adjust= htotal > + * and hsync to round the HFP up, and recalculate the htotal. Thr= ough trial > + * and error, it appears that the HBP and HSA do not appearto nee= d the same > + * correction that HFP does. > + */ > + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE && dsi->lane= s > 1) { > + int hfp =3D adjusted_mode->hsync_start - adjusted_mode->h= display; > + int remainder =3D hfp % dsi->lanes; > + > + if (remainder) { > + adjusted_mode->hsync_start +=3D remainder; > + adjusted_mode->hsync_end +=3D remainder; > + adjusted_mode->htotal +=3D remainder; > + } > + } > + > return 0; > } > > -- > 2.40.1 >