Received: by 10.213.65.68 with SMTP id h4csp833724imn; Tue, 27 Mar 2018 09:37:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx48uYdZ+AnfXSuj5i3SwynwE1Q4de/LE7zloLGk9p66Iv0JSF7Q46n5kl0kiCidPiUZPmQqJ X-Received: by 10.98.204.214 with SMTP id j83mr49425pfk.182.1522168636095; Tue, 27 Mar 2018 09:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522168636; cv=none; d=google.com; s=arc-20160816; b=U7leg2mpLBSLQEl5G0Ar4koXwYG12WFmdLO4U4xq8umFA1qyQs5X26LjTHHyaKPm/o B+kL/PlRq8jUXh2NRLnFQbK9HI3xgAundVpCSoU9B29e5YcIiuWfrDATfzutHaPb9vLX ZDCDbxOs3zqhFt9OxAm5KXTkSzailLMDG9EAEiPBLcLwm/b23E+slGenzB6IzYxIMsxH oxmSiO6kzOZhPsq5ROkQybmSiZiNHyCa1n2oBncM7FQFT6otWy2ET6zY7zj045tz1tjz jmB2m9lthFzyN62kKaYhdLfSKwVnc70lPYvPXYSGCqjcQ7nH0ZX10p0kK/zaASGML4Yj c54Q== 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=d4lMeYYT97FHUsJPJwFsJrZQMMvh2OeVRLNdaWK2o6Y=; b=IO3pe3VEznJZTOdNvYTsgaayhmikGf2IWy7zZ2Qo1Vcpj2+B6D2b6+JxdcWJaSy5om knOduSsAb4dSFqXn3SQadUG3biqlq88YpBcL4XQfUcophuwbWUeZOHQ4vT0xTiqlH9xA 8smRiwvJSbF9VZWuq3wT+K6juhn/MlTOS60E+CEbgYa2etdklxMDNmTK3EB4fP/Npr0/ nZR49JJJwbBzv4LBZQfT5M1A82MC7Y0lirzprAF0XlbXRvZkkcCMyxRNksSQnMpx9qKL 46jVKOb3C/7KGTAKdWONiCayZYwLEv1x/Q/R4NbtLf/uIs28h5NWCj6/TMYRdDOpgbKN zxrQ== 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 m11-v6si1554512pls.337.2018.03.27.09.37.01; Tue, 27 Mar 2018 09:37:16 -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 S1754641AbeC0QgF (ORCPT + 99 others); Tue, 27 Mar 2018 12:36:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45636 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753830AbeC0QgC (ORCPT ); Tue, 27 Mar 2018 12:36:02 -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 F0CD040C; Tue, 27 Mar 2018 16:36:01 +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.14 053/101] drm/vmwgfx: Fix black screen and device errors when running without fbdev Date: Tue, 27 Mar 2018 18:27:25 +0200 Message-Id: <20180327162753.284543437@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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