From patchwork Fri Mar 1 12:20:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10835081 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 3B9C9188E for ; Fri, 1 Mar 2019 12:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ABDD2097A for ; Fri, 1 Mar 2019 12:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EE0A2D900; Fri, 1 Mar 2019 12:21:14 +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 984702D931 for ; Fri, 1 Mar 2019 12:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388167AbfCAMVN (ORCPT ); Fri, 1 Mar 2019 07:21:13 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:36645 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388078AbfCAMVN (ORCPT ); Fri, 1 Mar 2019 07:21:13 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190301122112euoutp01bb6ca85e3da85967f304fe56889eefa2~H1RJ-ZQzC1404314043euoutp01v; Fri, 1 Mar 2019 12:21:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190301122112euoutp01bb6ca85e3da85967f304fe56889eefa2~H1RJ-ZQzC1404314043euoutp01v DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1551442872; bh=v3Dt4P/ltsXHgTk3ddeo1P3t7xX9Iv9sVLNqyQ2/XNs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=aTO1WU1TThKKGw0xoAbfIZSLNt7GaHbrGNOLNmC43BVtRC+hZpsu2oP/XY0cKoliH j2AM/ZLMxHLYYSKeDMWYMQe17mi0n/8dk6GImreN1M7+dHCmfkS90wp2aR3oKxPAw7 ChT9sK8w89LOqhi0+gFf2o4LscK0TkXQ5hEzRTzA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190301122111eucas1p1f7ba10f6e905bf3512e37e44b438f96f~H1RJn9GBE2243022430eucas1p1N; Fri, 1 Mar 2019 12:21:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 54.5E.04441.7B3297C5; Fri, 1 Mar 2019 12:21:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190301122110eucas1p2107b2c2837e9bad58bf21b7869b7e0eb~H1RI39dn22871928719eucas1p2a; Fri, 1 Mar 2019 12:21:10 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-61-5c7923b72db1 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 18.23.04284.6B3297C5; Fri, 1 Mar 2019 12:21:10 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PNO007ENSZ56Z20@eusync3.samsung.com>; Fri, 01 Mar 2019 12:21:10 +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 Subject: [PATCH 13/23] drm/exynos: set primary and cursor planes in exynos_drm_crtc_init Date: Fri, 01 Mar 2019 13:20:45 +0100 Message-id: <20190301122055.7135-14-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190301122055.7135-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42LZduznOd3typUxBhPfiVrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw ZXw7t4u54K1axd/vh9gbGDcqdjFyckgImEhMmbqaCcQWEljBKHFxilIXIxeQ/ZlR4kLXB2aY ounbj7BCFC1jlJhxKBfC/s8o8X2fPYjNJqAp8XfzTTYQW0RAWWLVvnZ2kEHMApcYJV6f7GYE SQgLRElcWN8HVsQioCpx4EM3mM0rYCGxrG0aK8QyeYnVGw6ALeYEih9cCTFIQuAtq8SaBWeZ IIpcJFr+zmOBsGUkOjsOQsXrJZpmXmGGaOhglDixeDkbRMJa4vDxi2AbmAX4JCZtmw5UxAEU 55XoaBOCKPGQONL/jBni/W6gq5d2sU5glFjAyLCKUTy1tDg3PbXYMC+1XK84Mbe4NC9dLzk/ dxMjMJJO/zv+aQfj10tJhxgFOBiVeHgTXpbHCLEmlhVX5h5ilOBgVhLh5WOojBHiTUmsrEot yo8vKs1JLT7EKM3BoiTOW83wIFpIID2xJDU7NbUgtQgmy8TBKdXAWHKt+AcfX+SrRRV5N3/W WkhrC4Xah8fp5vXFWYW0bXl0bf9dvpn/u7bUvDD9rP9XIP/V/vPr13eF9hZ/2HDpxpUvIhsC hRlU7N5t6XC6Y+Pn57ap/1zVE4ugP3rPYzx0LwafNdlx0ZCFY5Ld2S2+lz8ERy5wm6r2rOGE 8jGrAEFFe5XX5xMvK7EUZyQaajEXFScCAP9sPj2gAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xq7rblCtjDPadNbC4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzcksSy3St0vg yvh2bhdzwVu1ir/fD7E3MG5U7GLk5JAQMJGYvv0IaxcjF4eQwBJGiRldp6CcRiaJd+9fsIBU sQloSvzdfJMNxBYRUJZYta+dHaSIWeAKo0T7ty52kISwQJTEhfV9YEUsAqoSBz50g9m8AhYS y9qmsUKsk5dYveEAM4jNCRQ/uBJkEAfQNnOJTaejJjDyLGBkWMUoklpanJueW2yoV5yYW1ya l66XnJ+7iREYHtuO/dy8g/HSxuBDjAIcjEo8vAkvy2OEWBPLiitzDzFKcDArifDyMVTGCPGm JFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamCcs/DT0/UKiud1 /nxO2SS18jrfpx4+579x0YWd/6RbS/7qL2FaP798tnEkk8wdtY9yCyJOqaW26hZOuaZX9m+j But17elHPO0zTTlPGnya80x3kiBDyPc1r4qk5+Zlm11m9PTpTzx045aoaGnicfZVsozLnp/t 4Fq9bava/c/BN1bXLLuwfmG3EktxRqKhFnNRcSIAjQtSOAsCAAA= X-CMS-MailID: 20190301122110eucas1p2107b2c2837e9bad58bf21b7869b7e0eb CMS-TYPE: 201P X-CMS-RootMailID: 20190301122110eucas1p2107b2c2837e9bad58bf21b7869b7e0eb References: <20190301122055.7135-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 and cursor planes. Let's move logic for setting these planes 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 | 12 +++++++++++- 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, 11 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..303df018f0a1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -176,9 +176,19 @@ 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, *cursor = 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; + if (!cursor && plane->type == DRM_PLANE_TYPE_CURSOR) + cursor = 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, cursor, &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;