From patchwork Wed Jul 13 08:11:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Christ X-Patchwork-Id: 71905 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp881616qga; Wed, 13 Jul 2016 01:22:29 -0700 (PDT) X-Received: by 10.98.4.193 with SMTP id 184mr1305495pfe.98.1468398147588; Wed, 13 Jul 2016 01:22:27 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id p189si2852138pfb.299.2016.07.13.01.22.27; Wed, 13 Jul 2016 01:22:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E5A66E6AD; Wed, 13 Jul 2016 08:22:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from root.phytec.de (mail.visioncatalog.com [217.6.246.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 608956E6A9 for ; Wed, 13 Jul 2016 08:17:46 +0000 (UTC) Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id ED8BBA00324; Wed, 13 Jul 2016 10:13:03 +0200 (CEST) Received: from lws-christ.phytec.de ([172.16.11.123]) by idefix.phytec.de (IBM Domino Release 9.0.1FP5 HF413) with ESMTP id 2016071310114882-85479 ; Wed, 13 Jul 2016 10:11:48 +0200 From: Stefan Christ 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 Message-Id: <1468397508-5112-2-git-send-email-s.christ@phytec.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468397508-5112-1-git-send-email-s.christ@phytec.de> References: <1468397508-5112-1-git-send-email-s.christ@phytec.de> X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 9.0.1FP5 HF413|March 21, 2016) at 13.07.2016 10:11:48, Serialize by Router on Idefix/Phytec(Release 9.0.1FP5 HF413|March 21, 2016) at 13.07.2016 10:11:48, Serialize complete at 13.07.2016 10:11:48 X-TNEFEvaluated: 1 X-Mailman-Approved-At: Wed, 13 Jul 2016 08:22:22 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Xinliang Liu 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 [s.christ@phytec.de: Picking patch from https://lkml.org/lkml/2015/9/14/188] Signed-off-by: Stefan Christ --- 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);