From patchwork Fri Oct 2 11:40:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Abriou X-Patchwork-Id: 7314871 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43913BEEA4 for ; Fri, 2 Oct 2015 11:41:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CABC20893 for ; Fri, 2 Oct 2015 11:41:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 574FC20880 for ; Fri, 2 Oct 2015 11:41:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC3FD6EDC2; Fri, 2 Oct 2015 04:41:12 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 337406EDB2 for ; Fri, 2 Oct 2015 04:41:11 -0700 (PDT) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id t92BcSfN000401; Fri, 2 Oct 2015 13:40:59 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1x7vaawgwb-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 02 Oct 2015 13:40:59 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4B39E38; Fri, 2 Oct 2015 11:40:38 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2CA5A172F; Fri, 2 Oct 2015 11:40:56 +0000 (GMT) Received: from localhost (10.201.23.35) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 2 Oct 2015 13:40:55 +0200 From: Vincent Abriou To: Subject: [PATCH 1/2] Revert "drm/core: Preserve the fb id on close." Date: Fri, 2 Oct 2015 13:40:38 +0200 Message-ID: <1443786039-12040-1-git-send-email-vincent.abriou@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.201.23.35] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-10-02_08:2015-10-02, 2015-10-02, 1970-01-01 signatures=0 Cc: Daniel Vetter , Fabien Dessenne , Benjamin Gaignard , Vincent Abriou X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 73f7570bc6c853ca1fad24f9d31815b20e405354. This patch need to be revert because it breaks middlewares way of working. As example, modetest and weston, only relies on drmModeRmFB to close CRTC or planes. Keeping this patch will induce weird behavior like a plane displayed with modetest will be visible on weston and vice-versa. We can overcome this by updating the middleware (successfully tested with modetest) to force them to disable CRTC and plane using drmModeSetCrtc or drmModeSetPlane. But it is a long to way and for short term, it is not acceptable to break ABI. Cc: Maarten Lankhorst Cc: David Herrmann Cc: Daniel Vetter Signed-off-by: Vincent Abriou --- drivers/gpu/drm/drm_crtc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e600a5f..626b0a5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -3320,6 +3320,9 @@ int drm_mode_rmfb(struct drm_device *dev, if (!found) goto fail_lookup; + /* Mark fb as reaped, we still have a ref from fpriv->fbs. */ + __drm_framebuffer_unregister(dev, fb); + list_del_init(&fb->filp_head); mutex_unlock(&dev->mode_config.fb_lock); mutex_unlock(&file_priv->fbs_lock); @@ -3491,6 +3494,7 @@ out_err1: */ void drm_fb_release(struct drm_file *priv) { + struct drm_device *dev = priv->minor->dev; struct drm_framebuffer *fb, *tfb; /* @@ -3504,9 +3508,15 @@ void drm_fb_release(struct drm_file *priv) * at it any more. */ list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { + + mutex_lock(&dev->mode_config.fb_lock); + /* Mark fb as reaped, we still have a ref from fpriv->fbs. */ + __drm_framebuffer_unregister(dev, fb); + mutex_unlock(&dev->mode_config.fb_lock); + list_del_init(&fb->filp_head); - /* This drops the fpriv->fbs reference. */ + /* This will also drop the fpriv->fbs reference. */ drm_framebuffer_unreference(fb); } }