All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Stefan Christ <s.christ@phytec.de>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm/cma-helper: Add multi buffer support for cma fbdev
Date: Thu, 9 Feb 2017 18:04:38 +0100	[thread overview]
Message-ID: <20170209170438.am73guria3rymybb@phenom.ffwll.local> (raw)
In-Reply-To: <9b4f80f213b50959d168e6f22b21ee784fe26da5.1486031436.git-series.maxime.ripard@free-electrons.com>

On Thu, Feb 02, 2017 at 11:31:56AM +0100, Maxime Ripard wrote:
> From: Xinliang Liu <xinliang.liu@linaro.org>
> 
> This patch add a config to support to create multi buffer for cma fbdev.
> Such as double buffer and triple buffer.
> 
> Cma fbdev is convient to add a legency fbdev. And still many Android
> devices use fbdev now and at least double buffer is needed for these
> Android devices, so that a buffer flip can be operated. It will need
> some time for Android device vendors to abondon legency fbdev. So multi
> buffer for fbdev is needed.
> 
> Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
> [s.christ@phytec.de: Picking patch from
>                      https://lkml.org/lkml/2015/9/14/188]
> Signed-off-by: Stefan Christ <s.christ@phytec.de>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/Kconfig             | 8 ++++++++
>  drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index ebfe8404c25f..2ca9bb26a4e4 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -121,6 +121,14 @@ config DRM_KMS_CMA_HELPER
>  	help
>  	  Choose this if you need the KMS CMA helper functions
>  
> +config DRM_CMA_FBDEV_BUFFER_NUM
> +	int "Cma Fbdev Buffer Number"
> +	depends on DRM_KMS_CMA_HELPER
> +	default 1
> +	help
> +	  Defines the buffer number of cma fbdev.  Default is one buffer.
> +	  For double buffer please set to 2 and 3 for triple buffer.
> +
>  source "drivers/gpu/drm/i2c/Kconfig"
>  
>  source "drivers/gpu/drm/arm/Kconfig"
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 81b3558302b5..e3f8b9e720a0 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -411,6 +411,12 @@ static void drm_fbdev_cma_defio_fini(struct fb_info *fbi)
>  	kfree(fbi->fbops);
>  }
>  
> +static int fbdev_num_buffers = CONFIG_DRM_CMA_FBDEV_BUFFER_NUM;
> +module_param(fbdev_num_buffers, int, 0444);
> +MODULE_PARM_DESC(fbdev_num_buffers,
> +		 "Number of frame buffers to allocate [default="
> +		 __MODULE_STRING(CONFIG_DRM_CMA_FBDEV_BUFFER_NUM) "]");

Pure bikshed: Should this be an overallocation %? 200 for
double-buffering, 100 as the default?

Slightly less bikesheddy: Can't we do this in the core helpers somehow?
I'd be nice if this is not cma specific. If it's not possible, I'd at
least move the symbol to drm_fb_helper.c, and add some kernel-doc around
it. That allows any other non-cma driver to at least implement support for
this. That also has the benefit of featuring it more prominently, in our
docs.

Besides these bikesheds/question, looks all reasonable to me. If you can
get some more acks would be great, but will merge anyway.
-Daniel

