Hi Stefan,
On Tue, Mar 24, 2020 at 12:48:17AM +0100, Stefan Agner wrote:
> On 2020-03-09 20:52, Laurent Pinchart wrote:
> > The LCDIF in the i.MX6SX and i.MX7 have a second plane called the alpha
> > plane. Support it.
> >
> > Signed-off-by: Laurent Pinchart
> > ---
> > drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +
> > drivers/gpu/drm/mxsfb/mxsfb_drv.h | 16 ++--
> > drivers/gpu/drm/mxsfb/mxsfb_kms.c | 129 +
> > drivers/gpu/drm/mxsfb/mxsfb_regs.h | 22 +
> > 4 files changed, 149 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > index ed8e3f7bc27c..ab3a212375f1 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > @@ -49,6 +49,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
> > .next_buf = LCDC_V3_NEXT_BUF,
> > .hs_wdth_mask = 0xff,
> > .hs_wdth_shift = 24,
> > + .has_overlay= false,
> > },
> > [MXSFB_V4] = {
> > .transfer_count = LCDC_V4_TRANSFER_COUNT,
> > @@ -56,6 +57,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
> > .next_buf = LCDC_V4_NEXT_BUF,
> > .hs_wdth_mask = 0x3fff,
> > .hs_wdth_shift = 18,
> > + .has_overlay= false,
> > },
> > [MXSFB_V6] = {
> > .transfer_count = LCDC_V4_TRANSFER_COUNT,
> > @@ -63,6 +65,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
> > .next_buf = LCDC_V4_NEXT_BUF,
> > .hs_wdth_mask = 0x3fff,
> > .hs_wdth_shift = 18,
> > + .has_overlay= true,
> > },
> > };
> >
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
> > b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
> > index 607a6a5e6be3..399d23e91ed1 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
> > @@ -16,11 +16,12 @@
> > struct clk;
> >
> > struct mxsfb_devdata {
> > - unsigned int transfer_count;
> > - unsigned int cur_buf;
> > - unsigned int next_buf;
> > - unsigned int hs_wdth_mask;
> > - unsigned int hs_wdth_shift;
> > + unsigned inttransfer_count;
> > + unsigned intcur_buf;
> > + unsigned intnext_buf;
> > + unsigned inths_wdth_mask;
> > + unsigned inths_wdth_shift;
>
> This seems an unrelated change, can you split that out?
OK.
> > + boolhas_overlay;
> > };
> >
> > struct mxsfb_drm_private {
> > @@ -32,7 +33,10 @@ struct mxsfb_drm_private {
> > struct clk *clk_disp_axi;
> >
> > struct drm_device *drm;
> > - struct drm_planeplane;
> > + struct {
> > + struct drm_planeprimary;
> > + struct drm_planeoverlay;
> > + } planes;
> > struct drm_crtc crtc;
> > struct drm_encoder encoder;
> > struct drm_connector*connector;
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > index f81f8c222c13..c9c394f7cbe2 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > @@ -169,9 +169,9 @@ static int mxsfb_reset_block(struct
> > mxsfb_drm_private *mxsfb)
> > return clear_poll_bit(mxsfb->base + LCDC_CTRL, CTRL_CLKGATE);
> > }
> >
> > -static dma_addr_t mxsfb_get_fb_paddr(struct mxsfb_drm_private *mxsfb)
> > +static dma_addr_t mxsfb_get_fb_paddr(struct drm_plane *plane)
> > {
> > - struct drm_framebuffer *fb = mxsfb->plane.state->fb;
> > + struct drm_framebuffer *fb = plane->state->fb;
> > struct drm_gem_cma_object *gem;
> >
> > if (!fb)
> > @@ -206,6 +206,9 @@ static void mxsfb_crtc_mode_set_nofb(struct
> > mxsfb_drm_private *mxsfb)
> > /* Clear the FIFOs */
> > writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
> >
> > + if (mxsfb->devdata->has_overlay)
> > + writel(0, mxsfb->base + LCDC_AS_CTRL);
> > +
> > mxsfb_set_formats(mxsfb);
> >
> > clk_set_rate(mxsfb->clk, m->crtc_clock * 1000);
> > @@ -313,7 +316,7 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc
> > *crtc,
> > mxsfb_crtc_mode_set_nofb(mxsfb);
> >
> > /* Write cur_buf as well to avoid an initial corrupt frame */
> > - paddr = mxsfb_get_fb_paddr(mxsfb);
> > + paddr = mxsfb_get_fb_paddr(crtc->primary);
> > if (paddr) {
> > writel(paddr, mxsfb->base + mxsfb->devdata->cur_buf);
> > writel(paddr, mxsfb->base + mxsfb->devdata->next_buf);
> > @@ -410,20 +413,85 @@ static int mxsfb_plane_atomic_check(struct
> > drm_plane *plane,
> >false, true);
> > }
> >
> > -static void mxsfb_plane_atomic_update(struct drm_plane *plane,
> > - struct drm_plane_state *old_pstate)
> > +static void mxsfb_plane_primary_atomic_update(struct