From patchwork Wed Sep 6 10:36:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9940289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 11CD560224 for ; Wed, 6 Sep 2017 10:37:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1751B28B8D for ; Wed, 6 Sep 2017 10:37:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B6F028B90; Wed, 6 Sep 2017 10:37:35 +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=-6.9 required=2.0 tests=BAYES_00,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 497D228B8D for ; Wed, 6 Sep 2017 10:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbdIFKhd (ORCPT ); Wed, 6 Sep 2017 06:37:33 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:35927 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753075AbdIFKhb (ORCPT ); Wed, 6 Sep 2017 06:37:31 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170906103729euoutp017f9e0c7dc94fd1897781c9c9e0e3b9fd~hv3KhJjjG1659916599euoutp01h; Wed, 6 Sep 2017 10:37:29 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170906103729eucas1p26b947e09f6f3047cd76a81bcc5b83421~hv3KBD8k30155201552eucas1p2K; Wed, 6 Sep 2017 10:37:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 6C.50.12743.8EFCFA95; Wed, 6 Sep 2017 11:37:28 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170906103728eucas1p2f32e4a98f0e034c68fa425efb5ac8269~hv3JWPUFI2638126381eucas1p2O; Wed, 6 Sep 2017 10:37:28 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d0000031c7-86-59afcfe82fc0 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 80.FA.20118.8EFCFA95; Wed, 6 Sep 2017 11:37:28 +0100 (BST) Received: from AMDC2768.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 <0OVU00L0NTIFI200@eusync1.samsung.com>; Wed, 06 Sep 2017 11:37:28 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Tobias Jakobi , Daniel Drake Subject: [PATCH 01/10] drm/exynos/mixer: abstract out output mode setup code Date: Wed, 06 Sep 2017 12:36:51 +0200 Message-id: <1504694220-15818-2-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1504694220-15818-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7djPc7ovzq+PNFj6Tsvi1rpzrBYbZ6xn tXg0/zGzxZWv79ksJt2fwGIx4/w+Jou1R+6yW7St/sDqw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qXzs7SAOzwCom iVltvWAJYQEfiRsb/oBNZRFQlTh64SQTiM0r4Cxxtm06O8Q2OYmb5zrBajgFXCROXf8EtcxZ YubDRYwTGHkXMDKsYhRJLS3OTc8tNtIrTswtLs1L10vOz93ECAytbcd+btnB2PUu+BCjAAej Eg+v5YZ1kUKsiWXFlbmHGCU4mJVEeP+eWx8pxJuSWFmVWpQfX1Sak1p8iFGag0VJnLd3z+pI IYH0xJLU7NTUgtQimCwTB6dUA2OcCu+fEnP5Vzcvbqgoua522nZfD8ej198yHitZ/DGIXmf3 +Q6T9w7fRKNjr3gSxESWX3WTnsxgK7hC59jWSqn3O2Sd7M5yqat72l96lz85uUeiQqXSb79C 4dtH5ju7v/i3CLbsOL3F8vTKIOW/Z5dUPYsy+vzjB8eGWboCHRpyZmtZmj+1PFNiKc5INNRi LipOBAChsK/3KQIAAA== X-CMS-MailID: 20170906103728eucas1p2f32e4a98f0e034c68fa425efb5ac8269 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170906103728eucas1p2f32e4a98f0e034c68fa425efb5ac8269 X-RootMTR: 20170906103728eucas1p2f32e4a98f0e034c68fa425efb5ac8269 References: <1504694220-15818-1-git-send-email-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 Mode setup code is called from video plane update and mixer plane update. Lets group it together in mixer_commit function like in case of other Exynos CRTCs. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 0027554..499ebdc 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -473,6 +473,22 @@ static void mixer_stop(struct mixer_context *ctx) usleep_range(10000, 12000); } +static void mixer_commit(struct mixer_context *ctx) +{ + struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; + + /* setup display size */ + if (ctx->mxr_ver == MXR_VER_128_0_0_184) { + u32 val = MXR_MXR_RES_HEIGHT(mode->vdisplay) + | MXR_MXR_RES_WIDTH(mode->hdisplay); + mixer_reg_write(&ctx->mixer_res, MXR_RESOLUTION, val); + } + + mixer_cfg_scan(ctx, mode->vdisplay); + mixer_cfg_rgb_fmt(ctx, mode->vdisplay); + mixer_run(ctx); +} + static void vp_video_buffer(struct mixer_context *ctx, struct exynos_drm_plane *plane) { @@ -553,11 +569,9 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_TOP_C_PTR, chroma_addr[0]); vp_reg_write(res, VP_BOT_C_PTR, chroma_addr[1]); - mixer_cfg_scan(ctx, mode->vdisplay); - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_layer(ctx, plane->index, priority, true); mixer_cfg_vp_blend(ctx); - mixer_run(ctx); + mixer_commit(ctx); spin_unlock_irqrestore(&res->reg_slock, flags); @@ -638,14 +652,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_GRAPHIC_SPAN(win), fb->pitches[0] / fb->format->cpp[0]); - /* setup display size */ - if (ctx->mxr_ver == MXR_VER_128_0_0_184 && - win == DEFAULT_WIN) { - val = MXR_MXR_RES_HEIGHT(mode->vdisplay); - val |= MXR_MXR_RES_WIDTH(mode->hdisplay); - mixer_reg_write(res, MXR_RESOLUTION, val); - } - val = MXR_GRP_WH_WIDTH(state->src.w); val |= MXR_GRP_WH_HEIGHT(state->src.h); val |= MXR_GRP_WH_H_SCALE(x_ratio); @@ -660,18 +666,15 @@ static void mixer_graph_buffer(struct mixer_context *ctx, /* set buffer address to mixer */ mixer_reg_write(res, MXR_GRAPHIC_BASE(win), dma_addr); - mixer_cfg_scan(ctx, mode->vdisplay); - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_layer(ctx, win, priority, true); mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->format->format)); + mixer_commit(ctx); /* layer update mandatory for mixer 16.0.33.0 */ if (ctx->mxr_ver == MXR_VER_16_0_33_0 || ctx->mxr_ver == MXR_VER_128_0_0_184) mixer_layer_update(ctx); - mixer_run(ctx); - spin_unlock_irqrestore(&res->reg_slock, flags); mixer_regs_dump(ctx);