From: YoungJun Cho <yj44....@samsung.com>

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 <yj44.cho at samsung.com>
Signed-off-by: Inki Dae <inki.dae at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
 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

Reply via email to