From patchwork Mon Dec 10 11:18:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10721105 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 5DCF213BF for ; Mon, 10 Dec 2018 11:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064E729608 for ; Mon, 10 Dec 2018 11:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE46629612; Mon, 10 Dec 2018 11:18:42 +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 69D3229613 for ; Mon, 10 Dec 2018 11:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbeLJLSm (ORCPT ); Mon, 10 Dec 2018 06:18:42 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:34144 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbeLJLSl (ORCPT ); Mon, 10 Dec 2018 06:18:41 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181210111840euoutp02bc9df238633234d9d85fd2372f91eecc~u9KcXdEkI2009920099euoutp02o; Mon, 10 Dec 2018 11:18:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181210111840euoutp02bc9df238633234d9d85fd2372f91eecc~u9KcXdEkI2009920099euoutp02o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544440720; bh=Vl9xgLpo86jLpb+DQpAt0+Y5/RecNEwTSYKGxG7OmDs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=EFp97jCuvHKddwgvBcrrqEivghTnWaBpHyhn8e8E25xRJ3s0QbvZnLqQ8FZynIHrF 8ns9kZWUJQo/ZRviMRKQxd67iBM/E4lo5wd/6Z7f9f7CfVdWTN/WOghr07pd4sWJ68 5szDTtd6Q4RcRLxhvel+k7Rz+Dub+OZ5vyPA/nPI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111840eucas1p225e8da8c718ad0c0ba6ff87f823ea6d9~u9Kb3qkQc0965309653eucas1p2o; Mon, 10 Dec 2018 11:18:40 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 73.4A.04806.F8B4E0C5; Mon, 10 Dec 2018 11:18:39 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3~u9KavXJyY0313803138eucas1p2W; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-94-5c0e4b8fef95 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EE.43.04128.E8B4E0C5; Mon, 10 Dec 2018 11:18:38 +0000 (GMT) Received: from AMDC3748.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PJI001ZCQ31VQ20@eusync4.samsung.com>; Mon, 10 Dec 2018 11:18:38 +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 v2 3/3] drm/exynos/fimd: add dynamic zpos support Date: Mon, 10 Dec 2018 12:18:34 +0100 Message-id: <20181210111834.17916-4-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181210111834.17916-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRmVeSWpSXmKPExsWy7djPc7r93nwxBuen6lncWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnL7sDmcb/7OJNH35ZVjB6fN8kFMEdx2aSk5mSWpRbp2yVw ZRz+8pWp4J9KxcfzaxgbGB/JdTFyckgImEisaexmArGFBFYwSnxv0e9i5AKyPzNKrOrtY+xi 5AArmvDEF6JmGaPEoe9mIGEhgf+MEp1ZIGE2AU2Jv5tvsoHYIgLKEqv2tbODjGEWuMQo8fpk NyNIQljAUeL0lrdgNouAqsT7VxuZQWxeAQuJ5s1b2CDukZdYveEAM8h8TgFLiZbHeSBzJAQ+ skq8XfwZqsZFYsGvTUwQtrDEq+Nb2CFsGYnLk7tZIOx6iaaZV5ghmjsYJU4sXg7VbC1x+PhF VhCbWYBPYtK26cwQP/JKdLQJQZR4SDR2trJBwqGHUeLjgVdsExglFzAyrGIUTy0tzk1PLTbO Sy3XK07MLS7NS9dLzs/dxAiMrdP/jn/dwbjvT9IhRgEORiUe3oAm3hgh1sSy4srcQ4wSHMxK Iry6aUAh3pTEyqrUovz4otKc1OJDjNIcLErivNUMD6KFBNITS1KzU1MLUotgskwcnFINjDW+ Ak7LTlxMTP+2L9GnPePKuX+XCzZP0L38/4af+oKamDqTT/fXna/3uSV7/l8aj4KmWcyidd5/ IvadLj3v+cnrjqD/Oy8Lu7iJbDeqtA56Kf2qeunDbs5XJJC84kmqUMiWMtFzsqIVzXeZOJ5u fRz43qPdbNO3v8HGwceSejbM2eX4Yc91ayWW4oxEQy3mouJEAM93+nKpAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t/xa7p93nwxBg2tVha31p1jtdg4Yz2r xZWv79ksJt2fwGIx4/w+Jou1R+6yO7B53O8+zuTRt2UVo8fnTXIBzFFcNimpOZllqUX6dglc GYe/fGUq+KdS8fH8GsYGxkdyXYwcHBICJhITnvh2MXJxCAksYZSYP+cuC4TTyCTx/cgu9i5G Tg42AU2Jv5tvsoHYIgLKEqv2tbODFDELXGGUaP/WBVYkLOAocXrLW0YQm0VAVeL9q43MIDav gIVE8+YtYM0SAvISqzccYAbZzClgKdHyOA/EFAIqmXYgdwIjzwJGhlWMIqmlxbnpucVGesWJ ucWleel6yfm5mxiBobHt2M8tOxi73gUfYhTgYFTi4Q1o4o0RYk0sK67MPcQowcGsJMKrmwYU 4k1JrKxKLcqPLyrNSS0+xCjNwaIkznveoDJKSCA9sSQ1OzW1ILUIJsvEwSnVwLjAawLzrGS5 zNlMDxO6e103fC9b+tw1yNPVyz5r797ZE+rabmiIcBi//n/qvUnpY3/rdN1Xz672Nfz3nXpk zsedL7b6aci+7fha89xl000L74Onrn4pWmC+g3lHs1IyV0X+Saf2r8t3TcyI3Bjk1HpcvsMv ZfXfg6yvxHebz+UXnOFwS/DH8n1KLMUZiYZazEXFiQBsveQGCQIAAA== X-CMS-MailID: 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210111838eucas1p2a75354aae1c2761777b71094b96273c3 References: <20181210111834.17916-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 FIMD 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. v2: fixed pixel format setting Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 46 ++++++++++-------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index a7993f5d8371..46588a14f0c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -228,14 +228,6 @@ static const uint32_t fimd_formats[] = { DRM_FORMAT_ARGB8888, }; -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 fimd_set_bits(struct fimd_context *ctx, u32 reg, u32 mask, u32 val) { @@ -636,12 +628,13 @@ static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, BLENDCON_NEW_8BIT_ALPHA_VALUE); } -static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, - struct drm_framebuffer *fb, int width) +static void fimd_win_set_pixfmt(struct fimd_context *ctx, + struct exynos_drm_plane *plane) { - struct exynos_drm_plane plane = ctx->planes[win]; struct exynos_drm_plane_state *state = - to_exynos_plane_state(plane.base.state); + to_exynos_plane_state(plane->base.state); + unsigned int win = state->base.normalized_zpos; + struct drm_framebuffer *fb = state->base.fb; uint32_t pixel_format = fb->format->format; unsigned int alpha = state->base.alpha; u32 val = WINCONx_ENWIN; @@ -698,7 +691,7 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, * still better to change dma-burst than displaying garbage. */ - if (width < MIN_FB_WIDTH_FOR_16WORD_BURST) { + if (state->src.w < MIN_FB_WIDTH_FOR_16WORD_BURST) { val &= ~WINCONx_BURSTLEN_MASK; val |= WINCONx_BURSTLEN_4WORD; } @@ -781,6 +774,12 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc) if (ctx->suspended) return; + for (i = hweight32(crtc->base.state->plane_mask); i < WINDOWS_NR; i++) { + if (!(readl(ctx->regs + WINCON(i)) & WINCONx_ENWIN)) + break; + fimd_disable_win(ctx, i); + } + for (i = 0; i < WINDOWS_NR; i++) fimd_shadow_protect_win(ctx, i, false); @@ -797,7 +796,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, dma_addr_t dma_addr; unsigned long val, size, offset; unsigned int last_x, last_y, buf_offsize, line_size; - unsigned int win = plane->index; + unsigned int win = state->base.normalized_zpos; unsigned int cpp = fb->format->cpp[0]; unsigned int pitch = fb->pitches[0]; @@ -864,7 +863,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); } - fimd_win_set_pixfmt(ctx, win, fb, state->src.w); + fimd_win_set_pixfmt(ctx, plane); /* hardware window 0 doesn't support color key. */ if (win != 0) @@ -879,17 +878,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, atomic_set(&ctx->win_updated, 1); } -static void fimd_disable_plane(struct exynos_drm_crtc *crtc, - struct exynos_drm_plane *plane) -{ - struct fimd_context *ctx = crtc->ctx; - - if (ctx->suspended) - return; - - fimd_disable_win(ctx, plane->index); -} - static void fimd_enable(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx; @@ -1008,7 +996,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = { .disable_vblank = fimd_disable_vblank, .atomic_begin = fimd_atomic_begin, .update_plane = fimd_update_plane, - .disable_plane = fimd_disable_plane, .atomic_flush = fimd_atomic_flush, .atomic_check = fimd_atomic_check, .te_handler = fimd_te_handler, @@ -1062,7 +1049,10 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) 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 = capabilities[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]); if (ret)