From patchwork Wed Mar 20 13:06:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10861581 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 3463E1575 for ; Wed, 20 Mar 2019 13:07:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CA4528B92 for ; Wed, 20 Mar 2019 13:07:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B29129810; Wed, 20 Mar 2019 13:07:21 +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 7DF1E28BCD for ; Wed, 20 Mar 2019 13:07:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727688AbfCTNHU (ORCPT ); Wed, 20 Mar 2019 09:07:20 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55158 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbfCTNHT (ORCPT ); Wed, 20 Mar 2019 09:07:19 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190320130718euoutp01bf9e248e084e9e8703956d8f5b8518cb~NrJ1Sh1v30192201922euoutp01g; Wed, 20 Mar 2019 13:07:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190320130718euoutp01bf9e248e084e9e8703956d8f5b8518cb~NrJ1Sh1v30192201922euoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553087238; bh=meC7I0GRSlUX3fy/YAv8N+qsjVbZJhfXTLKQtOPk/CQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=t30hDu8f+NLP6/Zqenun+9pbANc2xEA/1Zhg+sG+fgb6QguZhsr/xKo/SYsIuwCW/ 9LyW948GOL7xW5QITlUPgPEX3U2IgN4p2kaMPv7kq0OC0oq31DGaRz+swSNqSo8FeR XHdkxTPmmMCVR2arcDb3AM0YeKk9FT9FLPlFLSZU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190320130717eucas1p2fb84e1cd116c34c73b3fbb364f39cfe1~NrJ04XwyA0993409934eucas1p27; Wed, 20 Mar 2019 13:07:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 2C.92.04806.50B329C5; Wed, 20 Mar 2019 13:07:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190320130717eucas1p2a2a480a8c5d71fc66741410829a0d016~NrJ0W8cJy1665816658eucas1p2U; Wed, 20 Mar 2019 13:07:17 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-2b-5c923b0543d3 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 27.AF.04284.50B329C5; Wed, 20 Mar 2019 13:07:17 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0POO004P71RZN460@eusync1.samsung.com>; Wed, 20 Mar 2019 13:07:17 +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 v2 RESEND 13/24] drm/exynos: set primary plane in exynos_drm_crtc_init Date: Wed, 20 Mar 2019 14:06:56 +0100 Message-id: <20190320130707.25161-14-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190320130707.25161-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWy7djPc7qs1pNiDNqbFSxurTvHarFxxnpW iytf37NZTLo/gcXi/PkN7BYzzu9jslh75C67A7vHplWdbB73u48zefRtWcXo8XmTXABLFJdN SmpOZllqkb5dAlfG1499LAX/VCu+X3rJ0sB4Q6GLkZNDQsBEYv3UHlYQW0hgBaPEnPeyXYxc QPZnRokvEx8wwRTdPP6MDSKxjFFi6b67zBDOf0aJ/gOP2EGq2AQ0Jf5uvskGYosIKEus2tfO DlLELPCbUWL68m1gRcICERIbNi0B28cioCrx4Ng6oAYODl4BS4meS7YQ2+QlVm84wAxicwKF H875DzZHQuAvq8STWQfYIYpcJD7cPs8MYctIdHYchDq1XuL+ihZmiIYORomtG3ZCFVlLHD5+ EWwxswCfxKRt05lBFksI8Ep0tAlBmB4ST75mQjzWA/TYwuUsExglFjAyrGIUTy0tzk1PLTbO Sy3XK07MLS7NS9dLzs/dxAiMrtP/jn/dwbjvT9IhRgEORiUe3gvPJ8QIsSaWFVfmHmKU4GBW EuGNUJoUI8SbklhZlVqUH19UmpNafIhRmoNFSZy3muFBtJBAemJJanZqakFqEUyWiYNTqoGx 9sVRxUzZeSG2TT8euF25MDE0fj+nW82iiHOKRu5szuEs3KY73j2wPGPQd/AWQ+O5XS+St56t fZa9tt7acrMeR1ZRTFnu5Uap7PnNPw8yfPl69wq7hBBDktf2nKqiXH/Haw+Kf9+Ym7lzt9tc 85eXpv+ZYlPCcCjXdfuatui0mf3ePXbLOiKVWIozEg21mIuKEwGsmGp0qgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4ZV1W60kxBoducFncWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6Mrx/7WAr+qVZ8v/SSpYHxhkIXIyeHhICJxM3jz9hAbCGBJYwS75cldTFy AdmNTBJnnu5lBUmwCWhK/N18E6xIREBZYtW+dnaQImaB34wSn2d8ZQZJCAtESGzYtASsgUVA VeLBsXVADRwcvAKWEj2XbCGWyUus3nAArJwTKPxwzn92iMUWEotP3GWcwMizgJFhFaNIamlx bnpusaFecWJucWleul5yfu4mRmDAbDv2c/MOxksbgw8xCnAwKvHwVjydECPEmlhWXJl7iFGC g1lJhDdCaVKMEG9KYmVValF+fFFpTmrxIUZpDhYlcd7zBpVRQgLpiSWp2ampBalFMFkmDk6p BsYK9WMxbA8eWU7eVXH+dVue05mARGGBs8c+hmw7lvonfkpN0fMMZo8FK7av/Z1cXsrF8Fbq QshjwVTZ89V9akpvZ/P6/IxQnLXKWkZ3At+Xsuk2Fz20ri9wc/ba39EVpLntxS67Say58c+Y 7m3V/Lv8glKFuITv6xVsxzeUrm9zb7j18eDrwB4lluKMREMt5qLiRABpH5mrFAIAAA== X-CMS-MailID: 20190320130717eucas1p2a2a480a8c5d71fc66741410829a0d016 CMS-TYPE: 201P X-CMS-RootMailID: 20190320130717eucas1p2a2a480a8c5d71fc66741410829a0d016 References: <20190320130707.25161-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 d0dcbbfc67e5..8bb31a0e572e 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1157,7 +1157,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;