From patchwork Wed Nov 21 03:42:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1777901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id A259B3FC23 for ; Wed, 21 Nov 2012 03:43:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C9C8E6513 for ; Tue, 20 Nov 2012 19:43:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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 epcpsbgm2.samsung.com ( [203.254.230.45]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5F.BE.12699.EBD4CA05; Wed, 21 Nov 2012 12:42:54 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-64-50ac4dbe4401 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7E.BE.12699.EBD4CA05; 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) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org 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> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t8zXd19vmsCDO7f1La48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGWvbl7MX/Oet+PP1MFsD4wnuLkZODgkBE4kjS3oYIWwxiQv3 1rOB2EICyxglrrzVgKn5uO8hUA0XUHw6o8SBUwuYIJz1TBLnZtxlBaliE1CVmLjiPli3iICp RMekpSwgRcwC0xgl3p3fD7ZCWMBWYuWVZUwgNgtQw8Uvz8HivAIuEi1zp0OdoSCx4N5bNoga AYlvkw8BDeIAistKbDrADDJTQmAHm8T2n7Og6iUlDq64wTKBUXABI8MqRtHUguSC4qT0XCO9 4sTc4tK8dL3k/NxNjJCwkt7BuKrB4hCjAAejEg+vxL7VAUKsiWXFlbmHGCU4mJVEeBnk1wQI 8aYkVlalFuXHF5XmpBYfYvQBumQis5Rocj4w5PNK4g2NDYwNDS0NzUwtTQ1wCCuJ8zZ7pAQI CaQnlqRmp6YWpBbBjGPi4JRqYEw23Lu/5MFhrtqW/Pnv2wtOnlnw/dfiCeobbi9hrgy7kXN3 lXLRh68mt5zWbsq2XX5n2bPJCyXUnx0ozHbuTpze5cVyX0rZsWzG9f7XT99fZF+3+4Zr9bPr h05GPnri+9BX/ZrV9Q9Zr0pCNr3S0lR4mtAccDeIbbZU/APdGCOe9Ki+/TbnriQosRRnJBpq MRcVJwIAqnhNglgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsVy+t9jQd19vmsCDO7MVra48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYR1jBlr25ezF/znrfjz9TBb A+MJ7i5GTg4JAROJj/seMkLYYhIX7q1n62Lk4hASmM4oceDUAiYIZz2TxLkZd1lBqtgEVCUm rrjPBmKLCJhKdExaygJSxCwwjVHi3fn9YKOEBWwlVl5ZxgRiswA1XPzyHCzOK+Ai0TJ3OtQ6 BYkF996yTWDkXsDIsIpRNLUguaA4KT3XSK84Mbe4NC9dLzk/dxMjOGyfSe9gXNVgcYhRgINR iYdXYt/qACHWxLLiytxDjBIczEoivAzyawKEeFMSK6tSi/Lji0pzUosPMfoAbZ/ILCWanA+M qbySeENjEzMjSyMzYxNzY2McwkrivM0eKQFCAumJJanZqakFqUUw45g4OKUaGNnOhbhoWLaZ xUie6py4e2XIlunJH572tInfW9Q18WbtasnX23Nnz1x1aH9WiPys2EbDhfdtKyf2X38TevpH jQvDtoavGk1ChksKf+auOaD4ydjk9M+3NjL52TY+Rxbe+yeo8/GAllHuw3NvizT6rnFzBMnL lYpvTky9sfiKTqSwsllrvNL3yUosxRmJhlrMRcWJACmZBUeIAgAA X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, YoungJun Cho X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@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;