From patchwork Mon Sep 14 10:21:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang Liu X-Patchwork-Id: 7174431 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0A3E0BEEC1 for ; Mon, 14 Sep 2015 10:20:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B4FD2065B for ; Mon, 14 Sep 2015 10:20:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0CE90205C2 for ; Mon, 14 Sep 2015 10:20:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 515E26E829; Mon, 14 Sep 2015 03:20:39 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk0-f44.google.com (mail-vk0-f44.google.com [209.85.213.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 76DEC6E829 for ; Mon, 14 Sep 2015 03:20:37 -0700 (PDT) Received: by vkfp126 with SMTP id p126so55763562vkf.3 for ; Mon, 14 Sep 2015 03:20:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Po9e4UOhAtZwt0t/MzpjdHpRVOVAOqbRAyDT0SM5qFg=; b=YU/TwQ/Z3tZ+e7fqW2j5TVlf1+Fpj2CBWYXpQq4uUxNyKDQ72dDMAEPOeV4WvyLxXo u/is9IZcn/Ql5Ezd2eAAbaYAiqEvApPiv4gjE55zr5DuI4HNM2m1MM8XX/6dmpoF8iG6 tptpd2nHSw8B3Chh/X1PuXJXoXogZPV1xs5SDyo/67wREDa398IEQc+IALDwSP/VCEKM LPCpSPah9Etv7FdeSbW7Bq8dFitmGJ5jjsbvzriNTvEtLoQtNDee7aTb1VpzMAYz0/IG QWfs6edBsFP9kAM6tozpXQZOaJDaym2d9UXWHn7Vnqtbquc1adgeoh5wlUq2brkCB7XC b9+Q== X-Gm-Message-State: ALoCoQkl9yGGfMOmISloYGB/KLW7HYq2xmCpRd6WPUPHbKt1JeHm0kufso4LADyYBtoc1s+6a/yH X-Received: by 10.31.188.208 with SMTP id m199mr12841838vkf.36.1442226036478; Mon, 14 Sep 2015 03:20:36 -0700 (PDT) Received: from localhost.localdomain ([119.139.125.169]) by smtp.gmail.com with ESMTPSA id d8sm1064752vdc.5.2015.09.14.03.20.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Sep 2015 03:20:36 -0700 (PDT) From: Xinliang Liu To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/cma-helper: Add multi buffer support for cma fbdev Date: Mon, 14 Sep 2015 18:21:19 +0800 Message-Id: <1442226079-55233-1-git-send-email-xinliang.liu@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: liguozhu@hisilicon.com, linux-kernel@vger.kernel.org, benjamin.gaignard@linaro.org 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" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 1a0a8df..577f790 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -97,6 +97,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 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 #include +#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]; @@ -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, sizes->surface_depth);