All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: sw0312.kim@samsung.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/exynos: update exynos_drm_framebuffer_init() for multiple buffers
Date: Tue, 1 Sep 2015 17:35:13 -0300	[thread overview]
Message-ID: <20150901203513.GH27704@joana> (raw)
In-Reply-To: <1441092175-18187-6-git-send-email-jy0922.shim@samsung.com>

2015-09-01 Joonyoung Shim <jy0922.shim@samsung.com>:

> This modifies exynos_drm_framebuffer_init() to be possible to support
> multiple buffers. Then it can be used by exynos_user_fb_create().
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c    | 36 +++++++++++++++++--------------
>  drivers/gpu/drm/exynos/exynos_drm_fb.h    |  5 ++++-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c |  3 +--
>  3 files changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index 5cee148..8e5d3eb 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -23,7 +23,6 @@
>  #include "exynos_drm_drv.h"
>  #include "exynos_drm_fb.h"
>  #include "exynos_drm_fbdev.h"
> -#include "exynos_drm_gem.h"
>  #include "exynos_drm_iommu.h"
>  #include "exynos_drm_crtc.h"
>  
> @@ -134,36 +133,41 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct drm_framebuffer *fb)
>  struct drm_framebuffer *
>  exynos_drm_framebuffer_init(struct drm_device *dev,
>  			    struct drm_mode_fb_cmd2 *mode_cmd,
> -			    struct drm_gem_object *obj)
> +			    struct exynos_drm_gem_obj **gem_obj,
> +			    int count)
>  {
>  	struct exynos_drm_fb *exynos_fb;
> -	struct exynos_drm_gem_obj *exynos_gem_obj;
> +	int i;
>  	int ret;
>  
> -	exynos_gem_obj = to_exynos_gem_obj(obj);
> -
> -	ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
> -	if (ret < 0)
> -		return ERR_PTR(ret);
> -
>  	exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
>  	if (!exynos_fb)
>  		return ERR_PTR(-ENOMEM);
>  
> -	drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
> -	exynos_fb->exynos_gem_obj[0] = exynos_gem_obj;
> +	exynos_fb->buf_cnt = count;
> +	DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
>  
> -	/* buffer count to framebuffer always is 1 at booting time. */
> -	exynos_fb->buf_cnt = 1;
> +	for (i = 0; i < count; i++) {
> +		ret = check_fb_gem_memory_type(dev, gem_obj[i]);
> +		if (ret < 0)
> +			goto err;
> +
> +		exynos_fb->exynos_gem_obj[i] = gem_obj[i];
> +	}
> +
> +	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) {
> -		kfree(exynos_fb);
> +	if (ret < 0) {
>  		DRM_ERROR("failed to initialize framebuffer\n");
> -		return ERR_PTR(ret);
> +		goto err;
>  	}
>  
>  	return &exynos_fb->fb;
> +
> +err:
> +	kfree(exynos_fb);
> +	return ERR_PTR(ret);
>  }
>  
>  static struct drm_framebuffer *
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h
> index 897d2cf..8900f6b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h
> @@ -14,10 +14,13 @@
>  #ifndef _EXYNOS_DRM_FB_H_
>  #define _EXYNOS_DRM_FB_H
>  
> +#include "exynos_drm_gem.h"
> +
>  struct drm_framebuffer *
>  exynos_drm_framebuffer_init(struct drm_device *dev,
>  			    struct drm_mode_fb_cmd2 *mode_cmd,
> -			    struct drm_gem_object *obj);
> +			    struct exynos_drm_gem_obj **gem_obj,
> +			    int count);
>  
>  /* get gem object of a drm framebuffer */
>  struct exynos_drm_gem_obj *exynos_drm_fb_gem_obj(struct drm_framebuffer *fb,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index 133cf5f..a221f75 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -21,7 +21,6 @@
>  #include "exynos_drm_drv.h"
>  #include "exynos_drm_fb.h"
>  #include "exynos_drm_fbdev.h"
> -#include "exynos_drm_gem.h"
>  #include "exynos_drm_iommu.h"
>  
>  #define MAX_CONNECTOR		4
> @@ -160,7 +159,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
>  
>  	exynos_fbdev->obj = obj;
>  
> -	helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, &obj->base);
> +	helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, &obj, 1);

Do you have any use for this for multiple buffers? I don't see any patch
in this series for multiple buffers. I think we should wait for a user
of multiple buffers to apply this patch.

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

  reply	other threads:[~2015-09-01 20:35 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 ` [PATCH 5/9] drm/exynos: cleanup to get gem object for fb Joonyoung Shim
2015-09-01 20:31   ` 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 [this message]
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=20150901203513.GH27704@joana \
    --to=gustavo@padovan.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jy0922.shim@samsung.com \
    --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.