@@ -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;