mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jernej Škrabec" <jernej.skrabec@siol.net>
To: Maxime Ripard <mripard@kernel.org>
Cc: roman.stratiienko@globallogic.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/sun4i: Use vi plane as primary
Date: Thu, 19 Sep 2019 20:15:49 +0200	[thread overview]
Message-ID: <104595190.vWb6g8xIPX@jernej-laptop> (raw)
In-Reply-To: <20190919171754.x6lq73cctnqsjr4v@gilmour>

Dne četrtek, 19. september 2019 ob 19:17:54 CEST je Maxime Ripard napisal(a):
> Hi,
> 
> On Thu, Sep 19, 2019 at 03:37:03PM +0300, roman.stratiienko@globallogic.com 
wrote:
> > From: Roman Stratiienko <roman.stratiienko@globallogic.com>
> > 
> > DE2.0 blender does not take into the account alpha channel of vi layer.
> > Thus makes overlaying of this layer totally opaque.
> > Using vi layer as bottom solves this issue.

What issue? Overlays don't have to be "full screen", thus missing support for 
alpha blending doesn't make it less valuable. And VI planes are already placed 
at the bottom (zpos = 0).

> > 
> > Tested on Android.
> > 
> > Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
> 
> It sounds like a workaround more than an actual fix.
> 
> If the VI planes can't use the alpha, then we should just stop
> reporting that format.
> 
> Jernej, what do you think?

Commit message is misleading. What this commit actually does is moving primary 
plane from first UI plane to bottom most plane, i.e. first VI plane. However, VI 
planes are scarce resource, almost all mixers have only one. I wouldn't set it 
as primary, because it's the only one which provide support for YUV formats. 
That could be used for example by video player for zero-copy rendering. 
Probably most apps wouldn't touch it if it was primary (that's usually 
reserved for window manager, if used).

I left few formats with alpha channel exposed by VI planes, just because they 
don't have equivalent format without alpha. But I'm fine with removing them if 
you all agree on that.

Best regards,
Jernej