> +
>  /*
>   * For use in a (struct drm_fb_helper_funcs *)->fb_probe callback function that
>   * needs custom struct drm_framebuffer_funcs, like dirty() for deferred_io use.
> @@ -437,7 +443,7 @@ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper,
>  	bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8);
>  
>  	mode_cmd.width = sizes->surface_width;
> -	mode_cmd.height = sizes->surface_height;
> +	mode_cmd.height = sizes->surface_height * fbdev_num_buffers;
>  	mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel;
>  	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
>  		sizes->surface_depth);
> -- 
> git-series 0.8.11
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	Stefan Christ <s.christ@phytec.de>
Subject: Re: [PATCH v2 1/2] drm/cma-helper: Add multi buffer support for cma fbdev
Date: Thu, 9 Feb 2017 18:04:38 +0100	[thread overview]
Message-ID: <20170209170438.am73guria3rymybb@phenom.ffwll.local> (raw)
In-Reply-To: <9b4f80f213b50959d168e6f22b21ee784fe26da5.1486031436.git-series.maxime.ripard@free-electrons.com>

On Thu, Feb 02, 2017 at 11:31:56AM +0100, Maxime Ripard wrote:
> From: Xinliang Liu <xinliang.liu@linaro.org>
> 
> This patch add a config to support to create multi buffer for cma fbdev.
> Such as double buffer and triple buffer.
> 
> Cma fbdev is convient to add a legency fbdev. And still many Android
> devices use fbdev now and at least double buffer is needed for these
> Android devices, so that a buffer flip can be operated. It will need
> some time for Android device vendors to abondon legency fbdev. So multi
> buffer for fbdev is needed.
> 
> Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
> [s.christ@phytec.de: Picking patch from
>                      https://lkml.org/lkml/2015/9/14/188]
> Signed-off-by: Stefan Christ <s.christ@phytec.de>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/Kconfig             | 8 ++++++++
>  drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index ebfe8404c25f..2ca9bb26a4e4 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -121,6 +121,14 @@ config DRM_KMS_CMA_HELPER
>  	help
>  	  Choose this if you need the KMS CMA helper functions
>  
> +config DRM_CMA_FBDEV_BUFFER_NUM
> +	int "Cma Fbdev Buffer Number"
> +	depends on DRM_KMS_CMA_HELPER
> +	default 1
> +	help
> +	  Defines the buffer number of cma fbdev.  Default is one buffer.
> +	  For double buffer please set to 2 and 3 for triple buffer.
> +
>  source "drivers/gpu/drm/i2c/Kconfig"
>  
>  source "drivers/gpu/drm/arm/Kconfig"
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 81b3558302b5..e3f8b9e720a0 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -411,6 +411,12 @@ static void drm_fbdev_cma_defio_fini(struct fb_info *fbi)
>  	kfree(fbi->fbops);
>  }
>  
> +static int fbdev_num_buffers = CONFIG_DRM_CMA_FBDEV_BUFFER_NUM;
> +module_param(fbdev_num_buffers, int, 0444);
> +MODULE_PARM_DESC(fbdev_num_buffers,
> +		 "Number of frame buffers to allocate [default="
> +		 __MODULE_STRING(CONFIG_DRM_CMA_FBDEV_BUFFER_NUM) "]");

Pure bikshed: Should this be an overallocation %? 200 for
double-buffering, 100 as the default?

Slightly less bikesheddy: Can't we do this in the core helpers somehow?
I'd be nice if this is not cma specific. If it's not possible, I'd at
least move the symbol to drm_fb_helper.c, and add some kernel-doc around
it. That allows any other non-cma driver to at least implement support for
this. That also has the benefit of featuring it more prominently, in our
docs.

Besides these bikesheds/question, looks all reasonable to me. If you can
get some more acks would be great, but will merge anyway.
-Daniel

> +
>  /*
>   * For use in a (struct drm_fb_helper_funcs *)->fb_probe callback function that
>   * needs custom struct drm_framebuffer_funcs, like dirty() for deferred_io use.
> @@ -437,7 +443,7 @@ int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper,
>  	bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8);
>  
>  	mode_cmd.width = sizes->surface_width;
> -	mode_cmd.height = sizes->surface_height;
> +	mode_cmd.height = sizes->surface_height * fbdev_num_buffers;
>  	mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel;
>  	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
>  		sizes->surface_depth);
> -- 
> git-series 0.8.11
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-02-09 17:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 10:31 [PATCH v2 0/2] drm: Support framebuffer panning Maxime Ripard
2017-02-02 10:31 ` Maxime Ripard
2017-02-02 10:31 ` [PATCH v2 1/2] drm/cma-helper: Add multi buffer support for cma fbdev Maxime Ripard
2017-02-02 10:31   ` Maxime Ripard
2017-02-09 17:04   ` Daniel Vetter [this message]
2017-02-09 17:04     ` Daniel Vetter
2017-02-10 15:27     ` Maxime Ripard
2017-02-10 15:27       ` Maxime Ripard
2017-02-12 12:28   ` Laurent Pinchart
2017-02-12 12:28     ` Laurent Pinchart
2017-02-13 10:54     ` Maxime Ripard
2017-02-13 10:54       ` Maxime Ripard
2017-02-13 11:20       ` Daniel Stone
2017-02-13 11:20         ` Daniel Stone
2017-02-14 20:09         ` Daniel Vetter
2017-02-14 20:09           ` Daniel Vetter
2017-02-14 21:25           ` Laurent Pinchart
2017-02-14 21:25             ` Laurent Pinchart
2017-02-15 12:51             ` Maxime Ripard
2017-02-15 12:51               ` Maxime Ripard
2017-02-17 11:30               ` Laurent Pinchart
2017-02-15 12:38         ` Maxime Ripard
2017-02-15 12:38           ` Maxime Ripard
2017-02-17 11:23           ` Laurent Pinchart
2017-02-17 11:23             ` Laurent Pinchart
2017-02-02 10:31 ` [PATCH v2 2/2] drm/fb_helper: implement ioctl FBIO_WAITFORVSYNC Maxime Ripard
2017-02-02 10:31   ` Maxime Ripard
2017-02-09 17:01   ` Daniel Vetter
2017-02-09 17:01     ` Daniel Vetter
2017-02-09 17:38     ` Daniel Stone
2017-02-09 17:38       ` Daniel Stone
2017-02-09 19:06       ` Daniel Vetter
2017-02-09 19:06         ` Daniel Vetter
2017-02-10 14:06   ` Ville Syrjälä
2017-02-10 14:06     ` Ville Syrjälä
2017-02-13 10:35     ` Maxime Ripard
2017-02-13 10:35       ` Maxime Ripard
2017-02-13 14:45       ` Ville Syrjälä
2017-02-13 14:45         ` Ville Syrjälä
2017-02-15 14:06         ` Maxime Ripard
2017-02-15 14:06           ` Maxime Ripard
2017-02-16 12:28 [PATCH v2 1/2] drm/cma-helper: Add multi buffer support for cma fbdev Tobias Jakobi
2017-02-16 18:41 ` Maxime Ripard
2017-02-17 12:49   ` Tobias Jakobi

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=20170209170438.am73guria3rymybb@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=s.christ@phytec.de \
    --cc=seanpaul@chromium.org \
    /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.