All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonyoung Shim <jy0922.shim@samsung.com>
To: dri-devel@lists.freedesktop.org
Cc: sw0312.kim@samsung.com
Subject: [PATCH 5/9] drm/exynos: cleanup to get gem object for fb
Date: Tue, 01 Sep 2015 16:22:51 +0900	[thread overview]
Message-ID: <1441092175-18187-5-git-send-email-jy0922.shim@samsung.com> (raw)
In-Reply-To: <1441092175-18187-1-git-send-email-jy0922.shim@samsung.com>

Current codes get first gem object and then again get remain gem
objects. They can be unified to one routine.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index effeb64..5cee148 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -179,27 +179,18 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 	if (!exynos_fb)
 		return ERR_PTR(-ENOMEM);
 
-	obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
-	if (!obj) {
-		DRM_ERROR("failed to lookup gem object\n");
-		ret = -ENOENT;
-		goto err_free;
-	}
-
-	drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
-	exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj);
 	exynos_fb->buf_cnt = drm_format_num_planes(mode_cmd->pixel_format);
 
 	DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
 
-	for (i = 1; i < exynos_fb->buf_cnt; i++) {
+	for (i = 0; i < exynos_fb->buf_cnt; i++) {
 		obj = drm_gem_object_lookup(dev, file_priv,
 				mode_cmd->handles[i]);
 		if (!obj) {
 			DRM_ERROR("failed to lookup gem object\n");
 			ret = -ENOENT;
 			exynos_fb->buf_cnt = i;
-			goto err_unreference;
+			goto err;
 		}
 
 		exynos_gem_obj = to_exynos_gem_obj(obj);
@@ -207,18 +198,20 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
 
 		ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
 		if (ret < 0)
-			goto err_unreference;
+			goto err;
 	}
 
+	drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
+
 	ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
 	if (ret) {
 		DRM_ERROR("failed to init framebuffer.\n");
-		goto err_unreference;
+		goto err;
 	}
 
 	return &exynos_fb->fb;
 
-err_unreference:
+err:
 	for (i = 0; i < exynos_fb->buf_cnt; i++) {
 		struct drm_gem_object *obj;
 
@@ -226,7 +219,7 @@ err_unreference:
 		if (obj)
 			drm_gem_object_unreference_unlocked(obj);
 	}
-err_free:
+
 	kfree(exynos_fb);
 	return ERR_PTR(ret);
 }
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-09-01  7:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  7:22 [PATCH 1/9] drm/exynos: remove exynos_drm_fb_set_buf_cnt() Joonyoung Shim
2015-09-01  7:22 ` [PATCH 2/9] drm/exynos: s/exynos_gem_obj/obj in exynos_drm_fbdev.c Joonyoung Shim
2015-09-01 16:42   ` Gustavo Padovan
2015-09-01  7:22 ` [PATCH 3/9] drm/exynos: cleanup exynos_drm_fbdev_update() Joonyoung Shim
2015-09-01 16:43   ` Gustavo Padovan
2015-09-01  7:22 ` [PATCH 4/9] drm/exynos: update fb_info via only one function Joonyoung Shim
2015-09-01 20:30   ` Gustavo Padovan
2015-09-01  7:22 ` Joonyoung Shim [this message]
2015-09-01 20:31   ` [PATCH 5/9] drm/exynos: cleanup to get gem object for fb Gustavo Padovan
2015-09-01  7:22 ` [PATCH 6/9] drm/exynos: update exynos_drm_framebuffer_init() for multiple buffers Joonyoung Shim
2015-09-01 20:35   ` Gustavo Padovan
2015-09-01 20:39     ` Gustavo Padovan
2015-09-02 10:32     ` Inki Dae
2015-09-01  7:22 ` [PATCH 7/9] drm/exynos: cleanup exynos_user_fb_create() Joonyoung Shim
2015-09-01 20:53   ` Gustavo Padovan
2015-09-01  7:22 ` [PATCH 8/9] drm/exynos: remove exynos_drm_fb_get_buf_cnt() Joonyoung Shim
2015-09-01 20:54   ` Gustavo Padovan
2015-09-01  7:22 ` [PATCH 9/9] drm/exynos: remove buf_cnt from struct exynos_drm_fb Joonyoung Shim
2015-09-01 20:55   ` Gustavo Padovan
2015-09-01 16:41 ` [PATCH 1/9] drm/exynos: remove exynos_drm_fb_set_buf_cnt() Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441092175-18187-5-git-send-email-jy0922.shim@samsung.com \
    --to=jy0922.shim@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.