CHROMIUM: drm/exynos: fbdev: Pass gem object to fbdev_update
authorDaniel Kurtz <djkurtz@chromium.org>
Thu, 3 Jan 2013 03:09:19 +0000 (11:09 +0800)
committerChromeBot <chrome-bot@google.com>
Sat, 12 Jan 2013 01:26:15 +0000 (17:26 -0800)
Simplify fbdev creation by just passing the just created gem object to
fbdev_update.  The gem object's buffer is always valid (or else the gem
object creation itself would have failed).

This cleans up fbdev creation by removing some unneccessary error
handling.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chromium-os:37097
TEST=splash screen displays properly w/out HDMI
TEST=splash screen displays properly w/ HDMI

Change-Id: I922d6daa44420cad4b90ef980bb7fe928e2efd16
Reviewed-on: https://gerrit.chromium.org/gerrit/40444
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
drivers/gpu/drm/exynos/exynos_drm_fbdev.c

index ec66326..7293516 100644 (file)
@@ -73,15 +73,15 @@ static struct fb_ops exynos_drm_fb_ops = {
        .fb_setcmap     = drm_fb_helper_setcmap,
 };
 
-static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
-                                    struct drm_framebuffer *fb,
-                                    unsigned int fb_width,
-                                    unsigned int fb_height)
+static void exynos_drm_fbdev_update(struct drm_fb_helper *helper,
+                                   struct drm_framebuffer *fb,
+                                   struct exynos_drm_gem_obj *exynos_gem_obj,
+                                   unsigned int fb_width,
+                                   unsigned int fb_height)
 {
        struct fb_info *fbi = helper->fbdev;
        struct drm_device *dev = helper->dev;
-       struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
-       struct exynos_drm_gem_buf *buffer;
+       struct exynos_drm_gem_buf *buffer = exynos_gem_obj->buffer;
        unsigned int size = fb->width * fb->height * (fb->bits_per_pixel >> 3);
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -89,20 +89,11 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
        drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
        drm_fb_helper_fill_var(fbi, helper, fb_width, fb_height);
 
-       /* RGB formats use only one buffer */
-       buffer = exynos_drm_fb_buffer(exynos_fb, 0);
-       if (!buffer) {
-               DRM_LOG_KMS("buffer is null.\n");
-               return -EFAULT;
-       }
-
        dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr;
        fbi->screen_base = buffer->kvaddr;
        fbi->fix.smem_start = (unsigned long)(buffer->dma_addr);
        fbi->screen_size = size;
        fbi->fix.smem_len = size;
-
-       return 0;
 }
 
 static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
@@ -171,12 +162,9 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
                goto out;
        }
 
-       ret = exynos_drm_fbdev_update(helper, helper->fb, sizes->fb_width,
-                       sizes->fb_height);
-       if (ret < 0) {
-               fb_dealloc_cmap(&fbi->cmap);
-               goto out;
-       }
+       /* RGB formats use only one buffer */
+       exynos_drm_fbdev_update(helper, helper->fb, exynos_gem_obj,
+                       sizes->fb_width, sizes->fb_height);
 
 /*
  * if failed, all resources allocated above would be released by