Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4249166imu; Mon, 24 Dec 2018 20:23:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/VvMg4jNNTZj8MmcucjzGkf1ER80txHgz+20muaG1qje9OHGOgOBbWwDss3UXB0WIizM70K X-Received: by 2002:a62:68c5:: with SMTP id d188mr15847975pfc.194.1545711836594; Mon, 24 Dec 2018 20:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545711836; cv=none; d=google.com; s=arc-20160816; b=VxNsMXBFCmMMUhwSAEDBit0S7gcKh0OAjo0GsWDGbZP4VkNbIAw/Uq5yDW6iqVXCP9 FJ2XPZDDbyPeNyQnzz2dKfLHEqVjn8NAc2aY8KLo/jf9AzAJUY9CPAe82pSeoxZK+CXL +UkWdazMoSGJlEOg58euumIyc9uqZJYXIU7Y1CnPQPDm5k21qowG7UIOKzJgP+bM8eG1 aW2ll+r+LjB3f4FSEd3Af43d7f/nOULqaK7344/AAkrd57HpvPyjNlbYqZFt8u/tPL/w zyWYEyrDB4coLyrNHG4L5RO4QED8JFpCS2UugNSsaljx+Q1m0wlZ2EUEwTfdDm7M8cJq dRMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XyxR0p07RGp1qlnLQ+PYw01EN8P7tHAtKVYSKm8bAL4=; b=RNHAiYOgIlwfm6MMS7747F5fypaEptDbo7rekfFa174qoJs2Nmh5Fed2IVvUcQAvDm los29vJewFi+fG4PcRLfCiPzZ7S1q4S3+NVsWUEldi6Hck+p28193GR8i5GgrrJf6SnS JCYN/jL9uNQF1nbII4mn9RLap72tIm1JwMl/qRSw79lsTUZCfBFDfIBfrBFBtoGUqL8X PjsTRPGLWnvWG5gDoLWx/qI+PPVRPimu7IU2CCD3gDQAUkd8cbTSMoqD9WPhptUPfqt/ NNRwA3vFZh/pmeTU4EEp8ocYkAJkbmxBiyjD7CQFsW0Yya3Q9hJEsZnr2w7pjRQvvTxw KZ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DMPGJSJt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o28si30142314pgm.238.2018.12.24.20.23.41; Mon, 24 Dec 2018 20:23:56 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=DMPGJSJt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725845AbeLYEWx (ORCPT + 99 others); Mon, 24 Dec 2018 23:22:53 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:43186 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbeLYEWx (ORCPT ); Mon, 24 Dec 2018 23:22:53 -0500 Received: by mail-qk1-f195.google.com with SMTP id r71so7759448qkr.10 for ; Mon, 24 Dec 2018 20:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XyxR0p07RGp1qlnLQ+PYw01EN8P7tHAtKVYSKm8bAL4=; b=DMPGJSJtRdiZv99OCfBQos18OkHHDteY+guhhAdn1ZMq4HDXHgQ206cLCrMt3qf8nw 8vfqD1vINezlalGqZWrBIQT7CXRAd+abfmlvESEKCCKOFQ/snvPpVXImYsAmln0e9aD2 bHQW4i+yYIQQzYdR/WbmsSKxCPEaAFYdqN2l8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XyxR0p07RGp1qlnLQ+PYw01EN8P7tHAtKVYSKm8bAL4=; b=bx8oWiP04NODtlTS7Gri/tmfKWc2J31e2BSEsISJQPLcH40IPVrXjY+aIv1ruUe4Xn iZdti8BuZmE5+pcnx+8DajcCVw4lNVHVOtM9krwKG2VQJLm5W3/XjweX+j0SzCzhFTX6 EMd7woXpr2WHuf5XV8yfSxgTu+2J5+aCzU1Pjy4m1nJQFwwbkaikzdivUAQiUrVcRLsQ FWRFeXpxrEVu5PUErKxSYZe9heQdHcYkOwakoOqwOdBv7DTMWaGO0VW2vpMvP0aFEznu heOUpcURPA2jXfkkp6YQkHh5k5Wi+wsW/H14uhqXsVSF99fl0RkibI/cm3TuCl5iOjAU jWHA== X-Gm-Message-State: AJcUukeYabyAVvGVm8gOityN7tD9s6q96YeSnKkHc4ks7ch7Hir3MSIs VRNNrqHrdgCEyQY1Pr/7gVyAwVy8HV8iRXzHyU+VNwL+X3s/Ig== X-Received: by 2002:a37:5107:: with SMTP id f7mr14268124qkb.124.1545711771863; Mon, 24 Dec 2018 20:22:51 -0800 (PST) MIME-Version: 1.0 References: <1545638931-24938-1-git-send-email-yongqiang.niu@mediatek.com> <1545638931-24938-18-git-send-email-yongqiang.niu@mediatek.com> In-Reply-To: <1545638931-24938-18-git-send-email-yongqiang.niu@mediatek.com> From: Nicolas Boichat Date: Tue, 25 Dec 2018 12:22:41 +0800 Message-ID: Subject: Re: [PATCH 17/18] drm/mediatek: add ovl0/ovl0_2l usecase To: Yongqiang Niu Cc: CK Hu , Philipp Zabel , David Airlie , Rob Herring , Mark Rutland , Matthias Brugger , devicetree@vger.kernel.org, lkml , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm Mailing List 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 On Mon, Dec 24, 2018 at 6:52 PM Yongqiang Niu wrote: > > This patch add ovl0/ovl0_2l usecase > > Signed-off-by: Yongqiang Niu > --- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 38 ++++++++++++++++++++++++++++++--- > 1 file changed, 35 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > index a5af4be..25cf063 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > @@ -283,6 +283,15 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) > > for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { > struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[i]; > + enum mtk_ddp_comp_id prev = DDP_COMPONENT_ID_MAX; > + > + if (i > 0) { > + struct mtk_ddp_comp *comp_prev; > + > + comp_prev = mtk_crtc->ddp_comp[i - 1]; > + prev = comp_prev->id; Just if (i > 0) prev = mtk_crtc->ddp_comp[i - 1]->id; else prev = DDP_COMPONENT_ID_MAX; > + } > + mtk_ddp_comp_connect(comp, prev); > > mtk_ddp_comp_config(comp, width, height, vrefresh, bpc); > mtk_ddp_comp_start(comp); > @@ -292,10 +301,19 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) > for (i = 0; i < mtk_crtc->layer_nr; i++) { > struct drm_plane *plane = &mtk_crtc->planes[i]; > struct mtk_plane_state *plane_state; > + struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; > + unsigned int comp_layer_nr = mtk_ddp_comp_layer_nr(comp); > + unsigned int local_layer = 0; No need to init to 0. > > plane_state = to_mtk_plane_state(plane->state); > - mtk_ddp_comp_layer_config(mtk_crtc->ddp_comp[0], i, > - plane_state); > + > + if (i >= comp_layer_nr) { > + comp = mtk_crtc->ddp_comp[1]; > + local_layer = i - comp_layer_nr; > + } else { > + local_layer = i; > + } > + mtk_ddp_comp_layer_config(comp, local_layer, plane_state); > } > > return 0; > @@ -340,6 +358,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc) > struct mtk_crtc_state *state = to_mtk_crtc_state(mtk_crtc->base.state); > struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; > unsigned int i; > + unsigned int comp_layer_nr = mtk_ddp_comp_layer_nr(comp); > + unsigned int local_layer = 0; ditto, don't init to 0. > > /* > * TODO: instead of updating the registers here, we should prepare > @@ -362,7 +382,15 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc) > plane_state = to_mtk_plane_state(plane->state); > > if (plane_state->pending.config) { > - mtk_ddp_comp_layer_config(comp, i, plane_state); > + if (i >= comp_layer_nr) { > + comp = mtk_crtc->ddp_comp[1]; > + local_layer = i - comp_layer_nr; > + } else { > + local_layer = i; > + } > + > + mtk_ddp_comp_layer_config(comp, local_layer, > + plane_state); > plane_state->pending.config = false; > } > } > @@ -604,6 +632,10 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, > } > > mtk_crtc->layer_nr = mtk_ddp_comp_layer_nr(mtk_crtc->ddp_comp[0]); > + if (mtk_crtc->ddp_comp_nr > 1 && > + mtk_ddp_comp_get_type(mtk_crtc->ddp_comp[1]->id) == MTK_DISP_OVL) > + mtk_crtc->layer_nr += > + mtk_ddp_comp_layer_nr(mtk_crtc->ddp_comp[1]); > mtk_crtc->planes = devm_kcalloc(dev, mtk_crtc->layer_nr, > sizeof(struct drm_plane), > GFP_KERNEL); > -- > 1.8.1.1.dirty > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel