Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1643918
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 14/21] drm/sun4i: tcon: multiply the vtotal when not in interlace |
| Date | 2017-05-18 10:00 +0200 |
| Message-ID | <tIovL-7em-1@gated-at.bofh.it> (permalink) |
| References | <tI1Sy-ck-7@gated-at.bofh.it> <tI1Sy-ck-25@gated-at.bofh.it> <tI3Un-1pv-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Wed, May 17, 2017 at 05:50:45PM +0800, Chen-Yu Tsai wrote:
> On Wed, May 17, 2017 at 3:40 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > It appears that the total vertical resolution needs to be doubled when
> > we're not in interlaced. Make sure that is the case.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> > drivers/gpu/drm/sun4i/sun4i_tcon.c | 25 +++++++++++++++++++++----
> > 1 file changed, 21 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index 62e254aedb57..a0f9a8a516c7 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -153,7 +153,7 @@ static int sun4i_tcon_get_clk_delay(struct drm_display_mode *mode,
> > void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
> > struct drm_display_mode *mode)
> > {
> > - unsigned int bp, hsync, vsync;
> > + unsigned int bp, hsync, vsync, vtotal;
> > u8 clk_delay;
> > u32 val = 0;
> >
> > @@ -192,9 +192,26 @@ void sun4i_tcon0_mode_set(struct sun4i_tcon *tcon,
> > DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
> > mode->crtc_vtotal, bp);
> >
> > + /*
> > + * The vertical resolution needs to be doubled in all
> > + * cases. We could use crtc_vtotal and always multiply by two,
> > + * but that leads to a rounding error in interlace when vtotal
> > + * is odd.
> > + *
> > + * This happens with TV's PAL for example, where vtotal will
> > + * be 625, crtc_vtotal 312, and thus crtc_vtotal * 2 will be
> > + * 624, which apparently confuses the hardware.
> > + *
> > + * To work around this, we will always use vtotal, and
> > + * multiply by two only if we're not in interlace.
> > + */
> > + vtotal = mode->vtotal;
> > + if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
> > + vtotal = vtotal * 2;
> > +
> > /* Set vertical display timings */
> > regmap_write(tcon->regs, SUN4I_TCON0_BASIC2_REG,
> > - SUN4I_TCON0_BASIC2_V_TOTAL(mode->crtc_vtotal * 2) |
> > + SUN4I_TCON0_BASIC2_V_TOTAL(vtotal) |
> > SUN4I_TCON0_BASIC2_V_BACKPORCH(bp));
> >
> > /* Set Hsync and Vsync length */
> > @@ -279,9 +296,9 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
> > /* Set vertical display timings */
> > bp = mode->crtc_vtotal - mode->crtc_vsync_start;
> > DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
> > - mode->vtotal, bp);
> > + mode->crtc_vtotal, bp);
>
> You should duplicate the logic from channel 0 to channel 1.
> In fact, interlaced modes happen predominantly on channel 1,
> for composite and HDMI modes.
Gaah, you're right, this was obviously meant for the channel 1.. I'll
resend.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3 14/21] drm/sun4i: tcon: multiply the vtotal when not in interlace Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-17 09:50 +0200
Re: [PATCH v3 14/21] drm/sun4i: tcon: multiply the vtotal when not in interlace Chen-Yu Tsai <wens@csie.org> - 2017-05-17 12:00 +0200
Re: [PATCH v3 14/21] drm/sun4i: tcon: multiply the vtotal when not in interlace Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-18 10:00 +0200
csiph-web