From patchwork Thu Mar 22 10:23:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10301205 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 A75C260385 for ; Thu, 22 Mar 2018 10:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 997E829AA1 for ; Thu, 22 Mar 2018 10:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E90B29AA4; Thu, 22 Mar 2018 10:25:16 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 3A97829AA1 for ; Thu, 22 Mar 2018 10:25:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89AB16EBE5; Thu, 22 Mar 2018 10:25:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0056.outbound.protection.outlook.com [104.47.40.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B4B66EBD6 for ; Thu, 22 Mar 2018 10:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=e9RuFjDRn8Gno+3SnCrooinr8UzvaS6yi7oHvoaFqM0=; b=Y6TXcr5SzyWZo1PfCzGGv6l0Yv4VxWG4bf8j82YMrDw1cbYvTXNeFMak1Cr4J3OVFUfdJZDsaNo9afcsdIhBKiJbk7KwnulEDoPGiKOHvw43uuovjq250zcPjnPIDdxihsuBP1CpRCdTNUi6i8YMBjFxrnHIgu4FWQx4H78cRms= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; Received: from localhost.localdomain (155.4.205.56) by DM2PR05MB767.namprd05.prod.outlook.com (2a01:111:e400:244d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Thu, 22 Mar 2018 10:24:44 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org, linux-graphics-maintainer@vmware.com Subject: [PATCH -next 08/11] drm/vmwgfx: Stricter count of legacy surface device resources Date: Thu, 22 Mar 2018 11:23:49 +0100 Message-Id: <20180322102352.2881-8-thellstrom@vmware.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180322102352.2881-1-thellstrom@vmware.com> References: <20180322102352.2881-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR0502CA0021.eurprd05.prod.outlook.com (2603:10a6:3:e3::31) To DM2PR05MB767.namprd05.prod.outlook.com (2a01:111:e400:244d::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f11d7dc9-cb53-47f5-85ee-08d58fdf21b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR05MB767; X-Microsoft-Exchange-Diagnostics: 1; DM2PR05MB767; 3:AdmoiJAcKlHuEl4Gw6apCG09scWNw8++GHQjytt19F3rgunmFkcpKwQBZeCFVM1bBv8LI+k5mPOfD4C56JGgXuGAqQntl2B1CUTidrxVBMxqxbil+dquhBxLGQTg6V8NUTvCpglpypp+5v9Pb5y6QjHRiS3jWKtUDbq7ulonLAI0Gm1PgeTBU/vx4xbkMEIX07tm/BRi4tc2TbwCn2jWQOkkTPJJwKFtcaCTGDKGO0S/wljqA0sRjoIboA40sdCd; 25:iEvSEX+Y68mnMlFDWkatnQhJrJvMneqvq0Gf94vsDcRcxQB+37Yhhuxjj9XF6bq3UgYHOMeDRNkzMHvx+zfOR155PWGUMzcNGmwsvUGrCCm6cLPOLN2idN5bi4DwoWuFCObrQWxqPzRfDPDNInqGWZRkgQJJtYQYxPlqcEjTYqzRJ9ThTHyYvg7SF9kvtj9JlHD0FLz8XMU4nPuZ5OGeHt7Xqmgi5MTxm1Xj+v6XoqyGEpIwvUdxY7cXO1w9ViMAHN+G+MFGPp8MtOVvUfH7zFG6cCYyEfk1EDkh6yPj3kkJYzYm4IAw+Py3khV2EIee512FIbbxx2a3czcWJayeb927HmKad5kTwv2exdVGseg=; 31:s8F/l58LxlNJTmyGYmlNa2L+9eSlUAZY6JNOH4IeSe7/HRmgaC25JkFBYrsjF3csTEjRp0CheqjFXgC8j7JAmjcGmq5RKULeaSwdUBANeVjNYRT23zy6Pr0+waQPK550+W31keg0ZJjJk3vgnm8Xpj4Iv4v5du2t1xyW+5/Bi6LLxX4rSaV/nefYamP9Yxc9RBY+qFESZowG/tNM/M9otab+j0tfZuw5dGTvaXiLg6s= X-MS-TrafficTypeDiagnostic: DM2PR05MB767: X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM2PR05MB767; 20:ev2VrCCcofKwvfswjO/8R89Zgifcu736o0btWFqqoWRv3icQt21uQLq22PDnkk2U8PqTBlYh+ARxuYLiBk+KAMveCo/BcrFIdkCKU81foX16rH6TCsjlGjMk+W0Xd4K424lkLe3lyFF0hBCzdgIxxulWh6Nl8ZxPtF8UEwuZtS/mA8tswtiS5qz4YefCCKY8j1O5mDmGiPl4atdm/ole/g7SzHQL7XvFxIjoEIbxmYihcvTSlvB7mTmSfvPMnHyecLBakJ7voP568vB8yZ16tnPoRN+6MNPtrE+f37WXSb8a/WGCgn2DTY17HjdLw9MtlXO5ybzEI+CvzZ0LZG/PEDcjFvotxcJKExIqBDFGyymbStCT+2UMH5BpIJAi2zJ03J7sHY7MdGgahQNe3kDlrViWDmmHq7fc9DxECzkMJ3RUvkF1gq5YbvYRE1XCjYYQMHC2BuC6wPQfbLoGh89e8le7HXVPYSeI86Xj0nyRpVDM+N9dKU7p42P6vLbcd7fW; 4:SPfD54+ehTPJVP58WkySBnwkI0Lu9hCmjDEQZozqaLrN7FC0WZe/PB+oi37yh8cPcVM8YzcXQ5tqADxunEiUGQCVCzreLDZ4wIfx9RKVPyRN8Fc8Pvfhdpx0YSCU6jasId2gvjesw8qc50QNkfSmst4vRIQez94+HiPEKz5EZxUsfRy0zSsszG5X4Ijx5CIrlAbOTy++AFXJ2FXZdCsK80OrYE2PQ94PV/T6vCUH9tteBwngUItgnfx1DtlLZpZs1oG2T1y6sofB13pI4BnGKZ1sRuwxHcWEfqt1qcmmLxu+89cYx5ADpZIf7rimCbHs X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR05MB767; BCL:0; PCL:0; RULEID:; SRVR:DM2PR05MB767; X-Forefront-PRVS: 0619D53754 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(39380400002)(376002)(396003)(39860400002)(366004)(199004)(189003)(76176011)(8676002)(81156014)(316002)(68736007)(5660300001)(305945005)(8936002)(50226002)(16586007)(36756003)(81166006)(86362001)(50466002)(6486002)(48376002)(186003)(16526019)(6512007)(53936002)(6636002)(6506007)(386003)(2950100002)(25786009)(6116002)(52116002)(106356001)(105586002)(51416003)(47776003)(3846002)(26005)(1076002)(2906002)(97736004)(7736002)(66066001)(478600001)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR05MB767; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR05MB767; 23:K6xVpj6+YLx6vVX+8+4BrPaqYYBY0+ysvDXNmnTDnm?= =?us-ascii?Q?t7EqM9i31yPRZnEeg7TweiXGEvHvGj3fENBo9H5jzfiI5S7hjqx1ZlIks3sf?= =?us-ascii?Q?v9NYz2Gs6l5t61vs+0keaU3WVe6qvcbB+88INpqaVis1CqvO6HIlaEiXs7sd?= =?us-ascii?Q?aACny7FvchHHV9eugf5Naou9Fne6WQEU70xbzpxUfXDzqu9e1r/hb/9Ezfpg?= =?us-ascii?Q?IR+CvD+nY3pBqtQUN/aDLIEIFHgl9MnvQ/OfStKor6OcgjsapIxaPf/TMc8P?= =?us-ascii?Q?PRi/xMpDrmWmKi3dlKoRPQeTEat4BbGaArjM1KUU18o3S47nkv1yitZK3C4g?= =?us-ascii?Q?YYIJZeOo5bUGgjkMaN+bOjcIraLUJTImSHuxYV64PMwmwEIqUBLDmiT7J3Pd?= =?us-ascii?Q?SlF6/ikwKskKUpQAZR0lhvNUAglv6bf8SgxdB3HAZw34Pp9YYt8cvh16SdIs?= =?us-ascii?Q?K4Gj2t9szzQst7IDD7GHOUyJ5zvRlIofZ5L0gHs74p6lduD7Oh7DVJsadtUR?= =?us-ascii?Q?mV0vWnzQyC8UgEELCyUAwARlDADEQo6r3P751neAMa8ZlDS32XhqlCMR+Isu?= =?us-ascii?Q?O3D9kfexZ7ztwXjYdZm/196kT/r8AqPlanCG+/cdPXu+/7GpEtnS1+Ue4qJA?= =?us-ascii?Q?PCca0cCYg/8BKqrD+h9EdQUVGYPbYSDRDhtGoUz23WYwChX80U6+2DUmKJq2?= =?us-ascii?Q?/IrZKXS5K5VaLHTpw1qEPFRm8Vh0yja6TQo/wuRn+G2x+Da8GCe08lhuyNHY?= =?us-ascii?Q?AKGK0DAgy2QvaFV1Qp9Ql6uS4ZpnIbesK9f3bY5+wrHKGCMbQ35OJLwufjic?= =?us-ascii?Q?rOSJGu3kJ68kD+5K+dFVzbEB547c4u7cpz6tbHF06hUiROg6Hi9PPEs+ZCcj?= =?us-ascii?Q?tfJwDTKFyvAb5/2xIZ/CgUsAb5eFbZHSGEN9wkMlL7iMpa4To5d2LG0nsnHk?= =?us-ascii?Q?awNl+MG8ZUk8dShCcRkklBaICKJwom6IB5Q8NAgNitKSZ8tY4SFN90MEZjIO?= =?us-ascii?Q?apelGTybgDM3V82suoMwNa29GWvMAoK4z/clMIZbbNFikTWihzDOPzCfyo47?= =?us-ascii?Q?ArxgaNQQAaPQCb3OhdOxOevc2oaHYCq9HlqmHli8NR5QEPO049ArS2W2b867?= =?us-ascii?Q?c8hvLAB6Q=3D?= X-Microsoft-Antispam-Message-Info: 33Dq5jEXzKlbbcbhKvNNsRQ2FGA+dTX7GgAN7xv8V7ZTRjnt9385raeB1ENGG57IlOltAKL065IV410SQchGIbRG9yjBim5UIhQzI6G8yL/QJrCDUyZMYZc4tlDX3mpwtsQKZcr6h04jkqyegZm9+61ItrRhO7/7wJ2FCQv/s7Mze41nHNaVWhpdEzPon7vZ X-Microsoft-Exchange-Diagnostics: 1; DM2PR05MB767; 6:Kv70rPoCuXl0LuWs55qMhiiZR1HtojF4ToecVZmi4HlXhRfXPCgWW+8jd0XT2lmbI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ZeXZ7WjYsU4GPGuGgrAd/yQuduJishoneeo5VpV3OqiKIQFpxcC30gxAHl+++Mlp7Mv0OBZ03PP6Mr3rrWGqK4e778DEj2YaqJkvIK9cvrW+/RMRdvSVwUk/6Ir34dJb2y40= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2018 10:24:44.1944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f11d7dc9-cb53-47f5-85ee-08d58fdf21b2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR05MB767 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For legacy surfaces, they were previously registered as device resources when the driver resources were created. Since they are evictable we instead register them as device resources once they are created on the device, just like for guest-backed surfaces. This has implications during hibernation where we can't hibernate with device resources active. Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Deepak Rawat Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index db1bb166845e..b236c48bf265 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -345,7 +345,6 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res) dev_priv->used_memory_size -= res->backup_size; mutex_unlock(&dev_priv->cmdbuf_mutex); } - vmw_fifo_resource_dec(dev_priv); } /** @@ -407,6 +406,8 @@ static int vmw_legacy_srf_create(struct vmw_resource *res) vmw_surface_define_encode(srf, cmd); vmw_fifo_commit(dev_priv, submit_size); + vmw_fifo_resource_inc(dev_priv); + /* * Surface memory usage accounting. */ @@ -558,6 +559,7 @@ static int vmw_legacy_srf_destroy(struct vmw_resource *res) */ vmw_resource_release_id(res); + vmw_fifo_resource_dec(dev_priv); return 0; } @@ -579,15 +581,11 @@ static int vmw_surface_init(struct vmw_private *dev_priv, struct vmw_resource *res = &srf->res; BUG_ON(!res_free); - if (!dev_priv->has_mob) - vmw_fifo_resource_inc(dev_priv); ret = vmw_resource_init(dev_priv, res, true, res_free, (dev_priv->has_mob) ? &vmw_gb_surface_func : &vmw_legacy_surface_func); if (unlikely(ret != 0)) { - if (!dev_priv->has_mob) - vmw_fifo_resource_dec(dev_priv); res_free(res); return ret; }