From patchwork Wed Mar 21 09:53:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10299029 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 523C760386 for ; Wed, 21 Mar 2018 09:54:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FFBF29704 for ; Wed, 21 Mar 2018 09:54:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 344EE29779; Wed, 21 Mar 2018 09:54:32 +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 114F729704 for ; Wed, 21 Mar 2018 09:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B93026E8FF; Wed, 21 Mar 2018 09:54:29 +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-co1nam03on0617.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::617]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB5446E8FF for ; Wed, 21 Mar 2018 09:54:28 +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=YfNCcbKeW9P33TFn9OKn4a1iNMOhrrLZ8NRmOeBGf4w=; b=X+tc94RnyuSPBB4NvzE2QjaN2MN2nD/EpbhpsjGX2ecmffGWpG+fNgqCzJqklURKR3GMGIOAGa+Ze8VX8w9bQtQggpu6DA/TdhQpyA1LX4Pm4jHSl+CoUpnbaqMWzneETxYn6VbbV56pVtNPjfzUx5Z5cui7Q8KoeczagIGDpwk= Received: from localhost.localdomain (155.4.205.56) by BLUPR05MB755.namprd05.prod.outlook.com (2a01:111:e400:89e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Wed, 21 Mar 2018 09:54:26 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/vmwgfx: Fix black screen and device errors when running without fbdev Date: Wed, 21 Mar 2018 10:53:47 +0100 Message-Id: <20180321095347.3118-2-thellstrom@vmware.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180321095347.3118-1-thellstrom@vmware.com> References: <20180321095347.3118-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR0402CA0006.eurprd04.prod.outlook.com (2603:10a6:3:d0::16) To BLUPR05MB755.namprd05.prod.outlook.com (2a01:111:e400:89e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0de3a9ef-bbde-42db-6a3c-08d58f11bbcb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BLUPR05MB755; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 3:v6NaKZ+YJ48c3EpCtTlQmYQA1ReXnXp/fLnqafHmwvQwkqgxyV2p5vYuoxWCgw2nuYthfffnnEM6Vc+uapsbrRYKZdDaxMyJi0GRvZbY9oPNSf4Eos17lsgTvoELEqfez7qdHa/+blsIIfnxapUQSwMjOZ+ZheSN/ntKDVlRVrrI43hFfuRu3cBSku/aKSBGtFGVwxveaFcK/zGf5mdf80scXfC/jDDTAmKiif/Iws2eSDZWLUdTtgpJKGgT+FVo; 25:gX1EFqLQ3KhNP++0HAcRbpznk81bq1uxStWKNxXS6e510YNKUUkxrvwEFpmO/wRDl5oX8Fppb5gd345ve6obUffMRCwHprv1JRKdbyEtrlzIe1SVDutOLEewEAfCtlLN2GmF8j376EybrqPF5EitUfwYngvYgb4BffKvY7gzJFL4WmJY8tUEkTedMup9KZWgjidC+hFhzYm4Eqvw7RHSMRyHT993+sKplBEC0oyxjSrWsl3v7WuyzNgGgsZYu0xDzXParVyFqg9CPMnvazD8z2FJ/LYMwQxExADHigyiZPt1EdIGBxJjSt5BQ79Jk4WsQRzALsJRfJ53uibd2odCjw==; 31:AEMUhOkpHZ2fabgA1RLvRQ1d8Lv3odlmfv+91M9Zs4YeUep9oHI1Tq6C09gYKklnFAPwUPh1IjaOxaHZ4nsIGKXaJ+4mFTGkcxZWRjYVHSQzMf1UUVtcALOgHdiHLD1p2GIkwvTipOY6TbtPbOLXqzDz9sQGUe3Wb7e0p4Xa5PlmkJZAPKD59bY0XYbxnTvMaxAspARm5q9K6Y8fxkAWSoGgetP73UMVj9Zv0XdMMp8= X-MS-TrafficTypeDiagnostic: BLUPR05MB755: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 20:taID0hukyc1rB+I74oe6dfGsGnATzWU6Rs3MgAxKoVXiE5Nxy/F+TsKEwwtUf5v6jZJMR93eZp/XHm4IhrJ9RqWhShbLn/vbVtwrD4mbI00xYyHgxp8VZhJxiPsRXJG6G5GcAyRM6/1+etbXHh7uEiDeYKuwwnEFzLot3qvnG8yWCByCr/2T0LMqgMW8mrtGXCCDcaeUSQ0wXy3sJ2mmYBYaSQgMNr3/TiBAujNozIzqX06UZveGJhh5MB8DI5+xWaM/fgQSNIbcIeZFkTnmPu/ON8jJKozDXTiaMvCReReLLdCjWz35L6fbZwAImTP88B22+YeoNYvDUhmKIdCjbgvfuOB9HUVea5l3POd5AcOaQwqUmZFz72Cy08Rml3x8Fm4Xb2ovzqGHrYA82F+UascZZAVKbAMd0Xsl43UlVZqunCmvBv8837cEpivKz4OFGKkz4thnkN0h66bMSheJxOlhZMaXpQRSiBmLsvudu9GKDMVeooi76D6GVT+kMrWI; 4:YL3gYLfS0hGPbKB5Yj0HVhl8foDSXL1upDk4hC55evx1EVc8DnhFNtpL+YTTKCifTrdnVmFFRqnAfOWfUjsB52+6Qz9Z9oT+OB/Tz2MRPmXeLYdAFXBKWYiZzlCAUoim/Lkydr3hRBJjZndG/5/IDJh/ioytjEkICAlQnoZMVPU12AQxCamqdHjrlDXBuKzpteLdLOEiBQhV+5my+AJTd0MN5KoFY2BDa0RVcdKT78X02YbZR/pUtOJS2G9FYJUNVBWzm5F/UnCQF/N2hUuz8ijMStUBeE2kU7f22o1D9vcf+OlJL5dIE2MH0CGtHPYTv8IiSs8/wv6q1kXoZz/4IH5wQuGUsr1sm8oQeGdP/T8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150)(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501321)(52105095)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:BLUPR05MB755; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB755; X-Forefront-PRVS: 0618E4E7E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(366004)(396003)(376002)(39860400002)(39380400002)(189003)(199004)(81166006)(8936002)(16586007)(305945005)(7736002)(5660300001)(68736007)(81156014)(8676002)(2906002)(26005)(51416003)(52116002)(6506007)(1857600001)(76176011)(16526019)(386003)(186003)(6666003)(53936002)(2950100002)(6512007)(6916009)(36756003)(50226002)(47776003)(2361001)(6486002)(66066001)(2351001)(50466002)(48376002)(86362001)(106356001)(105586002)(478600001)(1076002)(97736004)(6116002)(4326008)(25786009)(3846002)(59450400001)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB755; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; BLUPR05MB755; 23:Qcz5yTWnLKEYW+wIubZYYoySSemp0JBGTFd7d76s40?= =?us-ascii?Q?IsrZC0JaDkNSrKueckcioEvwvMZyaX0afDD0PqMgOZxJPGQIlJoSZ+1ttCA1?= =?us-ascii?Q?PJkY0V/Kl2Vyqy1t56K/L3L/teVaIB9gn7JHBCaamDqLZYzO73h/ccw/hXB2?= =?us-ascii?Q?haLc4C1boF0HhEDVB5iRNl7k+8fdBvWlypAfRVWk7BJtxaxQEd/k2VZzWC2e?= =?us-ascii?Q?llnqEfxmQI52tlfdm0D+rvEj/SPx+vofwttROnqVJ0/Rk3WHGDW6mb0othZG?= =?us-ascii?Q?Pcb+ExJ0GMLA63ot6tmEar2he+WozKmlOcCgh+5S4+sT1lV/C7MSaitYcwKw?= =?us-ascii?Q?PwVJlZwTIrNWTNE5aoqdAOv44SWxszPoibXaBT1lI1eK7VYc3ix683oNZtRx?= =?us-ascii?Q?w63MU32T2AkctT5tYzO+ftfUx9acG5dX1gfnIcimC0svBzePcRqc/3+8DSqx?= =?us-ascii?Q?lu67YHoAkZvvrMVHIQa9F3LjdJkVved8AeTuK89q2KQ83Gfu/zRpySGfzq7D?= =?us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VSoeg0ZKx+M1QevheWFi5Gv/JdyF X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 6:G4tS8p+D79zve9EpFZfF2Y9+nuUFn2ywq56rCTot/ONwj47j3kUSIHmoXKePMKQa9DJjAPlw4YCp5N1ZVgwpetlfEZzafBLxQzymj8dtdAqFGx9or19Nz5nE66JK+HjWzS7vbSfVUHngV0LfUr8DdBZXOyREPkXoFuqqcXwcByk/7W+y3ZVSfn8JN00Vw6j70NjcKN7xzM+8IKd67Mxi3dTd7vaWWbT07wk4wDoTOjsCnuRq5dnme37jDngKR2yXSA6Mm7ZFYWMPZUYozcxdU3mgjLGTb/7pQvwz1LOt5+PQDq2Cq8dhlqWA7slibNtJiew9szmFoVAL4lFet3jYacp+Tkql3XAPA25cy70aL5M5CiVEPfveDqLgz5RXt7Rr/8KqPCpOTa4IIGh3Nsoo0Ci5O+J8wDg/bP4TDi34SVr3S+Fz7oLxYqnv5X34G/T91wUt0yD9Y808DnH43zBT6g==; 5:rLYRE4a4uPkM59Ij4oW65td9uVG3hm68fWIZ/9H94HqlmVJP8mdBN3BUwr8FiWV/HH0crls7XkSQODgt/HdbBKLExTTus3Pii5Yi/hUIPBWN+kfOkGB3yLoZ1C+TBhFQRHLgcUeLMK74fGyl8CbMHQ9LMmPSKHCmIF37prCAkeQ=; 24:ydjTR1PRnhJdJf4FZHpKDpjKYMh2pTBqUENp6ngGU42gfwmWGeJ5S7VdzEXwA2cz9hZJqfGhwlsyi4W8ly+LaIpAFuJLYzeYH8rraYxcjJA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 7:aY+3TFssYcEEsu45JFuBZ3264bcc2/QnENIPtTavL2KVfofpst1l2ZXOjXICu2PUqISE/KsLlfcp0ptEEhKVmjt2tVdkJKExaV9rznBX/U4AUeZit8/+PM/5cwdC8GD49otPQY+3bnDLXVfXMLaEowBzrEL4xWqT0v64RCjKYs2ryFfN1ksezSIQyssKCwsdazu33T1trqc0IjtEQTGaqsKHQENa6WBkvWgmaAbj/TMzyT+QMF/DtRs4EYfKDiw0; 20:pXtrZa7XtwiLGXEpVbT2+XJeamqcSDArGJHIIcwTAUWnnEbyt281kc9/E4oAs+bAgPbF4K9cehbMoF6UPp2KiCrmR45l24RpmmAoekGg3A3oraFIDPhkKuOB4pq9Vystma1ic7fAKoGFarGNbSITXNuzdt7UjJNOc01aA+2ZOqo= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2018 09:54:26.2643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0de3a9ef-bbde-42db-6a3c-08d58f11bbcb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB755 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, stable@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When we are running without fbdev, transitioning from the login screen to X or gnome-shell/wayland will cause a vt switch and the driver will disable svga mode, losing all modesetting resources. However, the kms atomic state does not reflect that and may think that a crtc is still turned on, which will cause device errors when we try to bind an fb to the crtc, and the screen will remain black. Fix this by turning off all kms resources before disabling svga mode. Cc: Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 13 +++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 +++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 1 - 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 184340d486c3..86d25f18aa99 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1337,6 +1337,19 @@ static void __vmw_svga_disable(struct vmw_private *dev_priv) */ void vmw_svga_disable(struct vmw_private *dev_priv) { + /* + * Disabling SVGA will turn off device modesetting capabilities, so + * notify KMS about that so that it doesn't cache atomic state that + * isn't valid anymore, for example crtcs turned on. + * Strictly we'd want to do this under the SVGA lock (or an SVGA mutex), + * but vmw_kms_lost_device() takes the reservation sem and thus we'll + * end up with lock order reversal. Thus, a master may actually perform + * a new modeset just after we call vmw_kms_lost_device() and race with + * vmw_svga_disable(), but that should at worst cause atomic KMS state + * to be inconsistent with the device, causing modesetting problems. + * + */ + vmw_kms_lost_device(dev_priv->dev); ttm_write_lock(&dev_priv->reservation_sem, false); spin_lock(&dev_priv->svga_lock); if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) { diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index d08753e8fd94..9116fe8baebc 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -938,6 +938,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv); +void vmw_kms_lost_device(struct drm_device *dev); int vmw_dumb_create(struct drm_file *file_priv, struct drm_device *dev, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index ead61015cd79..b3d62aa01a9b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -2851,3 +2851,14 @@ int vmw_kms_set_config(struct drm_mode_set *set, return drm_atomic_helper_set_config(set, ctx); } + + +/** + * vmw_kms_lost_device - Notify kms that modesetting capabilities will be lost + * + * @dev: Pointer to the drm device + */ +void vmw_kms_lost_device(struct drm_device *dev) +{ + drm_atomic_helper_shutdown(dev); +} diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index cd9da2dd79af..948362c43c73 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -439,5 +439,4 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, int vmw_kms_set_config(struct drm_mode_set *set, struct drm_modeset_acquire_ctx *ctx); - #endif