From patchwork Tue Nov 10 13:23:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7590931 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B519E9F392 for ; Tue, 10 Nov 2015 13:25:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E57E120708 for ; Tue, 10 Nov 2015 13:25:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 005C920639 for ; Tue, 10 Nov 2015 13:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753113AbbKJNZA (ORCPT ); Tue, 10 Nov 2015 08:25:00 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:17246 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753107AbbKJNY5 (ORCPT ); Tue, 10 Nov 2015 08:24:57 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXL00JMOP9KMDA0@mailout3.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 10 Nov 2015 13:24:56 +0000 (GMT) X-AuditID: cbfec7f4-f79c56d0000012ee-76-5641f02778f0 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id CD.23.04846.720F1465; Tue, 10 Nov 2015 13:24:55 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NXL00L9RP94NP10@eusync1.samsung.com>; Tue, 10 Nov 2015 13:24:55 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tobias Jakobi , Gustavo Padovan , Javier Martinez Canillas Subject: [PATCH 17/25] drm/exynos: fix clipping when scalling is enabled Date: Tue, 10 Nov 2015 14:23:33 +0100 Message-id: <1447161821-1877-18-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1447161821-1877-1-git-send-email-m.szyprowski@samsung.com> References: <1447161821-1877-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJLMWRmVeSWpSXmKPExsVy+t/xy7rqHxzDDC4vs7K4te4cq8XGGetZ La58fc9msfPBLnaLSfcnsFi8ebuGyeLFvYssFq9fGFrMOL+PyWLtkbvsFjMmv2SzaFv9gdVi 1a4/jA68Hjtn3WX3uN99nMnj3zF2jy39QN7OSXuZPPq2rGL0+LxJLoA9issmJTUnsyy1SN8u gStjZe9+5oK5PBXn+jpYGhg/c3YxcnJICJhIHGv7ywZhi0lcuLceyObiEBJYyihxdE4jO0hC SKCJSeLmbSYQm03AUKLrbRdYg4iAm0TT4ZmsIDazwGFmicNT60BsYQEPiWVLzoD1sgioSizd sRuslxco/nrFY1aIZXIS/1+uAItzAsW3fvzMDLHLXeJm00WWCYy8CxgZVjGKppYmFxQnpeca 6hUn5haX5qXrJefnbmKEBOiXHYyLj1kdYhTgYFTi4Z3wzSFMiDWxrLgy9xCjBAezkggv42vH MCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8c3e9DxESSE8sSc1OTS1ILYLJMnFwSjUwxppqtrPM eX5jyq27u0+0dsy4/rVqgfDv80GuTz4KabTNEbD+Zzfpb2G+r8ailRNstz6b1WJc/Fl+2w1V 96bMALEP+m1tk/z02b85LVYUWHxsy9KQvZwRPRmsl5hmL1nAYn7N0kPyxqMdDt31JQ2MLo4T ufbPvMVwZkvmfEfFcMn8FWzzrS+VKLEUZyQaajEXFScCAM96/e9MAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes calculation of src x/y offset for negative crtc x/y values when scalling is enabled. This fixes possible IOMMU fault when scalling is enabled. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_plane.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index e5af4cd5e287..348bcec30489 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -85,25 +85,26 @@ static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state) src_w = state->src_w >> 16; src_h = state->src_h >> 16; + /* set ratio */ + exynos_state->h_ratio = (src_w << 16) / crtc_w; + exynos_state->v_ratio = (src_h << 16) / crtc_h; + + /* clip to visible area */ actual_w = exynos_plane_get_size(crtc_x, crtc_w, mode->hdisplay); actual_h = exynos_plane_get_size(crtc_y, crtc_h, mode->vdisplay); if (crtc_x < 0) { if (actual_w) - src_x -= crtc_x; + src_x += ((-crtc_x) * exynos_state->h_ratio) >> 16; crtc_x = 0; } if (crtc_y < 0) { if (actual_h) - src_y -= crtc_y; + src_y += ((-crtc_y) * exynos_state->v_ratio) >> 16; crtc_y = 0; } - /* set ratio */ - exynos_state->h_ratio = (src_w << 16) / crtc_w; - exynos_state->v_ratio = (src_h << 16) / crtc_h; - /* set drm framebuffer data. */ exynos_state->src.x = src_x; exynos_state->src.y = src_y;