From patchwork Tue Apr 25 19:56:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9699547 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 3D88A60245 for ; Tue, 25 Apr 2017 19:57:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 212752866E for ; Tue, 25 Apr 2017 19:57:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 130CC28671; Tue, 25 Apr 2017 19:57:02 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03E652866E for ; Tue, 25 Apr 2017 19:57:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A9D76E046; Tue, 25 Apr 2017 19:56:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 78C2C6E046 for ; Tue, 25 Apr 2017 19:56:57 +0000 (UTC) Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MPdcf-1cyRjw27vt-004kDk; Tue, 25 Apr 2017 21:56:45 +0200 From: Arnd Bergmann To: Liviu Dudau , Brian Starkey , Mali DP Maintainers , David Airlie Subject: [PATCH] drm: mali-dp: use div_u64 for expensive 64-bit divisions Date: Tue, 25 Apr 2017 21:56:53 +0200 Message-Id: <20170425195712.2017230-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:bTeyxsyc2DqZc1PDidG3S/mhKDIHMpmFkAZgSj3UtOtKz9+3N3A Id2rY0zy7tQsYw/Y5uWPBRXPe+entrUa/mI3KMjW9VtOy6f8O23BtZ66QybQbHoUP4yOh1T S/OIl5wX/5pDA3gSrlQ49yJZP01unuP6UvUgOZvhemXN50sJ2GDAiZoJMy5vm9FGnfO9Kl3 WWh1yKoCFoR2/U673w1tA== X-UI-Out-Filterresults: notjunk:1; V01:K0:iOas9D2+5bU=:euyKo264uPhIvEZcotWWi6 eNlebuOtFn/Xfs4GvjhIVyJbELS5M0ia8ugf2eeMLNkZF/shAqX+IKITG/w/+XHyk5VBXbQkm oQfspQLaeK71SyjVizOtI4SvuAZO6wdqxrmvvf1M/MUuZuIVACeUWDF4mAxPuoH9y3nTHPVVr 92UiloZES6hnZJLHZSLyHUY2HT0jSLRTdS25Vpl93eD4TkSKBfEk3z1VSJARqYsuqKszIzIUQ Ts7GHnTb/gF/pV77R/3LkCyAOtOLHsEYh/QG6JiVh5cAOO2bUzgKMd2o7hsq1xobyKYpuoTRg J+rxX8/OWpSU8C4wdQ5kg2JdpgwzhAkvAS9k8IjDbb2SV2t4HnQSSzyRA53VThRUx8wPX5mq+ 1RQUCxKHgbCuSrVh0gUcB5CI89NhnoGXMLCgCO5ar+x/P71DMB8qTZ/xCyJx8mPMOG6gbz627 IP2gWBxS8dgHaJVC6xNSuHLSW3OqN3H3KWFfywBcurBrNNnltV6R1xTCmqcN1vVYrh3N+TNyy FAhPHWhoVL+ptiTl+gkMMrMIqYN25q5U0QWACO/mBHXXtjyhYoCIyL/jhLJ846QPcKyXcqhsJ RULl3oklmYsyO1Eowyt5Mv/fvTPiqYOUm6R/adtJciMaKTZQBP/rxgs+G6LLBmPx4ZoYQrpvG pX8NxCekNikI9l2MKU8lTT6BVGvNEiZbYvJZuNOi9xL0v/1tkzT7A07tlKhpBzhkUIdw= Cc: Arnd Bergmann , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mihail Atanassov X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 32-bit machines, we can't divide 64-bit integers: drivers/gpu/drm/arm/malidp_crtc.o: In function `malidp_crtc_atomic_check': malidp_crtc.c:(.text.malidp_crtc_atomic_check+0x3c0): undefined reference to `__aeabi_uldivmod' malidp_crtc.c:(.text.malidp_crtc_atomic_check+0x3dc): undefined reference to `__aeabi_uldivmod' This calls the div_u64 function explicitly instead. Fixes: 4cea4e9f6690 ("drm: mali-dp: Add plane upscaling support") Signed-off-by: Arnd Bergmann Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_crtc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c index 19f1f3b34691..9446a673d469 100644 --- a/drivers/gpu/drm/arm/malidp_crtc.c +++ b/drivers/gpu/drm/arm/malidp_crtc.c @@ -266,7 +266,6 @@ static int malidp_crtc_atomic_check_scaling(struct drm_crtc *crtc, drm_atomic_crtc_state_for_each_plane_state(plane, pstate, state) { struct malidp_plane *mp = to_malidp_plane(plane); - u64 crtc_w, crtc_h; u32 phase; if (!(mp->layer->id & scaling)) @@ -276,10 +275,10 @@ static int malidp_crtc_atomic_check_scaling(struct drm_crtc *crtc, * Convert crtc_[w|h] to U32.32, then divide by U16.16 src_[w|h] * to get the U16.16 result. */ - crtc_w = (u64)pstate->crtc_w << 32; - crtc_h = (u64)pstate->crtc_h << 32; - h_upscale_factor = (u32)(crtc_w / pstate->src_w); - v_upscale_factor = (u32)(crtc_h / pstate->src_h); + h_upscale_factor = div_u64((u64)pstate->crtc_w << 32, + pstate->src_w); + v_upscale_factor = div_u64((u64)pstate->crtc_h << 32, + pstate->src_h); s->enhancer_enable = ((h_upscale_factor >> 16) >= 2 || (v_upscale_factor >> 16) >= 2);