diff mbox

drm/cma-helper: Add multi buffer support for cma fbdev

Message ID 1442226079-55233-1-git-send-email-xinliang.liu@linaro.org
State New
Headers show

Commit Message

Xinliang Liu Sept. 14, 2015, 10:21 a.m. UTC
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>
 drivers/gpu/drm/Kconfig             | 8 ++++++++
 drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
diff mbox


diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 1a0a8df..577f790 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -97,6 +97,14 @@  config DRM_KMS_CMA_HELPER
 	  Choose this if you need the KMS CMA helper functions
+	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"
 config DRM_TDFX
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index c19a625..26051b8 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -25,6 +25,12 @@ 
 #include <drm/drm_fb_cma_helper.h>
 #include <linux/module.h>
 struct drm_fb_cma {
 	struct drm_framebuffer		fb;
 	struct drm_gem_cma_object	*obj[4];
@@ -253,7 +259,7 @@  static int drm_fbdev_cma_create(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_BUFFER_NUM;
 	mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel;
 	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,