Skip to contentSkip to conversation

drm/exynos: Unreference fb in exynos_disable_plane()

PATCH Inki Dae 1 participant 1 message Nov 21, 2012

Subsystems (3)
lore
Share & tools
lore

Inki Dae

author maintainer
#0 lore raw

From: YoungJun Cho <[email protected]>

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.

---
 drivers/gpu/drm/exynos/exynos_drm_plane.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +11 -1
index 083fd5f..dc7e057 100644
@@ -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;
Signature · 1 line
1.7.4.1