From patchwork Thu Aug 1 03:44:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11070133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D015F13B1 for ; Thu, 1 Aug 2019 03:45:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1DBD283C3 for ; Thu, 1 Aug 2019 03:45:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6324283C8; Thu, 1 Aug 2019 03:45:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 558AD283C3 for ; Thu, 1 Aug 2019 03:45:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E98F6E34A; Thu, 1 Aug 2019 03:45:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3ABFC6E34A for ; Thu, 1 Aug 2019 03:45:13 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id y8so31515666plr.12 for ; Wed, 31 Jul 2019 20:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lvGyWsNyP9Bb7DvqACymLRZDyyMjKAZBXEluuc9xeZo=; b=tf6SKhjxc/jzPBD3vXkdIIRpw92HlJr1CYXUBpvhqPxqz158NXzLSqw/w1wJBPkCF6 h0mbQCjQRhUBJDCe3t6mUhHLMGKKZHpSHxh0dsCYncGvT2nijiB9ySkPqt8gV3JkYrw5 5/8RYQnoiFfRUMuxIbzeV7c28ZESj9P6AOTisxFXASTTjAPzDkTNyPmHVci+T1U/lovE KYs/0ys19k8z5ovPaKXeApEAi7ztV6T85ROWvu3Ep5Au7g80Z2oZD6C1BMxiv2z5VKXn togTvV0Wzcm8xluH3euQ+siwZOdEbbMetS8CvlApRNla9XklQuf+QTBFyCgL3oagDw7g Lq9w== X-Gm-Message-State: APjAAAWxEPVb5agwtZmR5/mcvFxr60nK8Z9C9M3Wqd8WxfPKimi5VcIy sAJi/d7OF7DHd1/LEu9KwE47IQ== X-Google-Smtp-Source: APXvYqylc9ummDBci5gA3r5mxBzsQHl8bSaQwM8mWZUpp1YAXcP9uhE5n/+pzVs3T0qqoxO5HW5crw== X-Received: by 2002:a17:902:724a:: with SMTP id c10mr115381435pll.298.1564631112233; Wed, 31 Jul 2019 20:45:12 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id h70sm64775674pgc.36.2019.07.31.20.45.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:11 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 17/26] drm: kirin: Move plane number and primay plane in driver data Date: Thu, 1 Aug 2019 03:44:30 +0000 Message-Id: <20190801034439.98227-18-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190801034439.98227-1-john.stultz@linaro.org> References: <20190801034439.98227-1-john.stultz@linaro.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lvGyWsNyP9Bb7DvqACymLRZDyyMjKAZBXEluuc9xeZo=; b=CpdAgIcnEs1v23uEn8j393vhUG7E5P7b2dTor0b0ONtrkdl+hYKhIpnkkCubMGKMZV VOaAdqQKwfl87lx5n4WHIlP0bR4JOc2tetuKP68OFxD5m1APnFeoZCl3zU109lzr4Bm8 mBifG3ZBmjOFszCeB/XiWO8Z+5KdbK+61O+hql3YC7yQdXicqiLW36RXNA/mOBnZSpPh mpuuaHrQ4I4LKbLf27A1tVEhOiAGSp5Uh5e5LN2vhwaKmyVhcIqto9sUnT+EEk/FFK9y ze/JyJmacR+OS8H4uTNBDIzhHJ15RX5wqmBMNO5XSZ3A6ZyqWIlaesIfCqWSggdvJBFX dvGw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xu YiPing , David Airlie , dri-devel , Rongrong Zou , Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the number of planes and the primary plane value to the kirin_drm_data structure This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 21 ++++++++++++------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index bca080e14009..fc0f4c04d1c9 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -35,7 +35,6 @@ #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" -#define PRIMARY_CH ADE_CH1 /* primary plane */ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 @@ -991,7 +990,7 @@ static int ade_drm_init(struct platform_device *pdev) struct kirin_plane *kplane; enum drm_plane_type type; int ret; - int i; + u32 ch; ade = devm_kzalloc(dev->dev, sizeof(*ade), GFP_KERNEL); if (!ade) { @@ -1015,12 +1014,15 @@ static int ade_drm_init(struct platform_device *pdev) * TODO: Now only support primary plane, overlay planes * need to do. */ - for (i = 0; i < ADE_CH_NUM; i++) { - kplane = &ade->planes[i]; - kplane->ch = i; + for (ch = 0; ch < ade_driver_data.num_planes; ch++) { + kplane = &ade->planes[ch]; + kplane->ch = ch; kplane->hw_ctx = ctx; - type = i == PRIMARY_CH ? DRM_PLANE_TYPE_PRIMARY : - DRM_PLANE_TYPE_OVERLAY; + + if (ch == ade_driver_data.prim_plane) + type = DRM_PLANE_TYPE_PRIMARY; + else + type = DRM_PLANE_TYPE_OVERLAY; ret = ade_plane_init(dev, kplane, type); if (ret) @@ -1028,7 +1030,8 @@ static int ade_drm_init(struct platform_device *pdev) } /* crtc init */ - ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &kcrtc->base, + &ade->planes[ade_driver_data.prim_plane].base); if (ret) return ret; @@ -1047,6 +1050,8 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; struct kirin_drm_data ade_driver_data = { + .num_planes = ADE_CH_NUM, + .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index ce9ddccc67a8..2b660df60293 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -37,6 +37,8 @@ struct kirin_plane { struct kirin_drm_data { const u32 *channel_formats; u32 channel_formats_cnt; + u32 num_planes; + u32 prim_plane; const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs;