From patchwork Thu Dec 6 09:38:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10715519 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 5CF4D1932 for ; Thu, 6 Dec 2018 09:39:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2F32DEE7 for ; Thu, 6 Dec 2018 09:39:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 419FF2DF88; Thu, 6 Dec 2018 09:39:11 +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 C1BAE2DEE7 for ; Thu, 6 Dec 2018 09:39:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729386AbeLFJjJ (ORCPT ); Thu, 6 Dec 2018 04:39:09 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:59876 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728250AbeLFJjJ (ORCPT ); Thu, 6 Dec 2018 04:39:09 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181206093907euoutp012b89edc72946dae930d2613be65a63d7~ttOYTUo7C0138001380euoutp01g; Thu, 6 Dec 2018 09:39:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181206093907euoutp012b89edc72946dae930d2613be65a63d7~ttOYTUo7C0138001380euoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544089147; bh=/Of+01NoeBh09Fw1Vho3ylGUZPrL4XAAD3DuVw+WSTM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=k5YF2nvFZCoE0tHz5lFMudGQlZoRoftM8jHcVPJ8cRxks63atk6TIpEZrowCyQ4PU TvPMJEfwz3AOP39AA8wI7a4oILsIxF79A/zkfOjSC8rfqjJ4DwWO246BSW6tD2bkbQ P9SJOruWhUC29+CegExXKKo6YRwW3D3PzdyA3EPY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181206093907eucas1p2edf92cd8c1d1e888b51f2f1eee29c5fc~ttOX1bI521559615596eucas1p2H; Thu, 6 Dec 2018 09:39:07 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3E.BA.04441.A3EE80C5; Thu, 6 Dec 2018 09:39:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181206093906eucas1p212ab2e090927466e001dcec001a441c5~ttOXKbpbW1195011950eucas1p2p; Thu, 6 Dec 2018 09:39:06 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-bf-5c08ee3ab330 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id BE.44.04128.A3EE80C5; Thu, 6 Dec 2018 09:39:06 +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 <0PJB000UL6T4U830@eusync1.samsung.com>; Thu, 06 Dec 2018 09:39:05 +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 1/3] drm/exynos/decon5433: add dynamic zpos support Date: Thu, 06 Dec 2018 10:38:55 +0100 Message-id: <20181206093857.22324-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181206093857.22324-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsWy7djP87pW7zhiDB6c1LK4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzcksSy3St0vg ylj8QaWgSaLiSONGpgbGBSJdjJwcEgImEpNfbWDrYuTiEBJYwSgxbetyFgjnM6PE42sfmGCq rrXPZ4JILGOU6F/4gBnC+c8o8WTxBmaQKjYBTYm/m2+ygdgiAsoSq/a1s4MUMQtcYpR4fbKb ESQhLOAs8WXDVzCbRUBV4u3hTWDNvAIWEsf7F7FDrJOXWL3hAFicU8BS4v2aJywQ8Y+sEjNP WUPYLhKNR65DxYUlXh3fAtUrI3F5cjdUvF6iaeYVsEslBDoYJU4sXs4GkbCWOHz8IiuIzSzA JzFp23SgIg6gOK9ER5sQRImHxLtFO6Bh0cMocfflDvYJjJILGBlWMYqnlhbnpqcWG+allusV J+YWl+al6yXn525iBMbY6X/HP+1g/Hop6RCjAAejEg/viwfsMUKsiWXFlbmHGCU4mJVEeBn0 OGKEeFMSK6tSi/Lji0pzUosPMUpzsCiJ81YzPIgWEkhPLEnNTk0tSC2CyTJxcEo1MJp9ONUi +sewZI+0oydfx8PSwz/2s3dUTi4V/tv6NMcjSSbWTu15+5egczYNv066aDIcfz3RT/J7PVuh 0PncCtHrt1c1n570Xjul4wEvn9imR83f72y42r39yrx5DdOnLWKv9pV5ZCIYE+WxWUU0+Ufg h7xtrtnT5CJf97A1ySxo2Fjx4nu1oBJLcUaioRZzUXEiAEEaHvCtAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7pW7zhiDCadYLS4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzcksSy3St0vg ylj8QaWgSaLiSONGpgbGBSJdjJwcEgImEtfa5zN1MXJxCAksYZQ4eesuG4TTyCQx48wjVpAq NgFNib+bb7KB2CICyhKr9rWzgxQxC1xhlGj/1sUOkhAWcJb4suErI4jNIqAq8fbwJmYQm1fA QuJ4/yJ2iHXyEqs3HACLcwpYSrxf84QFxBYCqpm0fCf7BEaeBYwMqxhFUkuLc9Nzi430ihNz i0vz0vWS83M3MQLDY9uxn1t2MHa9Cz7EKMDBqMTD++IBe4wQa2JZcWXuIUYJDmYlEV4GPY4Y Id6UxMqq1KL8+KLSnNTiQ4zSHCxK4rznDSqjhATSE0tSs1NTC1KLYLJMHJxSDYwOEk03nYOP 8TfLiCz/vKBl5Ymajwcft8+Yfrt+75uZv15opdrzOcxfdvzP/Mf3A1T/bJVQN+KKeftu78aa iU/D22/s4X1mpbmzj9XaKJgznvPu/ROpTMG3Xr3//lFM9su5quu+nPq7r7B94uNet8yx8tfr nE82Nk/frYqyljEvWKG3OUEqbtYjJZbijERDLeai4kQAs7pZhQsCAAA= X-CMS-MailID: 20181206093906eucas1p212ab2e090927466e001dcec001a441c5 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181206093906eucas1p212ab2e090927466e001dcec001a441c5 References: <20181206093857.22324-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 | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index aef487dd8731..6e3e6e970690 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -326,7 +326,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); @@ -376,19 +376,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); @@ -462,7 +461,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); @@ -531,7 +530,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, }; @@ -552,6 +550,7 @@ 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 = EXYNOS_DRM_PLANE_CAP_ZPOS; ret = exynos_plane_init(drm_dev, &ctx->planes[win], win, &ctx->configs[win]);