vigs: change trivial crtc and fb architecture 38/67038/6
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Sun, 24 Apr 2016 09:21:09 +0000 (18:21 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 3 May 2016 08:37:39 +0000 (01:37 -0700)
Change-Id: I82297673407ae54f24be267ecc85554e30f70a14
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
drivers/gpu/drm/vigs/vigs_crtc.c
drivers/gpu/drm/vigs/vigs_fbdev.c
drivers/gpu/drm/vigs/vigs_output.c

index cb06587..b3daee6 100644 (file)
@@ -5,6 +5,7 @@
 #include "vigs_comm.h"
 #include "vigs_fbdev.h"
 #include "drm_crtc_helper.h"
+#include "drm_plane_helper.h"
 #include <linux/console.h>
 
 static int vigs_crtc_update(struct drm_crtc *crtc,
@@ -20,8 +21,8 @@ static int vigs_crtc_update(struct drm_crtc *crtc,
      * root surface has been updated.
      */
 
-    if (!crtc->fb) {
-        DRM_ERROR("crtc->fb is NULL\n");
+    if (!crtc->primary->fb) {
+        DRM_ERROR("crtc->primary->fb is NULL\n");
         return -EINVAL;
     }
 
@@ -29,7 +30,7 @@ static int vigs_crtc_update(struct drm_crtc *crtc,
         vigs_old_fb = fb_to_vigs_fb(old_fb);
     }
 
-    vigs_fb = fb_to_vigs_fb(crtc->fb);
+    vigs_fb = fb_to_vigs_fb(crtc->primary->fb);
 
     if (vigs_fb->surfaces[0]->scanout) {
 retry:
@@ -247,7 +248,7 @@ static int vigs_crtc_page_flip(struct drm_crtc *crtc,
 {
     unsigned long flags;
     struct vigs_device *vigs_dev = crtc->dev->dev_private;
-    struct drm_framebuffer *old_fb = crtc->fb;
+    struct drm_framebuffer *old_fb = crtc->primary->fb;
     int ret = -EINVAL;
 
     mutex_lock(&vigs_dev->drm_dev->struct_mutex);
@@ -267,10 +268,10 @@ static int vigs_crtc_page_flip(struct drm_crtc *crtc,
                       &vigs_dev->pageflip_event_list);
         spin_unlock_irqrestore(&vigs_dev->drm_dev->event_lock, flags);
 
-        crtc->fb = fb;
+        crtc->primary->fb = fb;
         ret = vigs_crtc_update(crtc, old_fb);
         if (ret != 0) {
-            crtc->fb = old_fb;
+            crtc->primary->fb = old_fb;
             spin_lock_irqsave(&vigs_dev->drm_dev->event_lock, flags);
             if (atomic_read(&vigs_dev->drm_dev->vblank[0].refcount) > 0) {
                 /*
@@ -302,7 +303,7 @@ static void vigs_crtc_disable(struct drm_crtc *crtc)
 
     DRM_DEBUG_KMS("enter\n");
 
-    if (!crtc->fb) {
+    if (!crtc->primary->fb) {
         /*
          * No current framebuffer, no need to notify the host.
          */
@@ -310,7 +311,7 @@ static void vigs_crtc_disable(struct drm_crtc *crtc)
         return;
     }
 
-    vigs_fb = fb_to_vigs_fb(crtc->fb);
+    vigs_fb = fb_to_vigs_fb(crtc->primary->fb);
 
     vigs_comm_set_root_surface(vigs_dev->comm, 0, 0, 0);
 
index b7169d4..11468ea 100644 (file)
@@ -19,11 +19,11 @@ static bool vigs_fbdev_helper_is_bound(struct drm_fb_helper *fb_helper)
     int bound = 0, crtcs_bound = 0;
 
     list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-        if (crtc->fb) {
+        if (crtc->primary->fb) {
             crtcs_bound++;
         }
 
-        if (crtc->fb == fb_helper->fb) {
+        if (crtc->primary->fb == fb_helper->fb) {
             bound++;
         }
     }
@@ -500,6 +500,9 @@ int vigs_fbdev_create(struct vigs_device *vigs_dev,
 
     (*vigs_fbdev)->base.funcs = &vigs_fbdev_funcs;
 
+    drm_fb_helper_prepare(vigs_dev->drm_dev, &(*vigs_fbdev)->base,
+            &vigs_fbdev_funcs);
+
     ret = drm_fb_helper_init(vigs_dev->drm_dev,
                              &(*vigs_fbdev)->base,
                              1, 1);
@@ -560,7 +563,5 @@ void vigs_fbdev_restore_mode(struct vigs_fbdev *vigs_fbdev)
 {
     DRM_DEBUG_KMS("enter\n");
 
-    drm_modeset_lock_all(vigs_fbdev->base.dev);
-    drm_fb_helper_restore_fbdev_mode(&vigs_fbdev->base);
-    drm_modeset_unlock_all(vigs_fbdev->base.dev);
+    drm_fb_helper_restore_fbdev_mode_unlocked(&vigs_fbdev->base);
 }
index 15248ee..b192208 100644 (file)
@@ -92,7 +92,7 @@ static int vigs_connector_get_modes(struct drm_connector *connector)
 
     DRM_DEBUG_KMS("enter\n");
 
-    if (fb_get_options(drm_get_connector_name(connector), &option) == 0) {
+    if (fb_get_options(connector->name, &option) == 0) {
         struct drm_cmdline_mode cmdline_mode;
 
         if (drm_mode_parse_command_line_for_connector(option,