From patchwork Mon Mar 25 07:13:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10868035 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 EC34018B7 for ; Mon, 25 Mar 2019 07:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D36562924B for ; Mon, 25 Mar 2019 07:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7A8829259; Mon, 25 Mar 2019 07:14:02 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434DF2924B for ; Mon, 25 Mar 2019 07:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729810AbfCYHOC (ORCPT ); Mon, 25 Mar 2019 03:14:02 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59689 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729803AbfCYHOB (ORCPT ); Mon, 25 Mar 2019 03:14:01 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190325071400euoutp02729573e855a1b55e2d7bf5a4a3783024~PIjyycfR90737407374euoutp02G; Mon, 25 Mar 2019 07:14:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190325071400euoutp02729573e855a1b55e2d7bf5a4a3783024~PIjyycfR90737407374euoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553498040; bh=OEv57mPU8EVb/q74U9BZ6+ndufXsUYWxPrTOEmzpOxY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=tFWD5J1cgDF9Yzd8N29xlOjt8yebAGxTowkmWvER0U0TvPJGosM58wLRhg4MGADYW i8CKQWWNPzXtlhXZGul4r3G1QQc0TaM+B0chs9JeUgsTXsqtN/54NzFRIPVcqLIdC/ 1GjsiKFukjX71ei2GzZw9NZmBn7YnnndaZmo7esY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190325071400eucas1p1234f4f098d4fd1a35c2f6800740f56f6~PIjybyXIg2091220912eucas1p1c; Mon, 25 Mar 2019 07:14:00 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 22.6E.04298.7BF789C5; Mon, 25 Mar 2019 07:13:59 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190325071359eucas1p1701719f798584cd23cc8058d2f2c495b~PIjxy8ul12091220912eucas1p1b; Mon, 25 Mar 2019 07:13:59 +0000 (GMT) X-AuditID: cbfec7f2-f2dff700000010ca-c1-5c987fb7fca9 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A4.69.04146.7BF789C5; Mon, 25 Mar 2019 07:13:59 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.51.74]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POW003QHUR43P00@eusync3.samsung.com>; Mon, 25 Mar 2019 07:13:59 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 RESEND 15/24] drm/exynos: set primary plane in exynos_drm_crtc_init Date: Mon, 25 Mar 2019 08:13:40 +0100 Message-id: <20190325071349.22600-16-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190325071349.22600-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWy7djP87rb62fEGJzfZWJxa905VouNM9az Wlz5+p7NYtL9CSwW589vYLeYcX4fk8XaI3fZHdg9Nq3qZPO4332cyaNvyypGj8+b5AJYorhs UlJzMstSi/TtErgy3p64zlbwT7XiQ/NqxgbGGwpdjJwcEgImEmtWLWMCsYUEVjBKrLlj18XI BWR/ZpTYtf4UI0zRummfoIqWMUqs7IiHKPrPKLHk1wWwIjYBTYm/m2+ygdgiAsoSq/a1s4MU MQv8ZpSYvnwbO0hCWCBC4kjTYrBJLAKqEn/e/QRr4BWwlLhx+A87xDZ5idUbDjCD2JxA8f+n LzGDDJIQ+MsqsWbyNCaIIheJX+sOsELYMhKdHQeh4vUS91e0QDV0MEps3bCTGSJhLXH4+EWw BmYBPolJ26YDxTmA4rwSHW1CECUeEn17PjBDvNYDDIsH55knMEosYGRYxSieWlqcm55abJiX Wq5XnJhbXJqXrpecn7uJERhfp/8d/7SD8eulpEOMAhyMSjy8L3ZOjxFiTSwrrsw9xCjBwawk wvtEdEaMEG9KYmVValF+fFFpTmrxIUZpDhYlcd5qhgfRQgLpiSWp2ampBalFMFkmDk6pBsZl Huk7nRczpHTrMb0/dfV74N2tKR/71lxjz4t23DLHb5mICdvW5YolzjO79nU1lnWV283ht7l2 bkab8sbXQl+OLi1719xaHG2Yc3mJx6t34Zu3mTuXX1aIFvXkM+OWP6vrODuwXmWL/PGUCQvV Bc551i++8kXveawIq9Ai6TALxl/61rlrvymxFGckGmoxFxUnAgD+wf7sqwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e/4Vd3t9TNiDJ7/lrS4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbvsDuwem1Z1snnc7z7O5NG3ZRWjx+dNcgEsUVw2 Kak5mWWpRfp2CVwZb09cZyv4p1rxoXk1YwPjDYUuRk4OCQETiXXTPjF1MXJxCAksYZRoe3GB DcJpZJLouT+ZEaSKTUBT4u/mm2wgtoiAssSqfe3sIEXMAr8ZJT7P+MoMkhAWiJA40rSYCcRm EVCV+PPuJ1gDr4ClxI3Df9gh1slLrN5wAKyeEyj+//QlMFtIwEJi77JG9gmMPAsYGVYxiqSW Fuem5xYb6hUn5haX5qXrJefnbmIEBs22Yz8372C8tDH4EKMAB6MSD6/DnukxQqyJZcWVuYcY JTiYlUR4n4jOiBHiTUmsrEotyo8vKs1JLT7EKM3BoiTOe96gMkpIID2xJDU7NbUgtQgmy8TB KdXAWDy14t5qib4t11YX1vp92yB9aKX3jQ9V/5x/XbeN/hOk2V1y+laOr639MpEIt4ZN1p8Z jm92erdkD79Hm33E64cOdpmNnhrPMl47NDsKlT44nTbvNZvc8lRH9bOl5e/qxNhu/ZApun/E dsKiTysSvkdvcLqsOfff0Ymplgpsn/Ssw60yTCSvKbEUZyQaajEXFScCAKV8rSoWAgAA X-CMS-MailID: 20190325071359eucas1p1701719f798584cd23cc8058d2f2c495b CMS-TYPE: 201P X-CMS-RootMailID: 20190325071359eucas1p1701719f798584cd23cc8058d2f2c495b References: <20190325071349.22600-1-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP exynos_drm_crtc_init has all information necessary to discover primary plane. Let's move logic for setting primary plane into this function. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 3 --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 1 - drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 +++++++++- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 -- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 1 - drivers/gpu/drm/exynos/exynos_drm_vidi.c | 1 - drivers/gpu/drm/exynos/exynos_mixer.c | 1 - 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 663446ca2d09..958972e3ee1e 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -30,8 +30,6 @@ #define DSD_CFG_MUX_TE_UNMASK_GLOBAL BIT(13) #define WINDOWS_NR 5 -#define PRIMARY_WIN 2 -#define CURSON_WIN 4 #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 @@ -625,7 +623,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ret = exynos_drm_crtc_init(&ctx->crtc, drm_dev); if (ret) return ret; - ctx->crtc.base.primary = &ctx->planes[PRIMARY_WIN].base; decon_clear_channels(&ctx->crtc); diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index b6ad2faed159..3d8c96f0b02a 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -635,7 +635,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data) decon_ctx_remove(ctx); return ret; } - ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base; if (ctx->encoder) exynos_dpi_bind(drm_dev, ctx->encoder); diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 72e224e80565..ec1319781b8b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -176,9 +176,17 @@ int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc, struct drm_device *drm_dev) { struct drm_crtc *crtc = &exynos_crtc->base; + struct drm_plane *primary = NULL, *plane; + + drm_for_each_plane(plane, drm_dev) { + if (plane->possible_crtcs != BIT(drm_dev->mode_config.num_crtc)) + continue; + if (!primary && plane->type == DRM_PLANE_TYPE_PRIMARY) + primary = plane; + } drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs); - return drm_crtc_init_with_planes(drm_dev, crtc, NULL, NULL, + return drm_crtc_init_with_planes(drm_dev, crtc, primary, NULL, &exynos_crtc_funcs, NULL); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 23b27b82de6e..6643db865500 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -21,8 +21,6 @@ #define MAX_PLANE 5 #define MAX_FB_BUFFER 4 -#define DEFAULT_WIN 0 - #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc, base) #define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index b3c11bca5aed..14e70971547a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -1051,7 +1051,6 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) ret = exynos_drm_crtc_init(&ctx->crtc, drm_dev); if (ret) return ret; - ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base; if (ctx->driver_data->has_dp_clk) { ctx->dp_clk.enable = fimd_dp_clock_enable; diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index eb1fd3a2cdf3..19cd7275b20f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -387,7 +387,6 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) DRM_ERROR("failed to create crtc.\n"); return ret; } - ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base; drm_encoder_init(drm_dev, encoder, &exynos_vidi_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index a61fb2069e32..efc7d7a2d5b1 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1179,7 +1179,6 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) mixer_ctx_remove(ctx); goto free_ctx; } - ctx->crtc.base.primary = &ctx->planes[DEFAULT_WIN].base; return 0;