From patchwork Mon Mar 19 16:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 132067 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp3108631edb; Mon, 19 Mar 2018 11:02:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELvF27NkA3ZhwRjbB1ZVBcRtEX1IQ5egZv5Mab81w9YnANLvZDcjKU0xM0eNMklDELzVmbro X-Received: by 10.98.11.145 with SMTP id 17mr11032156pfl.150.1521482557541; Mon, 19 Mar 2018 11:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521482557; cv=none; d=google.com; s=arc-20160816; b=KVL8GfbR3XifXrsvBG/urO022YwBa0FaPic/1h5Xl87HPwijAnQN1yMQQYVlCgAWmK r1guL/Y1c7pn91ERyGz1Vse+ZAji68vewdV+jJ3SdEGN2+Xbe5zFYDe/k0Yfbylc9iLV xcuxn/FSpGVhML9pjyafrqLBaL2xK3XxMoCtc+8VdtHzd5x1M5GLpUVyG6jX382GaHky Dqv6qWOmZ6Kvx1gE6yOIMtKutt07QiCDSn8lmfhu6dkr8qq3V4ZRW+/jZUk7PeMoqJg+ mKdIkWtQWFxPCetGUfWiZFbf8yhu84lpPKGnHts3xc0VKVLpGzf2KTBZfiWInVzbhJAm kIMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nb+iVCyDY5UG8klckSOK6TOuIxWuUYY7OL8ZkxKpA9s=; b=spLwMCXEOVotSc4Hbvm9eJJCrCxv8gYV+owVYqBf5yFxB0kpjo7+G6m/B4YoNp4q27 JbRRKcYHizY5bhR2UhM5r9zbRrc2bofygzj1NQPcCiuXuteJR8LgYEnORNytXWgZnpUv CDilXnboJH4JeDK9Hs9YfAopsbGzVigxPmRBlor4019Rd1JPj6Xnw1NinmkHyW9kUiSZ ajVcaCkHsc6Z9vd9ikuluwRvVBk77QKqkUBMmFzJv0enDEHSVdF+lYT9NunYhEeXqX++ lNoF4l4Z85ie8hAWofspmRo1kEID5bbobmEJ81iixeG9R4rZmSjTpOCHQ9K7o6eq/1aJ uq/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=mCOe1AgE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si402702plf.98.2018.03.19.11.02.37; Mon, 19 Mar 2018 11:02:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=mCOe1AgE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967814AbeCSSCe (ORCPT + 28 others); Mon, 19 Mar 2018 14:02:34 -0400 Received: from mail-by2nam01on0098.outbound.protection.outlook.com ([104.47.34.98]:46928 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965621AbeCSQD7 (ORCPT ); Mon, 19 Mar 2018 12:03:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nb+iVCyDY5UG8klckSOK6TOuIxWuUYY7OL8ZkxKpA9s=; b=mCOe1AgEmr/BSwBzkAdh8p6RrOB1vUUKqSdd6TlFARvCHxBzfYylKzOMovdDN7qcCujAzLuSXurTB5WZUDO1NC6EVVAqHP3H/bbiVVbyHxQhDju0ZQk3Bm57o0agLaOEjtnRhC9VV7XLoiLbrsQGXUjYQVgA0I/xpeWpgTgOFD0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1077.namprd21.prod.outlook.com (52.132.130.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.1; Mon, 19 Mar 2018 16:03:51 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:51 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Tomi Valkeinen , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 189/281] drm/omap: fix tiled buffer stride calculations Thread-Topic: [PATCH AUTOSEL for 4.9 189/281] drm/omap: fix tiled buffer stride calculations Thread-Index: AQHTv5uP1sk4NU8/t06zbKJwZr0tmA== Date: Mon, 19 Mar 2018 16:01:36 +0000 Message-ID: <20180319155742.13731-189-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1077; 7:CJsmzA5gBmdwMFAc0zd381BCQS7L1DQmoT6yR9bVgD71rzCutFYXi3FxNXJcpISBVaGHq6iaXThy0f3x0rFKF90+7b0hw+mpcRyszZ57bZzHA0s7yBmtxs34uXZFeNXH8HWYXE+kuRflWkzrPmi7VxvYFQL4l8tOluRGOCgDvSOKuBK7YdKCbXJn/eIv7P0G/1Wp+GR4U50RM31XAwSXYAv4aiiTGpA4i2z6dfNb6jdtTUg6ROUCQHU2ZUUpPB5M; 20:6jX48nDp34tVwq3TnhUwU8k1a/NOFtDSK/oMPZLMW/rWZJwRv2Yx0zwD4ssz+TXMQ9kduZK+SXGmEcHTwv8JKZHge7YeXSic5Khr0BiEtwbAc6UHawEhuOZ45Ypu7VOjAddmiBBGOrnnt+XEiHjc8Fnh/AOazvudDyt1WxiSctc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: abe234c8-5670-44d0-645d-08d58db30248 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1077; x-ms-traffictypediagnostic: DM5PR2101MB1077: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(31051911155226)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1077; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1077; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(396003)(39380400002)(366004)(199004)(189003)(110136005)(36756003)(3280700002)(66066001)(3660700001)(4326008)(6666003)(2950100002)(25786009)(86612001)(105586002)(10090500001)(68736007)(22452003)(99286004)(106356001)(5660300001)(7736002)(305945005)(76176011)(54906003)(5250100002)(97736004)(316002)(2501003)(3846002)(6116002)(1076002)(2906002)(14454004)(2900100001)(6512007)(8936002)(186003)(478600001)(10290500003)(53936002)(575784001)(8676002)(107886003)(6436002)(81166006)(86362001)(6506007)(59450400001)(102836004)(26005)(72206003)(6486002)(81156014)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1077; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: T37hc7G9LgBoyM/KaWslyCzaU/iLQ37PXUmMdo8eoOiDXYIr0n+3AVbQWbi1vkH8ac2kL+HADL38Eg04vevETFe8HI9VUbNAj9x75YCnXIGensVnH1caAOEY4lRZXknXIHvr+RjOQ5OKD7uj5EtNUd98KliJ5mmfzKhXDEIjvo0vawEOUFMVcso/ZIGZI7fsoHGieMdvU93+5LqAUsW8NaVf+320RlcMg8lFBk40ES8faFmrhOP//QmjIJejga0FicvhJGow7+x/eXeVSH4t46GPPepL8QyhS34U9EHMI6+v8tj911LnPRJtDWVddn2S5vvNnb3Isdb2vdfMZErLCg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: abe234c8-5670-44d0-645d-08d58db30248 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:36.9962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1077 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomi Valkeinen [ Upstream commit cc8dd7661ccc2d8dc88921da8e6cc7c2fcdb0341 ] omap_gem uses page alignment for buffer stride. The related calculations are a bit off, though, as byte stride of 4096 gets aligned to 8192, instead of 4096. This patch changes the code to use DIV_ROUND_UP(), which fixes those calculations and makes them more readable. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.14.1 diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 505dee0db973..ca91651be3d4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -195,7 +195,7 @@ static void evict_entry(struct drm_gem_object *obj, size_t size = PAGE_SIZE * n; loff_t off = mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); if (m > 1) { int i; @@ -442,7 +442,7 @@ static int fault_2d(struct drm_gem_object *obj, * into account in some of the math, so figure out virtual stride * in pages */ - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); /* We don't use vmf->pgoff since that has the fake offset: */ pgoff = ((unsigned long)vmf->virtual_address -