From: Inki Dae Subject: drm/exynos: Unreference fb in exynos_disable_plane() Date: Wed, 21 Nov 2012 12:42:53 +0900 Message-ID: <1353469373-29399-1-git-send-email-inki.dae@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 580A7E6497 for ; Tue, 20 Nov 2012 19:42:56 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDT00A1BJMG0BE0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 21 Nov 2012 12:42:54 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDT00JHIJNIBZ70@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 21 Nov 2012 12:42:54 +0900 (KST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: airlied@linux.ie, dri-devel@lists.freedesktop.org Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, YoungJun Cho List-Id: dri-devel@lists.freedesktop.org From: YoungJun Cho This patch is for unreferencing the (current)fb if plane->fb is existed in exynos_disable_plane(). In exynos_update_plane(), the new fb reference count can be bigger than 1. So it can't be removed for that reference count. And this patch is based on exynos-drm-next. Signed-off-by: YoungJun Cho Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_plane.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 083fd5f..dc7e057 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -161,13 +161,15 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, if (plane->fb) drm_framebuffer_unreference(plane->fb); + plane->fb = fb; + /* * Take a reference to new fb. * * Taking a reference means that this plane's dma is going to access * memory region to the new fb. */ - drm_framebuffer_reference(fb); + drm_framebuffer_reference(plane->fb); plane->crtc = crtc; exynos_plane_commit(plane); @@ -180,6 +182,14 @@ static int exynos_disable_plane(struct drm_plane *plane) { DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); + /* + * Unreference the (current)fb if plane->fb is existed. + * In exynos_update_plane(), the new fb reference count can be bigger + * than 1. So it can't be removed for that reference count. + */ + if (plane->fb) + drm_framebuffer_unreference(plane->fb); + exynos_plane_dpms(plane, DRM_MODE_DPMS_OFF); return 0; -- 1.7.4.1