> 
> Maxime
> 
> > ---
> > 
> >  drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 33 -----------------------
> >  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 36 +++++++++++++++++++++++++-
> >  2 files changed, 35 insertions(+), 34 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> > b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index dd2a1c851939..25183badc85f
> > 100644
> > --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> > +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
> > @@ -99,36 +99,6 @@ static int sun8i_ui_layer_update_coord(struct
> > sun8i_mixer *mixer, int channel,> 
> >  	insize = SUN8I_MIXER_SIZE(src_w, src_h);
> >  	outsize = SUN8I_MIXER_SIZE(dst_w, dst_h);
> > 
> > -	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
> > -		bool interlaced = false;
> > -		u32 val;
> > -
> > -		DRM_DEBUG_DRIVER("Primary layer, updating global size 
W: %u H: %u\n",
> > -				 dst_w, dst_h);
> > -		regmap_write(mixer->engine.regs,
> > -			     SUN8I_MIXER_GLOBAL_SIZE,
> > -			     outsize);
> > -		regmap_write(mixer->engine.regs,
> > -			     SUN8I_MIXER_BLEND_OUTSIZE(bld_base), 
outsize);
> > -
> > -		if (state->crtc)
> > -			interlaced = state->crtc->state-
>adjusted_mode.flags
> > -				& DRM_MODE_FLAG_INTERLACE;
> > -
> > -		if (interlaced)
> > -			val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED;
> > -		else
> > -			val = 0;
> > -
> > -		regmap_update_bits(mixer->engine.regs,
> > -				   
SUN8I_MIXER_BLEND_OUTCTL(bld_base),
> > -				   
SUN8I_MIXER_BLEND_OUTCTL_INTERLACED,
> > -				   val);
> > -
> > -		DRM_DEBUG_DRIVER("Switching display mixer interlaced 
mode %s\n",
> > -				 interlaced ? "on" : "off");
> > -	}
> > -
> > 
> >  	/* Set height and width */
> >  	DRM_DEBUG_DRIVER("Layer source offset X: %d Y: %d\n",
> >  	
> >  			 state->src.x1 >> 16, state->src.y1 >> 16);
> > 
> > @@ -349,9 +319,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct
> > drm_device *drm,> 
> >  	if (!layer)
> >  	
> >  		return ERR_PTR(-ENOMEM);
> > 
> > -	if (index == 0)
> > -		type = DRM_PLANE_TYPE_PRIMARY;
> > -
> > 
> >  	/* possible crtcs are set later */
> >  	ret = drm_universal_plane_init(drm, &layer->plane, 0,
> >  	
> >  				       &sun8i_ui_layer_funcs,
> > 
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 07c27e6a4b77..49c4074e164f
> > 100644
> > --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> > @@ -116,6 +116,36 @@ static int sun8i_vi_layer_update_coord(struct
> > sun8i_mixer *mixer, int channel,> 
> >  	insize = SUN8I_MIXER_SIZE(src_w, src_h);
> >  	outsize = SUN8I_MIXER_SIZE(dst_w, dst_h);
> > 
> > +	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
> > +		bool interlaced = false;
> > +		u32 val;
> > +
> > +		DRM_DEBUG_DRIVER("Primary layer, updating global size 
W: %u H: %u\n",
> > +				 dst_w, dst_h);
> > +		regmap_write(mixer->engine.regs,
> > +			     SUN8I_MIXER_GLOBAL_SIZE,
> > +			     outsize);
> > +		regmap_write(mixer->engine.regs,
> > +			     SUN8I_MIXER_BLEND_OUTSIZE(bld_base), 
outsize);
> > +
> > +		if (state->crtc)
> > +			interlaced = state->crtc->state-
>adjusted_mode.flags
> > +				& DRM_MODE_FLAG_INTERLACE;
> > +
> > +		if (interlaced)
> > +			val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED;
> > +		else
> > +			val = 0;
> > +
> > +		regmap_update_bits(mixer->engine.regs,
> > +				   
SUN8I_MIXER_BLEND_OUTCTL(bld_base),
> > +				   
SUN8I_MIXER_BLEND_OUTCTL_INTERLACED,
> > +				   val);
> > +
> > +		DRM_DEBUG_DRIVER("Switching display mixer interlaced 
mode %s\n",
> > +				 interlaced ? "on" : "off");
> > +	}
> > +
> > 
> >  	/* Set height and width */
> >  	DRM_DEBUG_DRIVER("Layer source offset X: %d Y: %d\n",
> >  	
> >  			 (state->src.x1 >> 16) & ~(format->hsub - 
1),
> > 
> > @@ -445,6 +475,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct
> > drm_device *drm,> 
> >  					       struct 
sun8i_mixer *mixer,
> >  					       int index)
> >  
> >  {
> > 
> > +	enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;
> > 
> >  	struct sun8i_vi_layer *layer;
> >  	unsigned int plane_cnt;
> >  	int ret;
> > 
> > @@ -453,12 +484,15 @@ struct sun8i_vi_layer
> > *sun8i_vi_layer_init_one(struct drm_device *drm,> 
> >  	if (!layer)
> >  	
> >  		return ERR_PTR(-ENOMEM);
> > 
> > +	if (index == 0)
> > +		type = DRM_PLANE_TYPE_PRIMARY;
> > +
> > 
> >  	/* possible crtcs are set later */
> >  	ret = drm_universal_plane_init(drm, &layer->plane, 0,
> >  	
> >  				       &sun8i_vi_layer_funcs,
> >  				       sun8i_vi_layer_formats,
> >  				       
ARRAY_SIZE(sun8i_vi_layer_formats),
> > 
> > -				       NULL, 
DRM_PLANE_TYPE_OVERLAY, NULL);
> > +				       NULL, type, NULL);
> > 
> >  	if (ret) {
> >  	
> >  		dev_err(drm->dev, "Couldn't initialize layer\n");
> >  		return ERR_PTR(ret);
> > 
> > --
> > 2.17.1





  reply	other threads:[~2019-09-19 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 12:37 roman.stratiienko
2019-09-19 17:17 ` Maxime Ripard
2019-09-19 18:15   ` Jernej Škrabec [this message]
2019-09-20  6:12     ` Maxime Ripard
     [not found]     ` <CAODwZ7sPG+_YvnLBU11uYaNpDFthLOkcYXsd=ZQtM+88+cPi9A@mail.gmail.com>
2019-09-19 21:09       ` Jernej Škrabec
2019-09-20  6:18       ` Maxime Ripard
2019-09-20 20:09         ` Roman Stratiienko
2019-09-20  7:54     ` Roman Stratiienko

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=104595190.vWb6g8xIPX@jernej-laptop \
    --to=jernej.skrabec@siol.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=roman.stratiienko@globallogic.com \
    /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

all inboxes | Powered by JetHome®