From patchwork Thu Dec 13 11:05:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1871791 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 29E1ADF2EF for ; Thu, 13 Dec 2012 11:09:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01435E689B for ; Thu, 13 Dec 2012 03:09:48 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 248CD4368D for ; Thu, 13 Dec 2012 03:05:27 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c4so1132794eek.36 for ; Thu, 13 Dec 2012 03:05:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=CkWYP8fYcs5J4DCQcImR0j6LCPZ24b10xiES9lsrWuk=; b=JQfiNJul2I9pa6YtvPvL3ojM+fiKvu87CuLiNG+bl++ydQTUTlKB1koILfEDCY0oYj lg2KHn1Dm7wHSqhSBE4gIaT7kNO7s8ZsZ+cC3X03FII+iMvypun3BO6xQoZOephf8Uml aH3NxkPtQDtbvGgfZRdlAqWmlVbSTd7tZDRno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=CkWYP8fYcs5J4DCQcImR0j6LCPZ24b10xiES9lsrWuk=; b=EIeVQiYXZ/BscHyPk2Wc13uhxCJIOr+vsaSJy1uEdm6S13a8cFprArzLAKj8mKg9aa x1KtAxdx6LO5LX0yM7YMfslzUZ4UsDDLYIUv1srKyAOVL9DDCcVJhMx75K/SbMriDWIr ujZ1pX8BfIq/rSF9iBF/YOBSphb+tlH+h0C1iMvsEQBN6c+rhf1jnN1QOkHf9um8mRlq 4j9pSvKIxZGFxBHHk6NkBLtY/VIVp56zEBZihRbt4tSPRWQbChgVyb0fG7Z+gHSggd5K 6QSK3taku4bAs/ugAEBLZzzZHEBOGQUNqhryR2yF3aFkMcPUQjSRdca2t2DAJ22CaNrG uBFQ== Received: by 10.14.221.9 with SMTP id q9mr4478322eep.3.1355396726957; Thu, 13 Dec 2012 03:05:26 -0800 (PST) Received: from biers.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id 6sm2322551eea.3.2012.12.13.03.05.25 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 03:05:26 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Thu, 13 Dec 2012 12:05:19 +0100 Message-Id: <1355396719-25286-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355396719-25286-1-git-send-email-daniel.vetter@ffwll.ch> References: <1355317637-16742-17-git-send-email-daniel.vetter@ffwll.ch> <1355396719-25286-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmJ6Z3Bf1FjIYqoMHQjzFgZiNUfIW/Acq9WcBKMfcZ3fy38HJl99MAJXuVTqLIME6RjlTjq Cc: Nouveau Dev , Intel Graphics Development , Daniel Vetter Subject: [Intel-gfx] [PATCH 2/2] drm/exynos: reorder framebuffer init sequence X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org For user framebuffers it's easier to just inline the exynos_drm_framebuffer_init helper instead of trying to adjust it - most of the things that helper sets up need to be overwritten anyway again due to the multiple backing storage objects support exynos has, but does not use for the fbdev. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/exynos/exynos_drm_fb.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 4ef4cd3..aea6500 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -136,15 +136,15 @@ exynos_drm_framebuffer_init(struct drm_device *dev, return ERR_PTR(-ENOMEM); } + drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); + exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); + ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs); if (ret) { DRM_ERROR("failed to initialize framebuffer\n"); return ERR_PTR(ret); } - drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); - exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); - return &exynos_fb->fb; } @@ -190,9 +190,8 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd) { struct drm_gem_object *obj; - struct drm_framebuffer *fb; struct exynos_drm_fb *exynos_fb; - int i; + int i, ret; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -202,13 +201,13 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, return ERR_PTR(-ENOENT); } - fb = exynos_drm_framebuffer_init(dev, mode_cmd, obj); - if (IS_ERR(fb)) { - drm_gem_object_unreference_unlocked(obj); - return fb; + exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL); + if (!exynos_fb) { + DRM_ERROR("failed to allocate exynos drm framebuffer\n"); + return ERR_PTR(-ENOMEM); } - exynos_fb = to_exynos_fb(fb); + drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); @@ -218,14 +217,23 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, mode_cmd->handles[i]); if (!obj) { DRM_ERROR("failed to lookup gem object\n"); - exynos_drm_fb_destroy(fb); + kfree(exynos_fb); return ERR_PTR(-ENOENT); } exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj); } - return fb; + ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs); + if (ret) { + for (i = 0; i < exynos_fb->buf_cnt; i++) + drm_gem_object_unreference_unlocked(&exynos_fb->exynos_gem_obj[i]->base); + + kfree(exynos_fb); + return ERR_PTR(ret); + } + + return &exynos_fb->fb; } struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb,