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: 53542 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id CDEE82056A for ; Mon, 14 Sep 2015 10:20:43 +0000 (UTC) Received: by lanb10 with SMTP id b10sf46740707lan.3 for ; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=kVRm+iw1Xz3qq0WqrABr64QcrwBKZs1WcE3Q/mVOzxo=; b=amiAfkCjo/aIWw3Qqjg4hlBfL3/QpH1wdlRWhZ1gG8pqaqhR3VV6SIxZPfaYlJuNVl YPXfr9PHK9bDQTdG1un+k64DlQ9DV8cUg2x+gBACSTnmamggzXAO6DJg6ZmQ0hUr1O3n ZLhJxkZEZU9Xl/F/ublLeLGjS+dQIkUrTqkrPsRIIbgeenwnQzKX5oxRlffYBsIQ+L0i 4cJh8ubkO4t6PUeuhCBHbMU15XAnPNOPdX/CfKa4N9hjnDkTeolaH7c86vKsVxN77AIr T94G3mDY7RIHj9RC4ePxINuJ5umQMOGvxhz0Dq6ixchz6I3DFb3DGE3ujsjinwxgyXVT rPdA== X-Gm-Message-State: ALoCoQmuLfiPQu25IsWQtnFbG/FCGwJOMZJXFBD1ZcY/r2rIqlVX94q9O7CHDZoHwsbRLGrjzPI/ X-Received: by 10.180.81.165 with SMTP id b5mr2725759wiy.1.1442226042792; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.66 with SMTP id z2ls533181lag.76.gmail; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) X-Received: by 10.152.28.65 with SMTP id z1mr13062752lag.9.1442226042590; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id t1si9223456lbk.72.2015.09.14.03.20.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 03:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbpo4 with SMTP id o4so64909420lbp.2 for ; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr10776952lbb.35.1442226042437; Mon, 14 Sep 2015 03:20:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1109214lbq; Mon, 14 Sep 2015 03:20:41 -0700 (PDT) X-Received: by 10.66.253.229 with SMTP id ad5mr33388362pad.101.1442226041258; Mon, 14 Sep 2015 03:20:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sg1si13374138pbc.199.2015.09.14.03.20.40; Mon, 14 Sep 2015 03:20:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755049AbbINKUi (ORCPT + 29 others); Mon, 14 Sep 2015 06:20:38 -0400 Received: from mail-vk0-f41.google.com ([209.85.213.41]:35927 "EHLO mail-vk0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753881AbbINKUh (ORCPT ); Mon, 14 Sep 2015 06:20:37 -0400 Received: by vkfp126 with SMTP id p126so55763565vkf.3 for ; Mon, 14 Sep 2015 03:20:36 -0700 (PDT) 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 Cc: linux-kernel@vger.kernel.org, benjamin.gaignard@linaro.org, liguozhu@hisilicon.com, kong.kongxinwei@hisilicon.com, Xinliang Liu 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: xinliang.liu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);