From patchwork Fri Dec 7 10:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10717801 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 88C8B417B for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775802DEA7 for ; Fri, 7 Dec 2018 10:02:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BCE82E151; Fri, 7 Dec 2018 10:02:04 +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 2967C2DEA7 for ; Fri, 7 Dec 2018 10:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:43442 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbeLGKCB (ORCPT ); Fri, 7 Dec 2018 05:02:01 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181207100158euoutp02500af3845fda6a410c6864ff4bf77cb1~uBLns8-hI3061430614euoutp02L; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181207100158euoutp02500af3845fda6a410c6864ff4bf77cb1~uBLns8-hI3061430614euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544176918; bh=dORSJ0heDv5reF7Nx27nnHw2HT7cw9u7gcc7hN3ly1g=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=k1DuwbpH0Wq6KmKNwqnw7vnyUkM+NA9aIq2fdfRktp5gK/hmY9fvXZMT3+anqP9bG BKwSjvMfFCbAYHKqNMO79G7Qw8odxo6hOoDAEVzXssDerHR51B9+FI+HeXYayvgSRf 5r6GRskc2FKCF7Ly79V0Rpq7M54cUM47sPcXNfvE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181207100158eucas1p1a939e928cf78ee059a608ff3dc1a09fb~uBLnMrjp_0856608566eucas1p15; Fri, 7 Dec 2018 10:01:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 48.F2.04294.5154A0C5; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e~uBLmT_18S2774027740eucas1p2_; Fri, 7 Dec 2018 10:01:57 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-14-5c0a451566c3 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9B.09.04128.5154A0C5; Fri, 7 Dec 2018 10:01:57 +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 <0PJD006FP2J86Y70@eusync1.samsung.com>; Fri, 07 Dec 2018 10:01:57 +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 REBASED 1/3] drm/exynos/decon5433: add dynamic zpos support Date: Fri, 07 Dec 2018 11:01:50 +0100 Message-id: <20181207100152.30028-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181207100152.30028-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djP87qirlwxBjs3WVrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zfx8/YK54JxsRcdU7gbGJskuRk4OCQETiS/tE9m7GLk4hARWMEpsWvSdDcL5zCixu7ubGaZq Sut+JojEMkaJLbtuQrX8Z5Q4ceMBK0gVm4CmxN/NN9lAbBEBZYlV+9rBipgFLjFKvD7ZzQiS EBbwlngyeRELiM0ioCrx9dFysDivgIXE5N09LBDr5CVWbzgAtppTwFJi+/qrYDdJCLxllXi1 ax07RJGLxNXWpWwQtrDEq+NboOIyEpcnd0MNqpdomnmFGaK5A+jUxcuhGqwlDh+/CHY2swCf xKRt04GKOIDivBIdbUIQJR4SSzZtgAZGD6PEwrMfmScwSi5gZFjFKJ5aWpybnlpslJdarlec mFtcmpeul5yfu4kRGGWn/x3/soNx15+kQ4wCHIxKPLwVDpwxQqyJZcWVuYcYJTiYlUR4lWy5 YoR4UxIrq1KL8uOLSnNSiw8xSnOwKInzVjM8iBYSSE8sSc1OTS1ILYLJMnFwSjUwCm2qbsh7 n5Zw/p5M8t3azb9+OwklHbvWGlnwdd3MtM6l0neW7pY/b3tO4ljOh6YZ31++OmZXLK0rsiy4 VO+tyRWVuaklDUKNEv5K67o+vp5l/3933+zW7Yv3CJ1yyf6y/+IyjadTw/ZdXC9zQWLLoZXr bT42r1h6YZmx7cwVErvXFhjyvGx5lqXEUpyRaKjFXFScCAAfsuaWrgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7qirlwxBn/O8FrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw Zfx8/YK54JxsRcdU7gbGJskuRk4OCQETiSmt+5m6GLk4hASWMEo82f4Iymlkkuh+eZQFpIpN QFPi7+abbCC2iICyxKp97ewgRcwCVxgl2r91sYMkhAW8JZ5MXgTWwCKgKvH10XJGEJtXwEJi 8u4eFoh18hKrNxxgBrE5BSwltq+/CjZUCKhm+efNLBMYeRYwMqxiFEktLc5Nzy020itOzC0u zUvXS87P3cQIDI9tx35u2cHY9S74EKMAB6MSD2+FA2eMEGtiWXFl7iFGCQ5mJRFeJVuuGCHe lMTKqtSi/Pii0pzU4kOM0hwsSuK85w0qo4QE0hNLUrNTUwtSi2CyTBycUg2Mm9wjo7gfPBf9 +GjfFb4bpQJflqROz5za8ORKVf6pf9ZRW/kz7Xw2cfU7hTJuaCtw/Dt5Q+objnslzzjrjVWv puzIE0/+ucPZhfnu7elZbFe3c7guPjmx/ZBBKrfoTIv/VbU5bfVcFistRdoWlzySiZmT0ZF1 Z1/tws1ntnw6X8PkG7JH5U+OEktxRqKhFnNRcSIAZKtkxwsCAAA= X-CMS-MailID: 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181207100157eucas1p25b30167172753f14d0128b0a70e3483e References: <20181207100152.30028-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 DECON has fixed hardware window order. To implement dynamic zpos normalized_zpos of active plane has to be connected to window number, and remaining windows have to be disabled. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 5b4e0e8b23bc..e0fda6da2ccb 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -83,14 +83,6 @@ static const enum drm_plane_type decon_win_types[WINDOWS_NR] = { [CURSON_WIN] = DRM_PLANE_TYPE_CURSOR, }; -static const unsigned int capabilities[WINDOWS_NR] = { - 0, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, - EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, -}; - static inline void decon_set_bits(struct decon_context *ctx, u32 reg, u32 mask, u32 val) { @@ -402,7 +394,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, to_exynos_plane_state(plane->base.state); struct decon_context *ctx = crtc->ctx; struct drm_framebuffer *fb = state->base.fb; - unsigned int win = plane->index; + unsigned int win = state->base.normalized_zpos + ctx->first_win; unsigned int cpp = fb->format->cpp[0]; unsigned int pitch = fb->pitches[0]; dma_addr_t dma_addr = exynos_drm_fb_dma_addr(fb, 0); @@ -452,19 +444,18 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, ~0); } -static void decon_disable_plane(struct exynos_drm_crtc *crtc, - struct exynos_drm_plane *plane) -{ - struct decon_context *ctx = crtc->ctx; - unsigned int win = plane->index; - - decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0); -} - static void decon_atomic_flush(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx; unsigned long flags; + int win = hweight32(crtc->base.state->plane_mask) + ctx->first_win; + + /* disable windows corresponding to disabled planes */ + for (; win < WINDOWS_NR; ++win) { + if (!readl(ctx->addr + DECON_WINCONx(win)) & WINCONx_ENWIN_F) + break; + decon_set_bits(ctx, DECON_WINCONx(win), WINCONx_ENWIN_F, 0); + } spin_lock_irqsave(&ctx->vblank_lock, flags); @@ -538,7 +529,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc) * a destroyed buffer later. */ for (i = ctx->first_win; i < WINDOWS_NR; i++) - decon_disable_plane(crtc, &ctx->planes[i]); + decon_set_bits(ctx, DECON_WINCONx(i), WINCONx_ENWIN_F, 0); decon_swreset(ctx); @@ -607,7 +598,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .disable_vblank = decon_disable_vblank, .atomic_begin = decon_atomic_begin, .update_plane = decon_update_plane, - .disable_plane = decon_disable_plane, .mode_valid = decon_mode_valid, .atomic_flush = decon_atomic_flush, }; @@ -628,7 +618,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data) 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 = capabilities[win]; + ctx->configs[win].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]);