drm/msm: Switch to universal plane API's
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 1 Apr 2014 22:22:39 +0000 (15:22 -0700)
committerRob Clark <robdclark@gmail.com>
Wed, 2 Apr 2014 00:18:27 +0000 (20:18 -0400)
Use drm_universal_plane_init() and drm_crtc_init_with_planes() rather
than the legacy drm_plane_init() / drm_crtc_init().  This will ensure
that the proper primary plane is registered with the DRM (and eventually
exposed to userspace in future patches).

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c

index 84c5b13b33c9ed2649a58d2a9d499d6d22ba0a21..fc1cdfa371ce8198ad57021a255758df3af29b61 100644 (file)
@@ -740,6 +740,9 @@ void mdp4_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane)
 
 void mdp4_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane)
 {
+       /* don't actually detatch our primary plane: */
+       if (to_mdp4_crtc(crtc)->plane == plane)
+               return;
        set_attach(crtc, mdp4_plane_pipe(plane), NULL);
 }
 
@@ -791,7 +794,7 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,
 
        INIT_FENCE_CB(&mdp4_crtc->pageflip_cb, pageflip_cb);
 
-       drm_crtc_init(dev, crtc, &mdp4_crtc_funcs);
+       drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp4_crtc_funcs);
        drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs);
 
        mdp4_plane_install_properties(mdp4_crtc->plane, &crtc->base);
index 1e893dd13859817ae33e199b99f0810c59c49732..66f33dba1ebb3e520f3a2bfa1e4473eaeaacd7ba 100644 (file)
@@ -222,6 +222,7 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
        struct drm_plane *plane = NULL;
        struct mdp4_plane *mdp4_plane;
        int ret;
+       enum drm_plane_type type;
 
        mdp4_plane = kzalloc(sizeof(*mdp4_plane), GFP_KERNEL);
        if (!mdp4_plane) {
@@ -237,9 +238,10 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
        mdp4_plane->nformats = mdp4_get_formats(pipe_id, mdp4_plane->formats,
                        ARRAY_SIZE(mdp4_plane->formats));
 
-       drm_plane_init(dev, plane, 0xff, &mdp4_plane_funcs,
-                       mdp4_plane->formats, mdp4_plane->nformats,
-                       private_plane);
+       type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
+       drm_universal_plane_init(dev, plane, 0xff, &mdp4_plane_funcs,
+                                mdp4_plane->formats, mdp4_plane->nformats,
+                                type);
 
        mdp4_plane_install_properties(plane, &plane->base);
 
index f2794021f086f53fc509dea1f3136cf4facfe27d..54afdb2fc32e35cab2d6d07688fec66c319849a2 100644 (file)
@@ -524,6 +524,9 @@ void mdp5_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane)
 
 void mdp5_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane)
 {
+       /* don't actually detatch our primary plane: */
+       if (to_mdp5_crtc(crtc)->plane == plane)
+               return;
        set_attach(crtc, mdp5_plane_pipe(plane), NULL);
 }
 
@@ -559,7 +562,7 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
 
        INIT_FENCE_CB(&mdp5_crtc->pageflip_cb, pageflip_cb);
 
-       drm_crtc_init(dev, crtc, &mdp5_crtc_funcs);
+       drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp5_crtc_funcs);
        drm_crtc_helper_add(crtc, &mdp5_crtc_helper_funcs);
 
        mdp5_plane_install_properties(mdp5_crtc->plane, &crtc->base);
index 0ac8bb5e7e85ef08760ca2fce41ec67558b4415b..47f7bbb9c15ace7bec2606c7d550f30e480c20b1 100644 (file)
@@ -358,6 +358,7 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
        struct drm_plane *plane = NULL;
        struct mdp5_plane *mdp5_plane;
        int ret;
+       enum drm_plane_type type;
 
        mdp5_plane = kzalloc(sizeof(*mdp5_plane), GFP_KERNEL);
        if (!mdp5_plane) {
@@ -373,9 +374,10 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
        mdp5_plane->nformats = mdp5_get_formats(pipe, mdp5_plane->formats,
                        ARRAY_SIZE(mdp5_plane->formats));
 
-       drm_plane_init(dev, plane, 0xff, &mdp5_plane_funcs,
-                       mdp5_plane->formats, mdp5_plane->nformats,
-                       private_plane);
+       type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
+       drm_universal_plane_init(dev, plane, 0xff, &mdp5_plane_funcs,
+                                mdp5_plane->formats, mdp5_plane->nformats,
+                                type);
 
        mdp5_plane_install_properties(plane, &plane->base);