public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: CK Hu <ck.hu@mediatek.com>
Cc: Daniele Castagna <dcastagna@chromium.org>,
	dri-devel@lists.freedesktop.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Miguel Casas <mcasas@chromium.org>,
	Sean Paul <seanpaul@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Fritz Koenig <frkoenig@chromium.org>,
	linux-mediatek@lists.infradead.org, Sean Paul <sean@poorly.run>,
	linux-arm-kernel@lists.infradead.org,
	Mark Yacoub <markyacoub@google.com>
Subject: Re: [PATCH] drm/mediatek: Support reflect-y plane rotation
Date: Mon, 4 Nov 2019 16:20:24 -0500	[thread overview]
Message-ID: <20191104212024.GA63329@art_vandelay> (raw)
In-Reply-To: <1572654319.24679.4.camel@mtksdaap41>

On Sat, Nov 02, 2019 at 08:25:19AM +0800, CK Hu wrote:
> Hi, Sean:
> 
> On Fri, 2019-11-01 at 09:26 -0400, Sean Paul wrote:
> > From: Sean Paul <seanpaul@chromium.org>
> > 
> > Expose the rotation property and handle REFLECT_Y rotations.
> > 
> > Cc: Fritz Koenig <frkoenig@chromium.org>
> > Cc: Daniele Castagna <dcastagna@chromium.org>
> > Cc: Miguel Casas <mcasas@chromium.org>
> > Cc: Mark Yacoub <markyacoub@google.com>
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > ---
> > 
> > The hardware also supports REFLECT_X, but I just could not figure out
> > how to get it working. If someone is interested in getting this going,
> > I'm happy to share notes and my WIP patch. For now, though, I actually
> > only need y-flip so I'm giving up on x-flip.
> 
> Does [1] give you any hint for x-flip, or that patch is incorrect?
> 
> [1]
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1533519
> 

Hi CK,
Thank you for the pointer, that did help! That patch is slightly incorrect, but
pointed me to the issue I was having with REFLECT_X. I'll upload a new set with
REFLECT_X and ROTATE_180 support shortly.

Sean

> > 
> > 
> >  drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  6 ++++++
> >  drivers/gpu/drm/mediatek/mtk_drm_plane.c | 11 ++++++++++-
> >  drivers/gpu/drm/mediatek/mtk_drm_plane.h |  1 +
> >  3 files changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > index 14878ebf59d7..6505479ee506 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > @@ -50,6 +50,7 @@
> >  					OVL_CON_CLRFMT_RGB : 0)
> >  #define	OVL_CON_AEN		BIT(8)
> >  #define	OVL_CON_ALPHA		0xff
> > +#define	OVL_CON_VIRT_FLIP	BIT(9)
> >  
> >  struct mtk_disp_ovl_data {
> >  	unsigned int addr;
> > @@ -229,6 +230,11 @@ static void mtk_ovl_layer_config(struct mtk_ddp_comp *comp, unsigned int idx,
> >  	if (idx != 0)
> >  		con |= OVL_CON_AEN | OVL_CON_ALPHA;
> >  
> > +	if (pending->rotation & DRM_MODE_REFLECT_Y) {
> > +		con |= OVL_CON_VIRT_FLIP;
> > +		addr += (pending->height - 1) * pending->pitch;
> > +	}
> > +
> >  	writel_relaxed(con, comp->regs + DISP_REG_OVL_CON(idx));
> >  	writel_relaxed(pitch, comp->regs + DISP_REG_OVL_PITCH(idx));
> >  	writel_relaxed(src_size, comp->regs + DISP_REG_OVL_SRC_SIZE(idx));
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> > index 584a9ecadce6..4d8f2b55334b 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> > @@ -88,6 +88,9 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
> >  	if (!fb)
> >  		return 0;
> >  
> > +	if (fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0) != 0)
> > +		return -EINVAL;
> 
> If this patch does not support all color format, please describe what
> color format does this patch support, so others could try to make the
> rest color format work.
> 
> Regards,
> CK
> 
> > +
> >  	if (!state->crtc)
> >  		return 0;
> >  
> > @@ -132,6 +135,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
> >  	state->pending.y = plane->state->dst.y1;
> >  	state->pending.width = drm_rect_width(&plane->state->dst);
> >  	state->pending.height = drm_rect_height(&plane->state->dst);
> > +	state->pending.rotation = plane->state->rotation;
> >  	wmb(); /* Make sure the above parameters are set before update */
> >  	state->pending.dirty = true;
> >  }
> > @@ -166,7 +170,12 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
> >  		return err;
> >  	}
> >  
> > -	drm_plane_helper_add(plane, &mtk_plane_helper_funcs);
> > +	err = drm_plane_create_rotation_property(plane, 0,
> > +						 DRM_MODE_ROTATE_0 |
> > +						 DRM_MODE_REFLECT_Y);
> > +	if (err)
> > +		DRM_INFO("Create rotation property failed, continuing...\n");
> >  
> > +	drm_plane_helper_add(plane, &mtk_plane_helper_funcs);
> >  	return 0;
> >  }
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> > index 6f842df722c7..83b634a997cc 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> > @@ -20,6 +20,7 @@ struct mtk_plane_pending_state {
> >  	unsigned int			y;
> >  	unsigned int			width;
> >  	unsigned int			height;
> > +	unsigned int			rotation;
> >  	bool				dirty;
> >  };
> >  
> 
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-11-04 21:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 13:26 [PATCH] drm/mediatek: Support reflect-y plane rotation Sean Paul
2019-11-01 14:24 ` Mark Yacoub
2019-11-02  0:25 ` CK Hu
2019-11-04 21:20   ` Sean Paul [this message]
2019-11-05  1:34 ` CK Hu

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=20191104212024.GA63329@art_vandelay \
    --to=sean@poorly.run \
    --cc=ck.hu@mediatek.com \
    --cc=dcastagna@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frkoenig@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=markyacoub@google.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mcasas@chromium.org \
    --cc=p.zabel@pengutronix.de \
    --cc=seanpaul@chromium.org \
    /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