dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Christ <s.christ@phytec.de>
To: p.zabel@pengutronix.de, dri-devel@lists.freedesktop.org
Subject: [PATCH 1/3] drm/cma-helper: Add multi buffer support for cma fbdev
Date: Wed, 13 Jul 2016 10:11:46 +0200	[thread overview]
Message-ID: <1468397508-5112-2-git-send-email-s.christ@phytec.de> (raw)
In-Reply-To: <1468397508-5112-1-git-send-email-s.christ@phytec.de>

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>
---
 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 fc35731..56cf34d 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -106,6 +106,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"
 
 config DRM_TDFX
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 5075fae..be66042 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -27,6 +27,12 @@
 
 #define DEFAULT_FBDEFIO_DELAY_MS 50
 
+#ifdef CONFIG_DRM_CMA_FBDEV_BUFFER_NUM
+#define FBDEV_BUFFER_NUM CONFIG_DRM_CMA_FBDEV_BUFFER_NUM
+#else
+#define FBDEV_BUFFER_NUM 1
+#endif
+
 struct drm_fb_cma {
 	struct drm_framebuffer		fb;
 	struct drm_gem_cma_object	*obj[4];
@@ -389,7 +395,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_BUFFER_NUM;
 	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);
-- 
1.9.1

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

  reply	other threads:[~2016-07-13  8:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  8:11 [PATCH 0/3] Support fast framebuffer panning for i.MX6 Stefan Christ
2016-07-13  8:11 ` Stefan Christ [this message]
2016-07-13 10:05   ` [PATCH 1/3] drm/cma-helper: Add multi buffer support for cma fbdev Daniel Vetter
2016-07-13  8:11 ` [PATCH 2/3] drm: fb_helper: implement ioctl FBIO_WAITFORVSYNC Stefan Christ
2016-07-13 10:16   ` Daniel Vetter
2016-07-15  7:19     ` Daniel Vetter
2016-07-27  9:59       ` Stefan Christ
2016-07-27 13:09         ` Daniel Vetter
2016-07-13  8:11 ` [PATCH 3/3] drm/imx: ipuv3-crtc: implement fast path mode_set_base Stefan Christ
2016-07-13 10:00 ` [PATCH 0/3] Support fast framebuffer panning for i.MX6 Daniel Vetter
2016-07-14 15:11   ` Stefan Christ
2016-07-15  7:14     ` Daniel Vetter

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=1468397508-5112-2-git-send-email-s.christ@phytec.de \
    --to=s.christ@phytec.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=p.zabel@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox