Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp575276ybj; Thu, 19 Sep 2019 19:31:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIlOF5TpEpeAJVHx+eRXUg57NxEgoXVWLboGZkx3l6G3O8dS0f91d2BMElgMM6dOy28HKp X-Received: by 2002:a50:e005:: with SMTP id e5mr19524144edl.279.1568946709009; Thu, 19 Sep 2019 19:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568946709; cv=none; d=google.com; s=arc-20160816; b=x8zA+zTEWz/qPWjlxoRT2SE0IFwz1erJf7SGKnRprGsTfhaAlM21LFw32+Ph8yfCOc P2y/q9VL+uVJb4ZJ/meaNquwrKOkpFaXUioPhSIIG9xzM3+48/TGkKN6SkuOUq75MgC2 bHrgBSOo424VddfFTuS8nZCpMi/b0TBWpWvv4Szj5YVy79tSYAlpfJMamIc/GVtAMR2Q +iKNQey6Z4XuQV5dK9xY3LZvfHZXCc0AVxnAhaE6Klhl8fya5mVBTTSnpXb+gaigtgUj v3oFO29cdZL5I+cZ4HBSrOfekyr2izSJrzJZ9EyEE564qH5MaDr56gt+9rG34iJngrnh EX5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NuFzZWzHaKcNZ3ZAAgiCAxbApeWyyAor+Zes7WVRaaE=; b=TNpX43FlltZHpcUgRgZYiW3BRKt+YWQcvLs3VXBIHexgKU4UqTDyiz8/Z+Fm029Ts7 6vPjtkalCchXoxh3kzj+8oObdMfeZALVf/iAwDWkhh3DwsO2AgqB2W/NAMt2h7bme26a cI3RWO3KAnt8oC6fLvZ8MJ8wY0YOmWtzkHcbPaGEhhonAE/HXxhtG8nik8lg0L6ewC+b BJRCn24XO3sDu9Ul6pa9Crfo6t/AdcryKqd1+UCQ8CGq2M4f+yYaRrSiNaS7tSIMENCD 8y4gNT/jEqta95M9O++67wdnfhtTlKzEu8zv0lS/0M0CziYqS2S4N5Hxk993ndQxIuLe T25g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o17si283388ejm.261.2019.09.19.19.31.26; Thu, 19 Sep 2019 19:31:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391340AbfISSPz convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Sep 2019 14:15:55 -0400 Received: from mailoutvs41.siol.net ([185.57.226.232]:51786 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389923AbfISSPz (ORCPT ); Thu, 19 Sep 2019 14:15:55 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 0A6CF522ADB; Thu, 19 Sep 2019 20:15:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta10.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta10.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aN1n3KoJdUQs; Thu, 19 Sep 2019 20:15:50 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 80AE052376F; Thu, 19 Sep 2019 20:15:50 +0200 (CEST) Received: from jernej-laptop.localnet (cpe-86-58-59-25.static.triera.net [86.58.59.25]) (Authenticated sender: jernej.skrabec@siol.net) by mail.siol.net (Postfix) with ESMTPA id 392C7522ADB; Thu, 19 Sep 2019 20:15:50 +0200 (CEST) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard 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 Message-ID: <104595190.vWb6g8xIPX@jernej-laptop> In-Reply-To: <20190919171754.x6lq73cctnqsjr4v@gilmour> References: <20190919123703.8545-1-roman.stratiienko@globallogic.com> <20190919171754.x6lq73cctnqsjr4v@gilmour> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > 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 > > 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