dri-devel Archive mirror
 help / color / mirror / Atom feed
From: Adam Ford <aford173@gmail.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: dri-devel@lists.freedesktop.org, marex@denx.de,
	aford@beaconembedded.com,
	 Frieder Schrempf <frieder.schrempf@kontron.de>,
	Inki Dae <inki.dae@samsung.com>,
	Jagan Teki <jagan@amarulasolutions.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>,
	Marco Felsch <m.felsch@pengutronix.de>,
	Michael Tretter <m.tretter@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 2/2] drm/bridge: samsung-dsim: Fix porch calcalcuation rounding
Date: Thu, 25 Apr 2024 15:30:02 -0500	[thread overview]
Message-ID: <CAHCN7xJRgW4Y3YML+tToPw1TgA3o158XCEUcb9p-S+nvDWgzRQ@mail.gmail.com> (raw)
In-Reply-To: <6fcfe1bb-a1e9-4d7c-aff7-e572bcdf5d31@samsung.com>

On Thu, Apr 25, 2024 at 4:19 AM Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
>
> On 12.02.2024 00:09, 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.
> > 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.
> >
> > Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> # Kontron BL i.MX8MM with HDMI monitor
> > Signed-off-by: Adam Ford <aford173@gmail.com>
>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

Thank you very much for testing!

>
> > ---
> > V2:  No changes
> >
> > diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> > index 8476650c477c..52939211fe93 100644
> > --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> > +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> > @@ -1606,6 +1606,27 @@ 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.
> > +      * 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. Through trial
> > +      * and error, it appears that the HBP and HSA do not appearto need the same
> > +      * correction that HFP does.
> > +      */
> > +     if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE && dsi->lanes > 1) {

Frieder  &  Marek S,

Marek V is proposing we eliminate the check against the flags and do
it unconditionally.  If I send you both a different patch, would you
be willing to try them on your platforms?  I don't want to risk
breaking a board.
I used the check above from the NXP downstream kernel, so it felt
safe, but I am not as familiar with the different DSI modes, so I am
not sure what the impact would be if this read:

 if (dsi->lanes > 1) {

Does anyone else have an opinion on this?
> > +             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;
> >   }
> >
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>

  reply	other threads:[~2024-04-25 20:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240211230943eucas1p23524077c0e8e7431c2af6f3153935bd5@eucas1p2.samsung.com>
2024-02-11 23:09 ` [PATCH V2 1/2] drm/bridge: samsung-dsim: Set P divider based on min/max of fin pll Adam Ford
2024-02-11 23:09   ` [PATCH V2 2/2] drm/bridge: samsung-dsim: Fix porch calcalcuation rounding Adam Ford
2024-04-16 12:15     ` Adam Ford
2024-04-21 14:06     ` Marek Vasut
2024-04-22 12:09       ` Adam Ford
2024-04-22 12:30         ` Marek Vasut
2024-04-22 13:04           ` Adam Ford
2024-04-22 19:43             ` Marek Vasut
2024-04-25  9:18     ` Marek Szyprowski
2024-04-25 20:30       ` Adam Ford [this message]
2024-04-26  5:28         ` Marek Szyprowski
2024-05-07  8:40         ` Frieder Schrempf
2024-02-27 22:22   ` [PATCH V2 1/2] drm/bridge: samsung-dsim: Set P divider based on min/max of fin pll Adam Ford
2024-04-21 14:05   ` Marek Vasut
2024-04-25  9:18   ` Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHCN7xJRgW4Y3YML+tToPw1TgA3o158XCEUcb9p-S+nvDWgzRQ@mail.gmail.com \
    --to=aford173@gmail.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford@beaconembedded.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=inki.dae@samsung.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=m.szyprowski@samsung.com \
    --cc=m.tretter@pengutronix.de \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marex@denx.de \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).