Re: [EXT] Re: [PATCH v2 06/15] drm/mxsfb: Update mxsfb with additional pixel formats
From: Robert Chiras
Date: Wed Aug 14 2019 - 10:59:34 EST
Hi Daniel,
On Mi, 2019-08-14 at 12:44 +0100, Daniel Stone wrote:
> Hi Robert,
>
> On Wed, 14 Aug 2019 at 11:49, Robert Chiras <robert.chiras@xxxxxxx>
> wrote:
> >
> > +ÂÂÂÂÂÂÂcase DRM_FORMAT_BGR565: /* BG16 */
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (mxsfb->devdata->ipversion < 4)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂgoto err;
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂwritel(CTRL2_ODD_LINE_PATTERN(CTRL2_LINE_PATTERN_BG
> > R) |
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂCTRL2_EVEN_LINE_PATTERN(CTRL2_LINE_PATTERN_
> > BGR),
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmxsfb->base + LCDC_V4_CTRL2 + REG_SET);
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* Fall through */
> > +ÂÂÂÂÂÂÂcase DRM_FORMAT_RGB565: /* RG16 */
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂctrl |= CTRL_SET_WORD_LENGTH(0);
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂctrl &= ~CTRL_DF16;
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂctrl1 |= CTRL1_SET_BYTE_PACKAGING(0xf);
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> For non-BGR formats, do you need to write RGB line-pattern back to
> the
> CTRL2 register? Otherwise, if you start with BGR565 then switch back
> to RGB565, presumably CTRL2 would still be programmed for BGR so you
> would display inverted channels.
The LINE_PATTERN fromÂLCDC_V4_CTRL2 register is cleared above, with
this code:
+ÂÂÂÂÂÂÂif (mxsfb->devdata->ipversion >= 4)
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂwritel(CTRL2_ODD_LINE_PATTERN(CTRL2_LINE_PATTERN_CLR) |
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂCTRL2_EVEN_LINE_PATTERN(CTRL2_LINE_PATTERN_CLR),
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmxsfb->base + LCDC_V4_CTRL2 + REG_CLR);
>
> Same goes for all the other BGR/RGB format pairs below.
>
> Cheers,
> Daniel
Thanks,
Robert