From patchwork Fri Feb 2 15:11:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10196999 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 95E7E60467 for ; Fri, 2 Feb 2018 15:11:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 862A028EB4 for ; Fri, 2 Feb 2018 15:11:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A17928EA2; Fri, 2 Feb 2018 15:11:33 +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 BA0C128EA2 for ; Fri, 2 Feb 2018 15:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbeBBPLc (ORCPT ); Fri, 2 Feb 2018 10:11:32 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35941 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbeBBPLa (ORCPT ); Fri, 2 Feb 2018 10:11:30 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180202151128euoutp0276f889594ca013ae7265e82550a5b149~Pit6sIjzS1644016440euoutp02x; Fri, 2 Feb 2018 15:11:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180202151128euoutp0276f889594ca013ae7265e82550a5b149~Pit6sIjzS1644016440euoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1517584288; bh=N/JEkLH7cGKK6rJErx1CprF3qZRYC0s7eoJZcU/oPnc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=i8/EKvOA9g453eCAoUjpq6TskII/Kl3rb8Rhalj/wOk7yabxh9D6dSmevEVxvRYrD hsqNpgILwxczQfnmqkPTmHz3AJQRCjF45ij3mf5RLXxE7D1jko9MejtBpHDYwmOig2 3naNhGMPVYVS2XdMIHdwyB/AaJyDsdLtdBKnJRKA= Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180202151127eucas1p131ca3a59d65cf5408e1c0442c4cbff15~Pit5-MmrY0648306483eucas1p1D; Fri, 2 Feb 2018 15:11:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id E5.6C.12867.F9F747A5; 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 20180202151126eucas1p2ef500d65f723cff9e6a4ebb2cb2a08d9~Pit5QnwWY1061410614eucas1p2H; Fri, 2 Feb 2018 15:11:26 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-07-5a747f9f2e2e Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1F.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: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Andrzej Hajda , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/2] drm/exynos: mixer: avoid Oops in vp_video_buffer() Date: Fri, 02 Feb 2018 16:11:23 +0100 Message-id: <20180202151123.31082-3-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+NgFtrFIsWRmVeSWpSXmKPExsWy7djP87rz60uiDJ5sk7S4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3aJt9QdWB3aP+93HmTz+HWP36NuyitHj8ya5AJYoLpuU 1JzMstQifbsEroxTs7+yFEwWrjjWPYmxgXGBQBcjJ4eEgInE5BevmSBsMYkL99azdTFycQgJ LGWUuLzoPyuE85lR4ufFy8wwHR2HTkBVLWOU6Pp5iBHC+c8oMefJYkaQKjYBTYm/m2+ygdgi AiESL298ARvFLHCJUeLWgatgCWEBd4kXD56CNbAIqEocnPOQBcTmFbCQ+LvqNNQ6eYnDb5pY QWxOAUuJLc2nWEAGSQh0sEks/feaFaLIReLOml5GCFtY4tXxLewQtoxEZ8dBJoiGbkaJT/0n 2CGcKYwS/z7MgFphLXH4+EWwScwCfBKTtk0HinMAxXklOtqEIEo8JC5MmsgEEXaUmPyeGeLl HkaJ54sfM05glF7AyLCKUSS1tDg3PbXYWK84Mbe4NC9dLzk/dxMjMEZP/zv+aQfj1xNWhxgF OBiVeHgNskqihFgTy4orcw8xSnAwK4nwbvMFCvGmJFZWpRblxxeV5qQWH2KU5mBREue1jWqL FBJITyxJzU5NLUgtgskycXBKNTBaOPfO/brlzfEZga5X507ZuvTgsS96E0wFJ2uviP2eKnRh w1Pt1Uef3JVpMmRfu+to/zeTCzwzgvhfBT0QW+JiI7bula/gxrhX+U3/nd3lNNS3FJSmPUyW Ovw+oG2ZR1iAn/R1MUUxFu745I+X16ZttBc78OpXjoPVi8I/nhPvT1soWTiJ3yVciaU4I9FQ i7moOBEAgC3tcc0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjluLIzCtJLcpLzFFi42I5/e/4Zd159SVRBr8+mFjcWneO1WLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbtG2+gOrA7vH/e7jTB7/jrF79G1ZxejxeZNcAEsUl01K ak5mWWqRvl0CV8ap2V9ZCiYLVxzrnsTYwLhAoIuRk0NCwESi49AJNghbTOLCvfVANheHkMAS RonfTX/YIZxGJonpx28zg1SxCWhK/N18E6xDRCBEYsvUE8wgRcwCVxglut5dBUsIC7hLvHjw lBHEZhFQlTg45yELiM0rYCHxd9VpZoh18hKH3zSxgticApYSW5pPgdUIAdXMmXiObQIj7wJG hlWMIqmlxbnpucWGesWJucWleel6yfm5mxiBobTt2M/NOxgvbQw+xCjAwajEw3sjvSRKiDWx rLgy9xCjBAezkgjvNl+gEG9KYmVValF+fFFpTmrxIUZpDhYlcd7ePasjhQTSE0tSs1NTC1KL YLJMHJxSDYzVIjqnDpm8KV3B4s17Ry6dJ6VPiuc6/wGjWce/rN82Y1rE/q6XTwOW3q/98G4J 08uTZ6atXtahE/VpMvNmQa2XP882yF4pXcVs5PN6xk1HDnOj/VM/3MrwWb3KfKHLjq7aBpkW rtXHrUp0669t/DNh4+WvvX8lvr07k2hSP6v63e6Liecuz9I2VWIpzkg01GIuKk4EAOcb5w0h AgAA X-CMS-MailID: 20180202151126eucas1p2ef500d65f723cff9e6a4ebb2cb2a08d9 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180202151126eucas1p2ef500d65f723cff9e6a4ebb2cb2a08d9 X-RootMTR: 20180202151126eucas1p2ef500d65f723cff9e6a4ebb2cb2a08d9 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 From: Tobias Jakobi If an interlaced video mode is selected, a IOMMU pagefault is triggered by vp_video_buffer(). Fix the most apparent bugs: - pitch value for chroma plane - divide by two of height and vpos of source and destination Signed-off-by: Tobias Jakobi [ a.hajda: Halved also destination height and vpos, updated commit message ] Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_mixer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index ff7d088c922a..66b7cc2128e7 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -485,7 +485,7 @@ static void vp_video_buffer(struct mixer_context *ctx, chroma_addr[1] = chroma_addr[0] + 0x40; } else { luma_addr[1] = luma_addr[0] + fb->pitches[0]; - chroma_addr[1] = chroma_addr[0] + fb->pitches[0]; + chroma_addr[1] = chroma_addr[0] + fb->pitches[1]; } } else { luma_addr[1] = 0; @@ -508,21 +508,23 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(ctx, VP_IMG_SIZE_Y, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height)); /* chroma plane for NV12/NV21 is half the height of the luma plane */ - vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | + vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[1]) | VP_IMG_VSIZE(fb->height / 2)); vp_reg_write(ctx, VP_SRC_WIDTH, state->src.w); - vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h); vp_reg_write(ctx, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(state->src.x)); - vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y); - vp_reg_write(ctx, VP_DST_WIDTH, state->crtc.w); vp_reg_write(ctx, VP_DST_H_POSITION, state->crtc.x); + if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { + vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h / 2); + vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y / 2); vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h / 2); vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y / 2); } else { + vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h); + vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y); vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h); vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y); }