From patchwork Wed Mar 20 13:06:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10861555 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 3A1961823 for ; Wed, 20 Mar 2019 13:07:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CB8A2838B for ; Wed, 20 Mar 2019 13:07:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A65828B92; Wed, 20 Mar 2019 13:07:18 +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 EF1BA2996A for ; Wed, 20 Mar 2019 13:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725905AbfCTNHQ (ORCPT ); Wed, 20 Mar 2019 09:07:16 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:58180 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbfCTNHQ (ORCPT ); Wed, 20 Mar 2019 09:07:16 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190320130714euoutp02207bf28d06240cfebf4a95f710906a4a~NrJxwSUia1589215892euoutp02i; Wed, 20 Mar 2019 13:07:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190320130714euoutp02207bf28d06240cfebf4a95f710906a4a~NrJxwSUia1589215892euoutp02i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1553087234; bh=UR1xPsqq5p6w7wEYsZmeIYJwRrzLGWgQ4s3cBUVmb60=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=i2SUsyRvg65ZmR7WQ7PqLnmbYn2AJ2QKN24hpcoH6JlQAnaCUUKQ+sAugckeIs72n aNq4IYn5+VfMdHU22ZEoa0qKpDjFaydL5VbjWYjwzdhFOt+r8H5/qWPjZVRpDFXJ6I m6+NA4UFzxJXhHiGF94nxH7TD9iJVjMQ02+gVccE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190320130713eucas1p265e029a26728056629a314fad9a40673~NrJxV08xF0223602236eucas1p2i; Wed, 20 Mar 2019 13:07:13 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F7.92.04806.10B329C5; Wed, 20 Mar 2019 13:07:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190320130713eucas1p137746c8fcdf13bbe1c897c27a245b22a~NrJw2XuAJ2304123041eucas1p1v; Wed, 20 Mar 2019 13:07:13 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-1b-5c923b01fc66 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 47.DA.04128.10B329C5; Wed, 20 Mar 2019 13:07:13 +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:13 +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 03/24] drm/exynos: drop exynos_drm_plane_config structure Date: Wed, 20 Mar 2019 14:06:46 +0100 Message-id: <20190320130707.25161-4-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+NgFprJIsWRmVeSWpSXmKPExsWy7djP87qM1pNiDL716VvcWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MvrvyBVNbGSv+bPVvYFyW18XIySEhYCKx5Pcmli5GLg4hgRWMEj2bv7JC OJ8ZJe69W8AGU7Vo0VVmiMQyRon9E76xQzj/gVr2nmMEqWIT0JT4u/kmWIeIgLLEqn3tYEXM Ar8ZJaYv38YOkhAWCAUa9QbMZhFQlXi0ZwULiM0rYCGx584lqHXyEqs3HGAGsTkFLCUezvkP NkhC4C+rxKUtf5ghilwk5v3byQhhy0hcntzNAmHXS9xf0cIM0dDBKLF1w06oBmuJw8cvsoLY zAJ8EpO2TQeKcwDFeSU62oQgSjwkTj06Cg2AHkaJUx3z2CYwSixgZFjFKJ5aWpybnlpsnJda rlecmFtcmpeul5yfu4kRGGGn/x3/uoNx35+kQ4wCHIxKPLwXnk+IEWJNLCuuzD3EKMHBrCTC G6E0KUaINyWxsiq1KD++qDQntfgQozQHi5I4bzXDg2ghgfTEktTs1NSC1CKYLBMHp1QDY+bT KV/eVDDEc7y5I/OpSm5v8ZvdZWe2Vlsv/Hlku7ns0ZtHa743SChEGQoqX1x3T6GHMzbH70P2 IyZhkdd3lors60n5U3FAZFn5/P4+4wShvuoXvw56Hnq8+LSbvM35z0cT1hlsNr7RXpdz97Y2 34m33K8P/Emt33D+TdWNYnF5idgVKzXeZCqxFGckGmoxFxUnAgDndGFLrAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4ZV1G60kxBksXc1ncWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF12B3aPTas62Tzudx9n8ujbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MvrvyBVNbGSv+bPVvYFyW18XIySEhYCKxaNFVZhBbSGAJo8T/3YldjFxA diOTxPlLd5hAEmwCmhJ/N99kA7FFBJQlVu1rZwcpYhb4zSjxecZXsG5hgVCgSW/YQWwWAVWJ R3tWsIDYvAIWEnvuXGKD2CYvsXrDAbB6TgFLiYdz/rNDbLaQWHziLuMERp4FjAyrGEVSS4tz 03OLjfSKE3OLS/PS9ZLzczcxAgNm27GfW3Ywdr0LPsQowMGoxMNb8XRCjBBrYllxZe4hRgkO ZiUR3gilSTFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEec8bVEYJCaQnlqRmp6YWpBbBZJk4OKUa GGfe2JC44zvP6YfqzvtWpy8X3vzLYk/i9Lx7yc93f3hnwLWxiS/1Ns9GtYhbl1bX/3k4V6qj e/7Fv0pbhNd7h7hf/TVn48rVM1I4Tn3q+aebHyeyrf7tU+5TE2yn5oXNXFgtMMV3lfEmkxq9 TeKT3mheEtbOUrBbd5PHwGYPZ3bVi3D3Lfttvq9VYinOSDTUYi4qTgQAYVB+HhQCAAA= X-CMS-MailID: 20190320130713eucas1p137746c8fcdf13bbe1c897c27a245b22a CMS-TYPE: 201P X-CMS-RootMailID: 20190320130713eucas1p137746c8fcdf13bbe1c897c27a245b22a 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_plane_config must be present for every plane, and most fields are redundant with exynos_drm_plane: - pixel_formats, num_pixel_formats are stored in plane.base.format_*, - type is stored in plane.base.type, - zpos is always equal to plane.index. The only non-redundant field capabilities can be moved to exynos_drm_plane. As consequence of removing the structure some code should be refactored. The patch should not have functional changes. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 18 +++--- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 11 +--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 39 ++++--------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 ++---- drivers/gpu/drm/exynos/exynos_drm_plane.c | 56 +++++++++--------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 11 +--- drivers/gpu/drm/exynos/exynos_mixer.c | 58 +++++++------------ 7 files changed, 76 insertions(+), 134 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 24df0b307b2f..ae0f475eb633 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -56,7 +56,6 @@ struct decon_context { struct drm_device *drm_dev; struct exynos_drm_crtc *crtc; struct exynos_drm_plane planes[WINDOWS_NR]; - struct exynos_drm_plane_config configs[WINDOWS_NR]; void __iomem *addr; struct regmap *sysreg; struct clk *clks[ARRAY_SIZE(decon_clks_name)]; @@ -608,22 +607,19 @@ static int decon_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; struct exynos_drm_plane *exynos_plane; enum exynos_drm_output_type out_type; - unsigned int win; + unsigned int i; int ret; ctx->drm_dev = drm_dev; - for (win = ctx->first_win; win < WINDOWS_NR; win++) { - ctx->configs[win].pixel_formats = decon_formats; - ctx->configs[win].num_pixel_formats = ARRAY_SIZE(decon_formats); - ctx->configs[win].zpos = win - ctx->first_win; - ctx->configs[win].type = decon_win_types[win]; - ctx->configs[win].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS + for (i = ctx->first_win; i < WINDOWS_NR; i++) { + ctx->planes[i].index = i - ctx->first_win; + ctx->planes[i].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS | EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND; - - ret = exynos_plane_init(drm_dev, &ctx->planes[win], win, - &ctx->configs[win]); + ret = exynos_plane_init(drm_dev, &ctx->planes[i], + decon_formats, ARRAY_SIZE(decon_formats), + decon_win_types[i]); if (ret) return ret; } diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 812941b84287..6d462f057531 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -44,7 +44,6 @@ struct decon_context { struct drm_device *drm_dev; struct exynos_drm_crtc *crtc; struct exynos_drm_plane planes[WINDOWS_NR]; - struct exynos_drm_plane_config configs[WINDOWS_NR]; struct clk *pclk; struct clk *aclk; struct clk *eclk; @@ -626,13 +625,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data) } for (i = 0; i < WINDOWS_NR; i++) { - ctx->configs[i].pixel_formats = decon_formats; - ctx->configs[i].num_pixel_formats = ARRAY_SIZE(decon_formats); - ctx->configs[i].zpos = i; - ctx->configs[i].type = decon_win_types[i]; - - ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, - &ctx->configs[i]); + ctx->planes[i].index = i; + ret = exynos_plane_init(drm_dev, &ctx->planes[i], decon_formats, + ARRAY_SIZE(decon_formats), decon_win_types[i]); if (ret) return ret; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 1f6bb5516170..1d4ef0245958 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -71,11 +71,19 @@ to_exynos_plane_state(struct drm_plane_state *state) return container_of(state, struct exynos_drm_plane_state, base); } +#define EXYNOS_DRM_PLANE_CAP_DOUBLE (1 << 0) +#define EXYNOS_DRM_PLANE_CAP_SCALE (1 << 1) +#define EXYNOS_DRM_PLANE_CAP_ZPOS (1 << 2) +#define EXYNOS_DRM_PLANE_CAP_TILE (1 << 3) +#define EXYNOS_DRM_PLANE_CAP_PIX_BLEND (1 << 4) +#define EXYNOS_DRM_PLANE_CAP_WIN_BLEND (1 << 5) + /* * Exynos drm common overlay structure. * * @base: plane object * @index: hardware index of the overlay layer + * @capabilities: supported features (see EXYNOS_DRM_PLANE_CAP_*) * * this structure is common to exynos SoC and its contents would be copied * to hardware specific overlay info. @@ -83,38 +91,13 @@ to_exynos_plane_state(struct drm_plane_state *state) struct exynos_drm_plane { struct drm_plane base; - const struct exynos_drm_plane_config *config; unsigned int index; -}; - -#define EXYNOS_DRM_PLANE_CAP_DOUBLE (1 << 0) -#define EXYNOS_DRM_PLANE_CAP_SCALE (1 << 1) -#define EXYNOS_DRM_PLANE_CAP_ZPOS (1 << 2) -#define EXYNOS_DRM_PLANE_CAP_TILE (1 << 3) -#define EXYNOS_DRM_PLANE_CAP_PIX_BLEND (1 << 4) -#define EXYNOS_DRM_PLANE_CAP_WIN_BLEND (1 << 5) - -/* - * Exynos DRM plane configuration structure. - * - * @zpos: initial z-position of the plane. - * @type: type of the plane (primary, cursor or overlay). - * @pixel_formats: supported pixel formats. - * @num_pixel_formats: number of elements in 'pixel_formats'. - * @capabilities: supported features (see EXYNOS_DRM_PLANE_CAP_*) - */ - -struct exynos_drm_plane_config { - unsigned int zpos; - enum drm_plane_type type; - const uint32_t *pixel_formats; - unsigned int num_pixel_formats; unsigned int capabilities; }; -int exynos_plane_init(struct drm_device *dev, - struct exynos_drm_plane *exynos_plane, unsigned int index, - const struct exynos_drm_plane_config *config); +int exynos_plane_init(struct drm_device *dev, struct exynos_drm_plane *plane, + const uint32_t *pixel_formats, int num_pixel_formats, + enum drm_plane_type type); /* * Exynos drm crtc ops diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index b1a9502a4140..2d34ca375ee1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -171,7 +171,6 @@ struct fimd_context { struct drm_device *drm_dev; struct exynos_drm_crtc *crtc; struct exynos_drm_plane planes[WINDOWS_NR]; - struct exynos_drm_plane_config configs[WINDOWS_NR]; struct clk *bus_clk; struct clk *lcd_clk; void __iomem *regs; @@ -1044,16 +1043,12 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) ctx->drm_dev = drm_dev; for (i = 0; i < WINDOWS_NR; i++) { - ctx->configs[i].pixel_formats = fimd_formats; - ctx->configs[i].num_pixel_formats = ARRAY_SIZE(fimd_formats); - ctx->configs[i].zpos = i; - ctx->configs[i].type = fimd_win_types[i]; - ctx->configs[i].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS - | EXYNOS_DRM_PLANE_CAP_WIN_BLEND - | EXYNOS_DRM_PLANE_CAP_PIX_BLEND; - - ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, - &ctx->configs[i]); + ctx->planes[i].index = i; + ctx->planes[i].capabilities = EXYNOS_DRM_PLANE_CAP_ZPOS + | EXYNOS_DRM_PLANE_CAP_WIN_BLEND + | EXYNOS_DRM_PLANE_CAP_PIX_BLEND; + ret = exynos_plane_init(drm_dev, &ctx->planes[i], fimd_formats, + ARRAY_SIZE(fimd_formats), fimd_win_types[i]); if (ret) return ret; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 8af0eba3f362..e1aa504539fa 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -138,7 +138,7 @@ static void exynos_drm_plane_reset(struct drm_plane *plane) exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL); if (exynos_state) { __drm_atomic_helper_plane_reset(plane, &exynos_state->base); - plane->state->zpos = exynos_plane->config->zpos; + plane->state->zpos = exynos_plane->index; } } @@ -176,14 +176,14 @@ static struct drm_plane_funcs exynos_plane_funcs = { }; static int -exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config, - struct exynos_drm_plane_state *state) +exynos_drm_plane_check_format(struct exynos_drm_plane_state *state) { + struct exynos_drm_plane *plane = to_exynos_plane(state->base.plane); struct drm_framebuffer *fb = state->base.fb; switch (fb->modifier) { case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: - if (!(config->capabilities & EXYNOS_DRM_PLANE_CAP_TILE)) + if (!(plane->capabilities & EXYNOS_DRM_PLANE_CAP_TILE)) return -ENOTSUPP; break; @@ -199,12 +199,12 @@ exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config, } static int -exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, - struct exynos_drm_plane_state *state) +exynos_drm_plane_check_size(struct exynos_drm_plane_state *state) { + struct exynos_drm_plane *plane = to_exynos_plane(state->base.plane); bool width_ok = false, height_ok = false; - if (config->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE) + if (plane->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE) return 0; if (state->src.w == state->crtc.w) @@ -213,11 +213,11 @@ exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, if (state->src.h == state->crtc.h) height_ok = true; - if ((config->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && + if ((plane->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && state->h_ratio == (1 << 15)) width_ok = true; - if ((config->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && + if ((plane->capabilities & EXYNOS_DRM_PLANE_CAP_DOUBLE) && state->v_ratio == (1 << 15)) height_ok = true; @@ -231,7 +231,6 @@ exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, static int exynos_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) { - struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); struct exynos_drm_plane_state *exynos_state = to_exynos_plane_state(state); int ret = 0; @@ -242,11 +241,11 @@ static int exynos_plane_atomic_check(struct drm_plane *plane, /* translate state into exynos_state */ exynos_plane_mode_set(exynos_state); - ret = exynos_drm_plane_check_format(exynos_plane->config, exynos_state); + ret = exynos_drm_plane_check_format(exynos_state); if (ret) return ret; - ret = exynos_drm_plane_check_size(exynos_plane->config, exynos_state); + ret = exynos_drm_plane_check_size(exynos_state); return ret; } @@ -292,40 +291,37 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane, drm_plane_create_zpos_property(plane, zpos, 0, MAX_PLANE - 1); } -int exynos_plane_init(struct drm_device *dev, - struct exynos_drm_plane *exynos_plane, unsigned int index, - const struct exynos_drm_plane_config *config) +int exynos_plane_init(struct drm_device *dev, struct exynos_drm_plane *plane, + const uint32_t *pixel_formats, int num_pixel_formats, + enum drm_plane_type type) { int err; unsigned int supported_modes = BIT(DRM_MODE_BLEND_PIXEL_NONE) | BIT(DRM_MODE_BLEND_PREMULTI) | BIT(DRM_MODE_BLEND_COVERAGE); - struct drm_plane *plane = &exynos_plane->base; + struct drm_plane *bplane = &plane->base; - err = drm_universal_plane_init(dev, &exynos_plane->base, + err = drm_universal_plane_init(dev, bplane, 1 << dev->mode_config.num_crtc, &exynos_plane_funcs, - config->pixel_formats, - config->num_pixel_formats, - NULL, config->type, NULL); + pixel_formats, + num_pixel_formats, + NULL, type, NULL); if (err) { DRM_ERROR("failed to initialize plane\n"); return err; } - drm_plane_helper_add(&exynos_plane->base, &plane_helper_funcs); - - exynos_plane->index = index; - exynos_plane->config = config; + drm_plane_helper_add(bplane, &plane_helper_funcs); - exynos_plane_attach_zpos_property(&exynos_plane->base, config->zpos, - !(config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS)); + exynos_plane_attach_zpos_property(bplane, plane->index, + !(plane->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS)); - if (config->capabilities & EXYNOS_DRM_PLANE_CAP_PIX_BLEND) - drm_plane_create_blend_mode_property(plane, supported_modes); + if (plane->capabilities & EXYNOS_DRM_PLANE_CAP_PIX_BLEND) + drm_plane_create_blend_mode_property(bplane, supported_modes); - if (config->capabilities & EXYNOS_DRM_PLANE_CAP_WIN_BLEND) - drm_plane_create_alpha_property(plane); + if (plane->capabilities & EXYNOS_DRM_PLANE_CAP_WIN_BLEND) + drm_plane_create_alpha_property(bplane); return 0; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index ec30d5aca9aa..b61ae3415b8c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -378,21 +378,14 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; struct drm_encoder *encoder = &ctx->encoder; struct exynos_drm_plane *exynos_plane; - struct exynos_drm_plane_config plane_config = { 0 }; unsigned int i; int ret; ctx->drm_dev = drm_dev; - plane_config.pixel_formats = formats; - plane_config.num_pixel_formats = ARRAY_SIZE(formats); - for (i = 0; i < WINDOWS_NR; i++) { - plane_config.zpos = i; - plane_config.type = vidi_win_types[i]; - - ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, - &plane_config); + ret = exynos_plane_init(drm_dev, &ctx->planes[i], formats, + ARRAY_SIZE(formats), vidi_win_types[i]); if (ret) return ret; } diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 1faa67fa7e5c..750f682e9c31 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -122,37 +122,6 @@ struct mixer_drv_data { bool has_sclk; }; -static const struct exynos_drm_plane_config plane_configs[MIXER_WIN_NR] = { - { - .zpos = 0, - .type = DRM_PLANE_TYPE_PRIMARY, - .pixel_formats = mixer_formats, - .num_pixel_formats = ARRAY_SIZE(mixer_formats), - .capabilities = EXYNOS_DRM_PLANE_CAP_DOUBLE | - EXYNOS_DRM_PLANE_CAP_ZPOS | - EXYNOS_DRM_PLANE_CAP_PIX_BLEND | - EXYNOS_DRM_PLANE_CAP_WIN_BLEND, - }, { - .zpos = 1, - .type = DRM_PLANE_TYPE_CURSOR, - .pixel_formats = mixer_formats, - .num_pixel_formats = ARRAY_SIZE(mixer_formats), - .capabilities = EXYNOS_DRM_PLANE_CAP_DOUBLE | - EXYNOS_DRM_PLANE_CAP_ZPOS | - EXYNOS_DRM_PLANE_CAP_PIX_BLEND | - EXYNOS_DRM_PLANE_CAP_WIN_BLEND, - }, { - .zpos = 2, - .type = DRM_PLANE_TYPE_OVERLAY, - .pixel_formats = vp_formats, - .num_pixel_formats = ARRAY_SIZE(vp_formats), - .capabilities = EXYNOS_DRM_PLANE_CAP_SCALE | - EXYNOS_DRM_PLANE_CAP_ZPOS | - EXYNOS_DRM_PLANE_CAP_TILE | - EXYNOS_DRM_PLANE_CAP_WIN_BLEND, - }, -}; - static const u8 filter_y_horiz_tap8[] = { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, @@ -1151,18 +1120,33 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) struct exynos_drm_plane *exynos_plane; unsigned int i; int ret; + static enum drm_plane_type types[] = { DRM_PLANE_TYPE_PRIMARY, + DRM_PLANE_TYPE_CURSOR, DRM_PLANE_TYPE_OVERLAY }; ret = mixer_initialize(ctx, drm_dev); if (ret) return ret; - for (i = 0; i < MIXER_WIN_NR; i++) { - if (i == VP_DEFAULT_WIN && !test_bit(MXR_BIT_VP_ENABLED, - &ctx->flags)) - continue; + for (i = 0; i < VP_DEFAULT_WIN; i++) { + ctx->planes[i].index = i; + ctx->planes[i].capabilities = EXYNOS_DRM_PLANE_CAP_DOUBLE | + EXYNOS_DRM_PLANE_CAP_ZPOS | + EXYNOS_DRM_PLANE_CAP_PIX_BLEND | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND; + ret = exynos_plane_init(drm_dev, &ctx->planes[i], mixer_formats, + ARRAY_SIZE(mixer_formats), types[i]); + if (ret) + return ret; + } - ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, - &plane_configs[i]); + if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) { + ctx->planes[i].index = i; + ctx->planes[i].capabilities = EXYNOS_DRM_PLANE_CAP_SCALE | + EXYNOS_DRM_PLANE_CAP_ZPOS | + EXYNOS_DRM_PLANE_CAP_TILE | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND; + ret = exynos_plane_init(drm_dev, &ctx->planes[i], vp_formats, + ARRAY_SIZE(vp_formats), types[i]); if (ret) return ret; }