Received: by 10.213.65.68 with SMTP id h4csp861131imn; Tue, 27 Mar 2018 10:06:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx49vI7LXguR+pMYGyZAXn/apJIR3DC6SJGru8es3QTiuk6NLioNN1K14V69cXKfZ9iWHERAP X-Received: by 10.98.70.199 with SMTP id o68mr100946pfi.169.1522170409513; Tue, 27 Mar 2018 10:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522170409; cv=none; d=google.com; s=arc-20160816; b=vcTkGZoT/l78G8NRC/8gZrdWv0GRMKefxhI2Q7lsGsTOqWMflgRlp9FfJ5GmiLQrNl QYOspwyBtO6cUycBirWmgS879TC/rHLBWE13euxsehAQ0mVhkyRhYowYPWXDqbuYSNiH k7+FshIFt7M4N0x7XyANxgTV3sJTG0gs4HLl676enYcOQyfxs5Pn14S7s8TV49HBKdxc e4nVbrh1sVSLqjjqwIHdB0a7AkyYbCwMu10Cq3VVUwz9wmgLk7C+h5gFNTNAB2AnLsns /JWcWOIoB+t0a0IFKkdokAcpydFF0RxzpSrz8txnx5r0qgSAgpz3oY1ycCEbUIHVDlYN oB3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3B8Ki/hqc5GlrTCooHuGa/etaMlRdctw022PDf68UK4=; b=Vg0z8/6H05kAo7dFfMsxxwiXRSRXjd4ifAkkH3c254pmWG8wO3psyJB2FE3oOkBibg THAG1AyKsewLLADUc9Fuc/XjOJEqrUPlP1M2YERZVt8bkiQgB+oAh6auy8xW5B//5PyE QAY9HmE+rBYyDi4LwVmn/5fmO0BMnQuU3xHQmLaZv9nc984Is4/OyAldojZxhCbo3LLq tChoXoGyUdYpIPyl3uFFzXvi0AwGHpS5sy1lAo+L0/CqvwWlbAWcvk61Li41DCMyjSUk WD/2nvlQw9BMiAgVQqeKnv3v3PxDqoO0RNpF15/Elx6EHz5YvhDzbrFSky4EmEYWNAY+ iRTQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si1148950pgc.428.2018.03.27.10.06.35; Tue, 27 Mar 2018 10:06:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbeC0RDU (ORCPT + 99 others); Tue, 27 Mar 2018 13:03:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085AbeC0Qkx (ORCPT ); Tue, 27 Mar 2018 12:40:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A1220D3B; Tue, 27 Mar 2018 16:40:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Hellstrom , Sinclair Yeh Subject: [PATCH 4.15 055/105] drm/vmwgfx: Fix black screen and device errors when running without fbdev Date: Tue, 27 Mar 2018 18:27:35 +0200 Message-Id: <20180327162800.790355890@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Hellstrom commit 140bcaa23a1c37b694910424075a15e009120dbe upstream. 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 Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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 vm */ 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) { --- 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 * 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, --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -2865,3 +2865,14 @@ int vmw_kms_set_config(struct drm_mode_s 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); +} --- 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 int vmw_kms_set_config(struct drm_mode_set *set, struct drm_modeset_acquire_ctx *ctx); - #endif