From patchwork Tue Jul 3 19:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10504999 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 E842660225 for ; Tue, 3 Jul 2018 19:16:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 839A3286AE for ; Tue, 3 Jul 2018 19:16:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7827B28700; Tue, 3 Jul 2018 19:16:49 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 0EA13286AE for ; Tue, 3 Jul 2018 19:16:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D944E6E8C7; Tue, 3 Jul 2018 19:16:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710057.outbound.protection.outlook.com [40.107.71.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 268D66E8A7 for ; Tue, 3 Jul 2018 19:16:31 +0000 (UTC) Received: from fedoratest.localdomain (155.4.205.56) by DM6PR05MB4587.namprd05.prod.outlook.com (2603:10b6:5:9f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.11; Tue, 3 Jul 2018 19:16:28 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -next 03/15] drm/vmwgfx: Optimize the buffer object swap_notify callback somewhat. Date: Tue, 3 Jul 2018 21:14:48 +0200 Message-Id: <20180703191500.2374-4-thellstrom@vmware.com> X-Mailer: git-send-email 2.18.0.rc1 In-Reply-To: <20180703191500.2374-1-thellstrom@vmware.com> References: <20180703191500.2374-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: DM5PR21CA0042.namprd21.prod.outlook.com (2603:10b6:3:ed::28) To DM6PR05MB4587.namprd05.prod.outlook.com (2603:10b6:5:9f::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 584779fb-f66e-440a-4a2d-08d5e1197ab9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DM6PR05MB4587; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4587; 3:VGboswjHBowvo0kkR3W2+aVc97E4xcFr+nWews7+K3Vc9rxNSh9gb5+jT/C8BZC6lT9+B92jpEUWkfqXfaaqv2AUaFn4+hcJVofyOg8Za3p5dPvOx0uvhlyTx0KbZLqA+P3TMLaaHm7o24dDCZBwjlLhTP+vQI+Vb1qsH4pwBAN+P1E2V262FBd/Tr3Ky8ijQef/uF3fpQhozga2ts8DBNvYFCed7rjnSd45qTzGUHMppSalwCeVNnbXPkZ4L/YX; 25:yYjfWB/sYEjQExZlU52oMv+SVSmHiZPU/f3xjryIpKvwwtsge2hhBAXBCPH9ppWbGlANFgF81UFtbzbNpGdxtsj8RAvKXmf++SGupO2aDtWxnWWVxUEcvh/fQOZTdzats9XRLUteP56sF4WNj6GsNpcwwOdzdaPoPlfuXSVuVUilC81wtZ25LkQoZC6wCVFZlRZT+Y+8LwfWX/teF5x/1hrHErGl5Q5DGSD2rtsPxVDywMp5W4qwYhDq4eGdszh5gHg+HiT2SPAMjC1WKhNq0JisBYbqQcHZd1jqU74d7Ufmci4bCj23uExlOhaKePUK/Wx+3couTt17WgjI6+7Ijg==; 31:AcOUjLzI2xnIECAXXs2UlFx+od93c9tgWwVPGCJevI97HGl7tDRMST2U8nKR9zLhjDUQmabrfKW9lyHbnBvZwvQx+BcvmUVs2uqW5c6hHlq5mJZPnWdGaQSu9IOgR01xReiiMSdseG/LZWF6oYEvJKSuYJ3271XMC16crSIgQFO6TnPbPxfYBITrr7AP6RcOL4hR/lr3i7ZdIXi20HBq30bwJw02R2F5RiJuAmjRoSo= X-MS-TrafficTypeDiagnostic: DM6PR05MB4587: X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4587; 20:WvZxS4soruCknYiYVefia5sf3OlxLLW1/DB6Zfh1tcRUMiS3oflrziDoEdMGoz1rmV3kP1/COw38J/4A9U1B5Pn87BTNzYM+yieJdx0qN8VmwQ5hLTFoZKVCb/uOY1/qMFgqA5dS4W3VEDf8gOEkHFGH8mJq0acCDgHUalWCflLelSrdIBQDrkif98j01lKmsWvdbqmMR/Ewn8GnXxN/8Hc6Pi36LzkZ9WypnczEBI5aOBMGfiqV72h667NOwNa57iiVFOdH2hYBVGn8v0rEPos2CUsJDPOJbcIhIf1flzL4vJCmnJXO0xkuq4hPqoNVDWcSIzmrq1/AMdEu2JT9i3XajjmswyAFsuvgpcZyPHJ44vP2LXkc5C1BaArHuVSt84RzxErr61zXUB3cOromdcwDpjpcPxxUkvA7g3qPFf1cjjq6M9wOKPbGoTDemmUOK97lnHYJMrEPUgfQ/jpm9HIojQMXDFVNEtiTiXXpg9nDt9t+0aoZN9SRO5JbkDIn; 4:Jyn1cW/X21PlCUA2kFoR4xnIJsEV9SzZy5azZzNq997M8i6fQ759zjsdulN437NbYhn/os4Q27HfuUHrnYEGmHFCsyMuzGFoSbq0brta169XJIDRWXSmkDs46i6En6Q/ELTeaAd0d1WJClhVguj/9TQ1IMEPL6J/4YSvG25nfqGgs907sKiQqTq0w+xbKvXU1LqmOeeA44lXjLF0jRetfrQtU64K51Sjz3+kXKdxTeextiYVjHN6y+ng7ZZkOTkeUNKF6U9mA68BZG12yEkRNU7lYOd7RxEPs06PtDhO4KazBko/lRsnBguc4TNx9JeA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DM6PR05MB4587; BCL:0; PCL:0; RULEID:; SRVR:DM6PR05MB4587; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(366004)(39860400002)(396003)(376002)(346002)(199004)(189003)(2361001)(53936002)(76176011)(68736007)(52116002)(51416003)(47776003)(26005)(2351001)(50226002)(16526019)(97736004)(86362001)(386003)(2906002)(6506007)(66066001)(186003)(316002)(16586007)(48376002)(446003)(6486002)(50466002)(11346002)(2616005)(1076002)(956004)(6116002)(6512007)(476003)(81166006)(8676002)(81156014)(36756003)(3846002)(5660300001)(486006)(107886003)(106356001)(305945005)(25786009)(7736002)(4326008)(478600001)(6916009)(105586002)(6666003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR05MB4587; H:fedoratest.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR05MB4587; 23:va+XU17wOUFqUPnHhFEw5K+tYXO1chI4RIgB/Lh7F?= =?us-ascii?Q?DtQvgp7gsU8a3WN6+VnZBGMterl0Fcv8a25UTnCiiIsVCYfn4sIv3WLlyxDO?= =?us-ascii?Q?dLSK3YMaxXU8e5XqBhDhKfzi8o1SkLY+aPPvDa2mwSAByRZT9gF1F0HezWY2?= =?us-ascii?Q?uVBYIcqeu+LgFEwvalo170Z6Q65rU7F3wZqqUjHLLlQBK1h9iMJDRQQZb1Wb?= =?us-ascii?Q?tUptwnjUBnkYBJMvxK8W5Y5hjIR/KTu6lWMJJ1ykCD5CCGonHrII2mrmMYJQ?= =?us-ascii?Q?SQZGtvoX+ewl/bYMkEy6N2roZaZD6PW1YzMxqWtSjQX9CnluY6bmubJiTji6?= =?us-ascii?Q?/MRYHUfDEGeKO4yCulzRus09zv1LnsRYFAxHCjP7jDuCqc0cHt8ysfljGhYQ?= =?us-ascii?Q?wxhisNP6jysg7L6+ZbqxxMtucmwSniytIh0cezEQgd3Q2WecfjEzPeSXc2GF?= =?us-ascii?Q?UKEuvV6ejPSEZGU5iXDM5ACW4L1Eo5bI1Dj6JwAgPdlCXRWpMb6gQprZIiY5?= =?us-ascii?Q?5rmdgcCVmcjOu8fsNXZc8Vi2L2CTD50jCR6lfQ+/iHwd0/JHQzeDXIreYe90?= =?us-ascii?Q?sOXA0jfhlyOyZXS1YYvoJBxnpSNdXqg3RmF8ErDV8ef0BUOBNboNRHqrjduX?= =?us-ascii?Q?gBduCIiyfgE8LeBvAlovIv5AZkFteu1ShYxcz8SW3WNEwgSTImsfy6WQ1Was?= =?us-ascii?Q?vByiD3hFW4fZwM5w8YJsE8XpuYP1NS95F0HUNn6URUU/vgvBtFfjE0kf+I7A?= =?us-ascii?Q?LUF2rLHCzwe/uDdepWF6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snDwo47gE7686NCkzHmSOYUW/aQiimxO9m1xg/roafIs1LZjvUsst+QheWcfjFvgSGKDSXmNhcqB3bUtvl1MecVnNu9piGUEm2bUf/UMye9n4GwuGXAvssSK18NwVkdWLV2kTgyNEFD2A9JlPu05dYM= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 19:16:28.5283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 584779fb-f66e-440a-4a2d-08d5e1197ab9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4587 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , linux-graphics-maintainer@vmware.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Only try to unmap cached maps when the buffer is moved into or out from vram. Otherwise the underlying pages stay the same. Also when unbinding resources from MOBs about to move, make sure we're really moving out of MOB memory. Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Sinclair Yeh Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index d950244798fe..87204ff67c09 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -1105,16 +1105,18 @@ void vmw_bo_move_notify(struct ttm_buffer_object *bo, vbo = container_of(bo, struct vmw_buffer_object, base); /* - * Kill any cached kernel maps before move. An optimization could - * be to do this iff source or destination memory type is in VRAM. + * Kill any cached kernel maps before move to or from VRAM. + * With other types of moves, the underlying pages stay the same, + * and the map can be kept. */ - vmw_bo_unmap(vbo); + if (mem->mem_type == TTM_PL_VRAM || bo->mem.mem_type == TTM_PL_VRAM) + vmw_bo_unmap(vbo); /* * If we're moving a backup MOB out of MOB placement, then make sure we * read back all resource content first, and unbind the MOB from * the resource. */ - if (mem->mem_type != VMW_PL_MOB) + if (mem->mem_type != VMW_PL_MOB && bo->mem.mem_type == VMW_PL_MOB) vmw_resource_unbind_list(vbo); }