<div dir="auto">Hello guys,<div dir="auto"><br></div><div dir="auto">Actually, I beleive this is True solution, and current one is wrong. Let me explain why. </div><div dir="auto"><br></div><div dir="auto">De2. 0 was designed to match Android hwcomposer hal requirements IMO. </div><div dir="auto">You can easily agree with this conclusion by comparing Composer HAL and De2. 0 hardware manuals. </div><div dir="auto"><br></div><div dir="auto">I faced at least 4 issues when try to run Android using the mainline kernel sun8i mixer implementation. Current one, missing pixel formats (my previous patch), missing plane alpha and rotation properties. I plan to fix it and also send appropriate solution to the upstream. </div><div dir="auto"><br></div><div dir="auto">To achieve optimal UI performance Android requires at least 4 ui layers to make screen composition. Current patch enables 4th plane usable.</div><div dir="auto"><br></div><div dir="auto">As for using vi plane to display video. I assume that some of current users may have regression in their software, but it could be easily fixed. For example if vi layer isn't fullscreen and should be on top of the other layers, it can actually be placed on the bottom and overlayed with pictures with transparent rectangles in video region. </div><div dir="auto">But I assume most of users such as browser etc. uses GPU for that. </div><div dir="auto"><br></div><div dir="auto">And if you are watching fullscreen video, I can imagine only subtitles layer and advertizing layers on top of the video layers.</div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">чт, 19 сент. 2019 г., 21:15 Jernej Škrabec <<a href="mailto:jernej.skrabec@siol.net">jernej.skrabec@siol.net</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dne četrtek, 19. september 2019 ob 19:17:54 CEST je Maxime Ripard napisal(a):<br>
> Hi,<br>
> <br>
> On Thu, Sep 19, 2019 at 03:37:03PM +0300, <a href="mailto:roman.stratiienko@globallogic.com" target="_blank" rel="noreferrer">roman.stratiienko@globallogic.com</a> <br>
wrote:<br>
> > From: Roman Stratiienko <<a href="mailto:roman.stratiienko@globallogic.com" target="_blank" rel="noreferrer">roman.stratiienko@globallogic.com</a>><br>
> > <br>
> > DE2.0 blender does not take into the account alpha channel of vi layer.<br>
> > Thus makes overlaying of this layer totally opaque.<br>
> > Using vi layer as bottom solves this issue.<br>
<br>
What issue? Overlays don't have to be "full screen", thus missing support for <br>
alpha blending doesn't make it less valuable. And VI planes are already placed <br>
at the bottom (zpos = 0).<br>
<br>
> > <br>
> > Tested on Android.<br>
> > <br>
> > Signed-off-by: Roman Stratiienko <<a href="mailto:roman.stratiienko@globallogic.com" target="_blank" rel="noreferrer">roman.stratiienko@globallogic.com</a>><br>
> <br>
> It sounds like a workaround more than an actual fix.<br>
> <br>
> If the VI planes can't use the alpha, then we should just stop<br>
> reporting that format.<br>
> <br>
> Jernej, what do you think?<br>
<br>
Commit message is misleading. What this commit actually does is moving primary <br>
plane from first UI plane to bottom most plane, i.e. first VI plane. However, VI <br>
planes are scarce resource, almost all mixers have only one. I wouldn't set it <br>
as primary, because it's the only one which provide support for YUV formats. <br>
That could be used for example by video player for zero-copy rendering. <br>
Probably most apps wouldn't touch it if it was primary (that's usually <br>
reserved for window manager, if used).<br>
<br>
I left few formats with alpha channel exposed by VI planes, just because they <br>
don't have equivalent format without alpha. But I'm fine with removing them if <br>
you all agree on that.<br>
<br>
Best regards,<br>
Jernej<br>
<br>
> <br>
> Maxime<br>
> <br>
> > ---<br>
> > <br>
> > drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 33 -----------------------<br>
> > drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 36 +++++++++++++++++++++++++-<br>
> > 2 files changed, 35 insertions(+), 34 deletions(-)<br>
> > <br>
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c<br>
> > b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index dd2a1c851939..25183badc85f<br>
> > 100644<br>
> > --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c<br>
> > +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c<br>
> > @@ -99,36 +99,6 @@ static int sun8i_ui_layer_update_coord(struct<br>
> > sun8i_mixer *mixer, int channel,> <br>
> > insize = SUN8I_MIXER_SIZE(src_w, src_h);<br>
> > outsize = SUN8I_MIXER_SIZE(dst_w, dst_h);<br>
> > <br>
> > - if (plane->type == DRM_PLANE_TYPE_PRIMARY) {<br>
> > - bool interlaced = false;<br>
> > - u32 val;<br>
> > -<br>
> > - DRM_DEBUG_DRIVER("Primary layer, updating global size <br>
W: %u H: %u\n",<br>
> > - dst_w, dst_h);<br>
> > - regmap_write(mixer->engine.regs,<br>
> > - SUN8I_MIXER_GLOBAL_SIZE,<br>
> > - outsize);<br>
> > - regmap_write(mixer->engine.regs,<br>
> > - SUN8I_MIXER_BLEND_OUTSIZE(bld_base), <br>
outsize);<br>
> > -<br>
> > - if (state->crtc)<br>
> > - interlaced = state->crtc->state-<br>
>adjusted_mode.flags<br>
> > - & DRM_MODE_FLAG_INTERLACE;<br>
> > -<br>
> > - if (interlaced)<br>
> > - val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED;<br>
> > - else<br>
> > - val = 0;<br>
> > -<br>
> > - regmap_update_bits(mixer->engine.regs,<br>
> > - <br>
SUN8I_MIXER_BLEND_OUTCTL(bld_base),<br>
> > - <br>
SUN8I_MIXER_BLEND_OUTCTL_INTERLACED,<br>
> > - val);<br>
> > -<br>
> > - DRM_DEBUG_DRIVER("Switching display mixer interlaced <br>
mode %s\n",<br>
> > - interlaced ? "on" : "off");<br>
> > - }<br>
> > -<br>
> > <br>
> > /* Set height and width */<br>
> > DRM_DEBUG_DRIVER("Layer source offset X: %d Y: %d\n",<br>
> > <br>
> > state->src.x1 >> 16, state->src.y1 >> 16);<br>
> > <br>
> > @@ -349,9 +319,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct<br>
> > drm_device *drm,> <br>
> > if (!layer)<br>
> > <br>
> > return ERR_PTR(-ENOMEM);<br>
> > <br>
> > - if (index == 0)<br>
> > - type = DRM_PLANE_TYPE_PRIMARY;<br>
> > -<br>
> > <br>
> > /* possible crtcs are set later */<br>
> > ret = drm_universal_plane_init(drm, &layer->plane, 0,<br>
> > <br>
> > &sun8i_ui_layer_funcs,<br>
> > <br>
> > diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c<br>
> > b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 07c27e6a4b77..49c4074e164f<br>
> > 100644<br>
> > --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c<br>
> > +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c<br>
> > @@ -116,6 +116,36 @@ static int sun8i_vi_layer_update_coord(struct<br>
> > sun8i_mixer *mixer, int channel,> <br>
> > insize = SUN8I_MIXER_SIZE(src_w, src_h);<br>
> > outsize = SUN8I_MIXER_SIZE(dst_w, dst_h);<br>
> > <br>
> > + if (plane->type == DRM_PLANE_TYPE_PRIMARY) {<br>
> > + bool interlaced = false;<br>
> > + u32 val;<br>
> > +<br>
> > + DRM_DEBUG_DRIVER("Primary layer, updating global size <br>
W: %u H: %u\n",<br>
> > + dst_w, dst_h);<br>
> > + regmap_write(mixer->engine.regs,<br>
> > + SUN8I_MIXER_GLOBAL_SIZE,<br>
> > + outsize);<br>
> > + regmap_write(mixer->engine.regs,<br>
> > + SUN8I_MIXER_BLEND_OUTSIZE(bld_base), <br>
outsize);<br>
> > +<br>
> > + if (state->crtc)<br>
> > + interlaced = state->crtc->state-<br>
>adjusted_mode.flags<br>
> > + & DRM_MODE_FLAG_INTERLACE;<br>
> > +<br>
> > + if (interlaced)<br>
> > + val = SUN8I_MIXER_BLEND_OUTCTL_INTERLACED;<br>
> > + else<br>
> > + val = 0;<br>
> > +<br>
> > + regmap_update_bits(mixer->engine.regs,<br>
> > + <br>
SUN8I_MIXER_BLEND_OUTCTL(bld_base),<br>
> > + <br>
SUN8I_MIXER_BLEND_OUTCTL_INTERLACED,<br>
> > + val);<br>
> > +<br>
> > + DRM_DEBUG_DRIVER("Switching display mixer interlaced <br>
mode %s\n",<br>
> > + interlaced ? "on" : "off");<br>
> > + }<br>
> > +<br>
> > <br>
> > /* Set height and width */<br>
> > DRM_DEBUG_DRIVER("Layer source offset X: %d Y: %d\n",<br>
> > <br>
> > (state->src.x1 >> 16) & ~(format->hsub - <br>
1),<br>
> > <br>
> > @@ -445,6 +475,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct<br>
> > drm_device *drm,> <br>
> > struct <br>
sun8i_mixer *mixer,<br>
> > int index)<br>
> > <br>
> > {<br>
> > <br>
> > + enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY;<br>
> > <br>
> > struct sun8i_vi_layer *layer;<br>
> > unsigned int plane_cnt;<br>
> > int ret;<br>
> > <br>
> > @@ -453,12 +484,15 @@ struct sun8i_vi_layer<br>
> > *sun8i_vi_layer_init_one(struct drm_device *drm,> <br>
> > if (!layer)<br>
> > <br>
> > return ERR_PTR(-ENOMEM);<br>
> > <br>
> > + if (index == 0)<br>
> > + type = DRM_PLANE_TYPE_PRIMARY;<br>
> > +<br>
> > <br>
> > /* possible crtcs are set later */<br>
> > ret = drm_universal_plane_init(drm, &layer->plane, 0,<br>
> > <br>
> > &sun8i_vi_layer_funcs,<br>
> > sun8i_vi_layer_formats,<br>
> > <br>
ARRAY_SIZE(sun8i_vi_layer_formats),<br>
> > <br>
> > - NULL, <br>
DRM_PLANE_TYPE_OVERLAY, NULL);<br>
> > + NULL, type, NULL);<br>
> > <br>
> > if (ret) {<br>
> > <br>
> > dev_err(drm->dev, "Couldn't initialize layer\n");<br>
> > return ERR_PTR(ret);<br>
> > <br>
> > --<br>
> > 2.17.1<br>
<br>
<br>
<br>
<br>
</blockquote></div></div>