Re: [PATCH v2 1/2] drm/cma-helper: Add multi buffer support for cma fbdev
From: Maxime Ripard
Date: Fri Feb 10 2017 - 10:53:09 EST
Hi Daniel,
On Thu, Feb 09, 2017 at 06:04:38PM +0100, Daniel Vetter wrote:
> On Thu, Feb 02, 2017 at 11:31:56AM +0100, Maxime Ripard wrote:
> > From: Xinliang Liu <xinliang.liu@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxx>
> > [s.christ@xxxxxxxxx: Picking patch from
> > https://lkml.org/lkml/2015/9/14/188]
> > Signed-off-by: Stefan Christ <s.christ@xxxxxxxxx>
> > Signed-off-by: Maxime Ripard <maxime.ripard@xxxxxxxxxxxxxxxxxx>
> > ---
> > 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?
I'm not against it, but would it make sense to allocate something like
120% of a buffer?
> Slightly less bikesheddy: Can't we do this in the core helpers somehow?
I guess that would move it to drm_fb_helper_single_fb_probe then? It
makes sense.
> 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.
I'll move it and add the kerneldoc.
Thanks!
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Attachment:
signature.asc
Description: PGP signature