From patchwork Mon Apr 15 08:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Lisovskiy X-Patchwork-Id: 10900263 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 90A6C922 for ; Mon, 15 Apr 2019 08:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A9942888A for ; Mon, 15 Apr 2019 08:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EBFF28896; Mon, 15 Apr 2019 08:00:37 +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 292AF2888A for ; Mon, 15 Apr 2019 08:00:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AC6889286; Mon, 15 Apr 2019 08:00:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id B17E789286 for ; Mon, 15 Apr 2019 08:00:35 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 01:00:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,352,1549958400"; d="scan'208";a="149489340" Received: from slisovsk-lenovo-ideapad-720s-13ikb.fi.intel.com ([10.237.72.89]) by FMSMGA003.fm.intel.com with ESMTP; 15 Apr 2019 01:00:31 -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 11:00:10 +0300 Message-Id: <20190415080010.23466-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 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,