Message ID | 20231013031040.152282-1-aford173@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1635469vqb; Thu, 12 Oct 2023 20:11:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg1voGAah2E+SWjTe5KUwuWUnXVt9luxgm/qps58gkOPmJ6gRF6oVsx6ufYxdHG3ZYmelY X-Received: by 2002:a17:90a:4d88:b0:263:730b:f568 with SMTP id m8-20020a17090a4d8800b00263730bf568mr23874109pjh.3.1697166712515; Thu, 12 Oct 2023 20:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697166712; cv=none; d=google.com; s=arc-20160816; b=drZfvxW7QbPX11xFnLuptlvOOGQ0cbXiPttS0JWij1XfpWAFaDA1xUPCcG1VrtCDlG zekVcDVT9N2RxaBu06QjDcc4WuQEvJvfKgXh1bQA6WenrA9GZ1Xxh5YNY4l4EeHdgtAY YJKxAeXekX2SPFX6AVniaLHxUaENmNUYufSLCmQnvMJ84Y8RbqdnNkR87MTvWfrLd7+Y 6UU0HLZIU4zlaCGGG6x/uPTMKMfAr49iftIO1loSO9CmKZcnpUftk7hsxRuAwiNNj3Hs Qa3gqM8cCkUTnKv0GnSXSYoX29FuQ/ydvEz1ts3H0Q9ggcWD5W8QtKMwPY3D+0b+HKNl ja5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TsY2oClvKo7kprulGqoF1UimrGsaQgD/VvrbzM3GhTw=; fh=mr5UvqZFT8bLdAFWgU+qrcf+ch2f78vObBKRWP3GZTY=; b=LuQILsNrMW/ktwJL2E0/AXzRfR74ujQkxeoscXybm/NUxbJ413aFcFRa4ohfHiBaUM 5fDS5QFuoQmXVsu8tG/TSMl3JiaS+wulH/i2VFDOBQE5GMbkkEMb1gxzKqeyZTKgPqVL r6gQQ10L1X7J7XzJdF1UeKxprfbecoO4UVitKieIdZbStM6/CRA2iBpQKkJER6gUUJw6 mTFFRERq3QV8G9f04yLFZ/vL8146jQPNfv2OlBhgrzM3lvtqvwEy065dUdUGGdaf26zn uW6H+MphgL9IG2DVMtgB5hhTVJpckfiUU0Yrblu5/hk0s+MIijO7RDi+Gkjae1du+tfA HCJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PUrqbi3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m10-20020a17090b068a00b002791d79bbf9si3359681pjz.187.2023.10.12.20.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 20:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PUrqbi3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id F004780BEF21; Thu, 12 Oct 2023 20:11:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbjJMDK7 (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Thu, 12 Oct 2023 23:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjJMDKz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Oct 2023 23:10:55 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC97991 for <linux-kernel@vger.kernel.org>; Thu, 12 Oct 2023 20:10:52 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-79fe6da0049so66330739f.1 for <linux-kernel@vger.kernel.org>; Thu, 12 Oct 2023 20:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697166652; x=1697771452; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TsY2oClvKo7kprulGqoF1UimrGsaQgD/VvrbzM3GhTw=; b=PUrqbi3m8OQ7oHAEsYLnI2dw/vsVL3p1196gqwLQH0blKVa/A+UDXq9Mgn7d4M0a6P z1Zw3zlqkUpkq+iqTJMtP84DaLv6Ty5APtrKYBchlr/n8z6+LMkNnRe080tjjN2l+xNR dVIYlYcT/r1uvkuNiQleCJ0SzXJ94kTS6gKmZkDm7TQ5M/hz4taOqjwBgjd1v1jl4j/8 7O9oEgKEyC4hvZYWCV8HLJBeT1NHqVbjm04H2LdKocJ21pLxGj5HxhW9j1u1l4wgHkXr w0PQ+lUa5E0n5VK7+CfkBuTlA866wgKLtChwTiZte69+Lq13+dKzVAgjeUdCy0iYxkd0 eEpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697166652; x=1697771452; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TsY2oClvKo7kprulGqoF1UimrGsaQgD/VvrbzM3GhTw=; b=nfNheQ65aQZN8WQ20mqOS2h5IUt+MNwOdqzV3ms1oEGHdC8KwjNwPXRxqjyWL+CES2 vS5jbhS/5GXxy/7Sk+k2qSPioZC74AYJ7UGBcpyQg/LZHArLULPzzuJ63G6YddEawdHA b6snzGjsx56+7T8s651T72LBJqCT2t+v2kvnTMp4zDyGkMfjXQ/eEe5H6fId1vAoFnaE TqUb/TPQEMhoentaJTtDIjUdTKX/V1ebGvjawXKJPBdJIlZVCruO12vXm78eFDv5F6hf OjGI7S0rbVZta+8MCA+fcAG5VTvWgmEm+GVCjnEcvnziGOAE+OTIWiAs9czB7KwTjdKa W57g== X-Gm-Message-State: AOJu0YzHsBexohDX4ufFiViexS7z8PHMSsYo7NCej0RrvFxHfbwA/Hup l1THDje8hwTSO5xvRts5bbM= X-Received: by 2002:a05:6602:39a:b0:790:f735:4d30 with SMTP id f26-20020a056602039a00b00790f7354d30mr30694824iov.13.1697166652023; Thu, 12 Oct 2023 20:10:52 -0700 (PDT) Received: from aford-System-Version.lan ([2601:447:d002:5be:4979:b5dc:3d65:edd2]) by smtp.gmail.com with ESMTPSA id n3-20020a5e8c03000000b0079ab2787139sm4691058ioj.7.2023.10.12.20.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 20:10:51 -0700 (PDT) From: Adam Ford <aford173@gmail.com> To: dri-devel@lists.freedesktop.org Cc: aford@beaconembedded.com, marex@denx.de, Adam Ford <aford173@gmail.com>, Inki Dae <inki.dae@samsung.com>, Jagan Teki <jagan@amarulasolutions.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, linux-kernel@vger.kernel.org Subject: [RFC] drm: bridge: samsung-dsim: Recalculate timings when rounding HFP up Date: Thu, 12 Oct 2023 22:10:40 -0500 Message-Id: <20231013031040.152282-1-aford173@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 20:11:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779608282600392585 X-GMAIL-MSGID: 1779608282600392585 |
Series |
[RFC] drm: bridge: samsung-dsim: Recalculate timings when rounding HFP up
|
|
Commit Message
Adam Ford
Oct. 13, 2023, 3:10 a.m. UTC
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
and it gets rounded down which can cause certain resolutions and
refresh rates to not sync.
ie. 720p60 on some monitors show hss of 1390 and hdisplay of 1280. This
yields an HFP of 110. When taking the HFP of 110 divides along 4 lanes,
the result is 27.5 which rounds down to 27 and causes some monitors not
to sync.
The solultion is to round HFP up by finding the remainder of HFP /
the number of lanes and increasing the hsync_start, hsync_end, and
htotal to compensate when there is a remainder.
Signed-off-by: Adam Ford <aford173@gmail.com>
---
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.
Comments
Hi Adam, On 13.10.23 05:10, Adam Ford wrote: > 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 > and it gets rounded down which can cause certain resolutions and > refresh rates to not sync. > > ie. 720p60 on some monitors show hss of 1390 and hdisplay of 1280. This > yields an HFP of 110. When taking the HFP of 110 divides along 4 lanes, > the result is 27.5 which rounds down to 27 and causes some monitors not > to sync. > > The solultion is to round HFP up by finding the remainder of HFP / > the number of lanes and increasing the hsync_start, hsync_end, and > htotal to compensate when there is a remainder. > > Signed-off-by: Adam Ford <aford173@gmail.com> > --- > 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. I just want to report that I have tested this patch (on top of current linux-next) on our Kontron BL i.MX8MM board with the ADV7535 bridge and I don't see any change when trying the 30 different modes the monitor reports as supported. 18 of those work and 12 don't work. So at least there is no negative impact in this case. Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> # Kontron BL i.MX8MM with HDMI monitor Thanks Frieder
On Thu, Oct 26, 2023 at 1:12 PM Frieder Schrempf <frieder.schrempf@kontron.de> wrote: > > Hi Adam, > > On 13.10.23 05:10, Adam Ford wrote: > > 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 > > and it gets rounded down which can cause certain resolutions and > > refresh rates to not sync. > > > > ie. 720p60 on some monitors show hss of 1390 and hdisplay of 1280. This > > yields an HFP of 110. When taking the HFP of 110 divides along 4 lanes, > > the result is 27.5 which rounds down to 27 and causes some monitors not > > to sync. > > > > The solultion is to round HFP up by finding the remainder of HFP / > > the number of lanes and increasing the hsync_start, hsync_end, and > > htotal to compensate when there is a remainder. > > > > Signed-off-by: Adam Ford <aford173@gmail.com> > > --- > > 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. > > I just want to report that I have tested this patch (on top of current > linux-next) on our Kontron BL i.MX8MM board with the ADV7535 bridge and > I don't see any change when trying the 30 different modes the monitor > reports as supported. 18 of those work and 12 don't work. Thanks for testing this. I didn't see any regressions on my Mini or Nano either, but I did see the 720p60 now works on i.MX8M Plus (but not on Mini/Nano). I am not sure why, and I don't have a DSI analyzer. > > So at least there is no negative impact in this case. At least nothing broke. :-) > > Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> # Kontron BL > i.MX8MM with HDMI monitor I'll add your T-b when I post it again. > > Thanks > Frieder
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index be5914caa17d..5564e85f6b63 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1628,6 +1628,26 @@ static int samsung_dsim_atomic_check(struct drm_bridge *bridge, adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); } + /* + * 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. + * This can cause HFP to round down, and it ends up being too small which can + * cause some monitors to not sync properly. In these instances, round HFP up + * and adjust htotal to compensate. Through trial and error, it appears that + * the HBP and HSA do not appear to need the same correction that HFP does. + */ + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE && dsi->lanes > 1) { + int hfp = adjusted_mode->hsync_start - adjusted_mode->hdisplay; + int remainder = hfp % dsi->lanes; + + if (remainder) { + adjusted_mode->hsync_start += remainder; + adjusted_mode->hsync_end += remainder; + adjusted_mode->htotal += remainder; + } + } + return 0; }