From patchwork Fri Feb 2 15:11:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10196997 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 A999260467 for ; Fri, 2 Feb 2018 15:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ACA528EA2 for ; Fri, 2 Feb 2018 15:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FB4328EB7; Fri, 2 Feb 2018 15:11:32 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 2922228EB4 for ; Fri, 2 Feb 2018 15:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751606AbeBBPLb (ORCPT ); Fri, 2 Feb 2018 10:11:31 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35939 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbeBBPLa (ORCPT ); Fri, 2 Feb 2018 10:11:30 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180202151128euoutp02a64d18fb68594273364727ed533d39d1~Pit6g4iYX1600916009euoutp02K; Fri, 2 Feb 2018 15:11:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180202151128euoutp02a64d18fb68594273364727ed533d39d1~Pit6g4iYX1600916009euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1517584288; bh=5KI+3HJWWXVMUmQfwncTbVpmKJMLpBv8EC3MjTAdLZ4=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ZAhpyZnchXNoCXJxdAIDik/EKbzMG4SMgScoHXH000dssv47diDeOYSziYrkm9uOy LXp128v9bwK29a9otuqqdczgOotC9XSbSvDQJha/qXyXu4vrf31ARMFhAbDtSBkKi6 /qvpwJBYO2ap1B26CrS0P4WMF1zNyzPxM7F6H9d4= Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180202151127eucas1p1ec6995fcbe5ddcd58a2e948d250f5040~Pit5wGkZz0648306483eucas1p1B; Fri, 2 Feb 2018 15:11:27 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 45.6C.12867.E9F747A5; Fri, 2 Feb 2018 15:11:27 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180202151126eucas1p2c17ce18d0e235660ba3e3244521fe051~Pit46IPye0444304443eucas1p2n; Fri, 2 Feb 2018 15:11:26 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-04-5a747f9e1637 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 9E.82.18832.E9F747A5; Fri, 2 Feb 2018 15:11:26 +0000 (GMT) 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 <0P3J00JFF3J1K6D0@eusync1.samsung.com>; Fri, 02 Feb 2018 15:11:26 +0000 (GMT) From: Andrzej Hajda To: Inki Dae , Tobias Jakobi Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/2] drm/exynos/mixer: fix synchronization check in interlaced mode Date: Fri, 02 Feb 2018 16:11:22 +0100 Message-id: <20180202151123.31082-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.16.1 In-reply-to: <20180202151123.31082-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWy7djPc7rz60uiDDZMYbG4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3aJt9QdWB3aP+93HmTz+HWP36NuyitHj8ya5AJYoLpuU 1JzMstQifbsEroyJy86zFKzgr9i5dRlrA+Mjni5GDg4JAROJOc38XYycQKaYxIV769m6GLk4 hASWMkpMnvmGBcL5zCix7MxJJpiGOzPjIOLLGCVur3sPVfSfUWLOk8WMIKPYBDQl/m6+yQZi iwiESLy88YUVpIhZ4BKjxOuT3WBFwgKhEhOn32QGsVkEVCWm/FvDCmLzClhITDoCUSMhIC9x +E0TWJxTwFJiS/MpsG0SAj1sEud2nWaGKHKRWPx4PzuELSzx6vgWKFtGorPjIBNEQzejxKf+ E+wQzhRGiX8fZkB1W0scPn4RbAWzAJ/EpG3TmSEe5ZXoaBOCKPGQ6Dx4B2qoo8TPJ3PAbCGB HkaJi6/4JzBKL2BkWMUoklpanJueWmysV5yYW1yal66XnJ+7iREYn6f/Hf+0g/HrCatDjAIc jEo8vAZZJVFCrIllxZW5hxglOJiVRHi3+QKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ89pGtUUK CaQnlqRmp6YWpBbBZJk4OKUaGGcI5qVHff6xXfXoiYlb2h8lMz0SOJ5QyBq/1ZvhttEbfyPn +6tW53Czun64bMM5jeftsf2PnFKfV+rPStfolH2cxPlParXRfu+P3Z8qMhZ6rXr1tmtOZ52P ZIPi773b2x7slucWbDjsHRvyLv66hfat24fWbJXley07p6N5yoRz4qx7v1is8lBiKc5INNRi LipOBABcS4uuywIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Zd159SVRBuvvyFrcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbtG2+gOrA7vH/e7jTB7/jrF79G1ZxejxeZNcAEsUl01K ak5mWWqRvl0CV8bEZedZClbwV+zcuoy1gfERTxcjB4eEgInEnZlxXYycQKaYxIV769m6GLk4 hASWMEp8f3cEymlkkph+/DYzSBWbgKbE38032UBsEYEQiS1TTzCDFDELXGGUaP/WxQ6SEBYI lTjS8p0VxGYRUJWY8m8NmM0rYCEx6Ug3I8Q6eYnDb5rA4pwClhJbmk+xgNhCQDVzJp5jm8DI u4CRYRWjSGppcW56brGhXnFibnFpXrpecn7uJkZgIG079nPzDsZLG4MPMQpwMCrx8N5IL4kS Yk0sK67MPcQowcGsJMK7zRcoxJuSWFmVWpQfX1Sak1p8iFGag0VJnLd3z+pIIYH0xJLU7NTU gtQimCwTB6dUA2NxphFv9r3EnZEqj2vemerP/j8l+LAut+PmFetv7VS7eZBL88d0lnOfC+Ny jqS3+gh02fXsaLZ5fFHnif7hXJ2pU44n2dVM2Jmpt79/S9bW0Pma/+dklxxu9JI7dnb7u9LQ 08vDF19ImXBmWllXlWfMNBeeOcbrdkwWnyEwo/H6u6Svpa8429YqsRRnJBpqMRcVJwIASnFD xSACAAA= X-CMS-MailID: 20180202151126eucas1p2c17ce18d0e235660ba3e3244521fe051 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180202151126eucas1p2c17ce18d0e235660ba3e3244521fe051 X-RootMTR: 20180202151126eucas1p2c17ce18d0e235660ba3e3244521fe051 References: <20180202151123.31082-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 In case of interlace mode video processor registers and mixer config register must be check to ensure internal state is in sync with shadow registers. This patch fixes page-faults in interlaced mode. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_mixer.c | 10 ++++++++++ drivers/gpu/drm/exynos/regs-mixer.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index dc5d79465f9b..ff7d088c922a 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -494,6 +494,7 @@ static void vp_video_buffer(struct mixer_context *ctx, spin_lock_irqsave(&ctx->reg_slock, flags); + vp_reg_write(ctx, VP_SHADOW_UPDATE, 1); /* interlace or progressive scan mode */ val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0); vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP); @@ -711,6 +712,15 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) /* interlace scan need to check shadow register */ if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { + if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) && + vp_reg_read(ctx, VP_SHADOW_UPDATE)) + goto out; + + base = mixer_reg_read(ctx, MXR_CFG); + shadow = mixer_reg_read(ctx, MXR_CFG_S); + if (base != shadow) + goto out; + base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0)); shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0)); if (base != shadow) diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index c311f571bdf9..189cfa2470a8 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h @@ -47,6 +47,7 @@ #define MXR_MO 0x0304 #define MXR_RESOLUTION 0x0310 +#define MXR_CFG_S 0x2004 #define MXR_GRAPHIC0_BASE_S 0x2024 #define MXR_GRAPHIC1_BASE_S 0x2044