From patchwork Mon Apr 15 07:58:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Lisovskiy X-Patchwork-Id: 10900261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2A1F17E1 for ; Mon, 15 Apr 2019 07:59:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC7E628864 for ; Mon, 15 Apr 2019 07:59:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D089428869; Mon, 15 Apr 2019 07:59:15 +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=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 8214528864 for ; Mon, 15 Apr 2019 07:59:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69B4789272; Mon, 15 Apr 2019 07:59:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AA4F89272 for ; Mon, 15 Apr 2019 07:59:12 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 00:59:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,352,1549958400"; d="scan'208";a="223601314" Received: from slisovsk-lenovo-ideapad-720s-13ikb.fi.intel.com ([10.237.72.89]) by orsmga001.jf.intel.com with ESMTP; 15 Apr 2019 00:59:09 -0700 From: Stanislav Lisovskiy To: dri-devel@lists.freedesktop.org Subject: [PATCH v1] drm: Do not allow to set NOFB for active primary plane Date: Mon, 15 Apr 2019 10:58:47 +0300 Message-Id: <20190415075847.16483-1-stanislav.lisovskiy@intel.com> X-Mailer: git-send-email 2.17.1 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: ville.syrjala@intel.com, daniel.vetter@ffwll.ch, lakshminarayana.vudum@intel.com, martin.peres@intel.com, juha-pekka.heikkila@intel.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP There was an issue reported from end users, confirmed also locally that when user executes xrandr --output --rotate left/right, the other eDP screen gets blank after rotation. Investigation showed that reason was that primary plane was that screen was for some reason disabled, while cursor plane was still enabled. After some effort it turns out that userspace might wrongly assign NOFB to active primary plane for some reason. Then this gets detected in drm_atomic_helper_check_plane_state, called from ->plane_check and plane gets deactivated, leaving the screen blank and cursor visible. This can be cured by reboot or xrandr off/on sequence for that crtc. This patch is proposal to fix the issue by forbiding fb removal from active primary plane. If one needs to remove fb plane must be disabled first. Not sure if this is correct, however it fixes the issue at least. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375 Signed-off-by: Stanislav Lisovskiy --- drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index ea797d4c82ee..e2f078b302f3 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -229,6 +229,15 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, { struct drm_plane *plane = plane_state->plane; + if (!fb) { + if (plane->state->visible && plane->type == DRM_PLANE_TYPE_PRIMARY) { + DRM_DEBUG_ATOMIC("Not allowed to set [NOFB] for active" + " primary [PLANE:%d:%s] - disable first", + plane->base.id, plane->name); + return; + } + } + if (fb) DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state %p\n", fb->base.id, plane->base.id, plane->name,