drm/exynos: fix to set pipe of crtc
authorJoonyoung Shim <jy0922.shim@samsung.com>
Wed, 27 Jun 2012 05:27:02 +0000 (14:27 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 27 Jul 2012 02:13:53 +0000 (11:13 +0900)
It is enough to set pipe of crtc to manager only when do mode_set of
crtc.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_crtc.c
drivers/gpu/drm/exynos/exynos_drm_encoder.c
drivers/gpu/drm/exynos/exynos_drm_encoder.h

index 552e0ebe60bab1864c05f85c08b819dfa6f22cab..a3fa7cd6d36aa241558560f4cc81bde1d992c983 100644 (file)
@@ -67,8 +67,7 @@ static void exynos_drm_crtc_apply(struct drm_crtc *crtc)
 
        exynos_drm_fn_encoder(crtc, overlay,
                        exynos_drm_encoder_crtc_mode_set);
-       exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
-                       exynos_drm_encoder_crtc_commit);
+       exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit);
 }
 
 int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay,
@@ -231,8 +230,7 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
                                        exynos_drm_encoder_dpms_from_crtc);
        }
 
-       exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
-                       exynos_drm_encoder_crtc_commit);
+       exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit);
 }
 
 static bool
@@ -253,6 +251,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 {
        struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
        struct exynos_drm_overlay *overlay = &exynos_crtc->overlay;
+       int pipe = exynos_crtc->pipe;
        int ret;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -268,6 +267,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
                return ret;
 
        exynos_drm_fn_encoder(crtc, overlay, exynos_drm_encoder_crtc_mode_set);
+       exynos_drm_fn_encoder(crtc, &pipe, exynos_drm_encoder_crtc_pipe);
 
        return 0;
 }
index 652b901d8afeea21a89afde15255bf21bb704870..33f3c41869d74c8cfe60f290eeaf4708e28dfcb9 100644 (file)
@@ -30,7 +30,6 @@
 #include "drm_crtc_helper.h"
 
 #include "exynos_drm_drv.h"
-#include "exynos_drm_crtc.h"
 #include "exynos_drm_encoder.h"
 
 #define to_exynos_encoder(x)   container_of(x, struct exynos_drm_encoder,\
@@ -303,8 +302,8 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)
        struct exynos_drm_manager_ops *manager_ops = manager->ops;
        int crtc = *(int *)data;
 
-       if (manager->pipe == -1)
-               manager->pipe = crtc;
+       if (manager->pipe != crtc)
+               return;
 
        if (manager_ops->enable_vblank)
                manager_ops->enable_vblank(manager->dev);
@@ -317,8 +316,8 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
        struct exynos_drm_manager_ops *manager_ops = manager->ops;
        int crtc = *(int *)data;
 
-       if (manager->pipe == -1)
-               manager->pipe = crtc;
+       if (manager->pipe != crtc)
+               return;
 
        if (manager_ops->disable_vblank)
                manager_ops->disable_vblank(manager->dev);
@@ -341,19 +340,10 @@ void exynos_drm_encoder_crtc_plane_commit(struct drm_encoder *encoder,
 
 void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data)
 {
-       struct exynos_drm_manager *manager =
-               to_exynos_encoder(encoder)->manager;
-       int crtc = *(int *)data;
        int zpos = DEFAULT_ZPOS;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
-       /*
-        * when crtc is detached from encoder, this pipe is used
-        * to select manager operation
-        */
-       manager->pipe = crtc;
-
        exynos_drm_encoder_crtc_plane_commit(encoder, &zpos);
 }
 
@@ -429,3 +419,18 @@ void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data)
        if (overlay_ops && overlay_ops->disable)
                overlay_ops->disable(manager->dev, zpos);
 }
+
+void exynos_drm_encoder_crtc_pipe(struct drm_encoder *encoder, void *data)
+{
+       struct exynos_drm_manager *manager =
+               to_exynos_encoder(encoder)->manager;
+       int pipe = *(int *)data;
+
+       DRM_DEBUG_KMS("%s\n", __FILE__);
+
+       /*
+        * when crtc is detached from encoder, this pipe is used
+        * to select manager operation
+        */
+       manager->pipe = pipe;
+}
index eb7d2316847edff9e4faa2940f241e9a19f8739c..14dab25a09f5b99234b64581e982bce6ed41c8f7 100644 (file)
@@ -48,5 +48,6 @@ void exynos_drm_encoder_dpms_from_crtc(struct drm_encoder *encoder,
 void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data);
 void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data);
 void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data);
+void exynos_drm_encoder_crtc_pipe(struct drm_encoder *encoder, void *data);
 
 #endif