Re: [PATCH v3 3/8] drm/sun4i: dsi: Enforce boundaries on the start delay

Maxime Ripard
2019-02-14T09:42:29Z

[-- Attachment #1.1: Type: text/plain, Size: 1827 bytes --]

hi,

On Tue, Feb 12, 2019 at 04:30:33PM +0100, Paul Kocialkowski wrote:
> Hi,
>
> On Mon, 2019-02-11 at 15:41 +0100, Maxime Ripard wrote:
> > The Allwinner BSP makes sure that we don't end up with a null start delay
> > or with a delay larger than vtotal.
> >
> > The former condition is likely to happen now with the reworked start delay,
> > so make sure we enforce the same boundaries.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
>
> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Thanks!

> > ---
> > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > index 9471fa695ec7..506f2e8cf454 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -358,8 +358,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
> > struct drm_display_mode *mode)
> > {
> > u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
> > + u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
> >
> > - return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
> > + if (delay > mode->vtotal)
> > + delay = delay % mode->vtotal;
>
> I wonder whether delay == mode->vtotal would make sense at all. If not,
> then we can just apply the modulo unconditionally. But in doubt, let's
> keep things this way.

I guess that situation can happen, especially with the start clamping.

But even without it, it can happen when mode->vtotal - mode->vsync_end
(so the backporch) is equal to 10.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]