From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH v4] DRM: add drm gem CMA helper Date: Wed, 08 Aug 2012 18:31:23 +0200 Message-ID: <1514673.2bbekI2AVd@avalon> References: <1340803818-25834-1-git-send-email-s.hauer@pengutronix.de> <12114409.YIlHQquAzt@avalon> <502292FA.6070109@metafoo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id 78D12A0A47 for ; Wed, 8 Aug 2012 09:31:12 -0700 (PDT) In-Reply-To: <502292FA.6070109@metafoo.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Lars-Peter Clausen Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Hi Lars, On Wednesday 08 August 2012 18:25:30 Lars-Peter Clausen wrote: > On 08/08/2012 04:44 PM, Laurent Pinchart wrote: > > On Wednesday 27 June 2012 15:30:18 Sascha Hauer wrote: > >> Many embedded drm devices do not have a IOMMU and no dedicated > >> memory for graphics. These devices use CMA (Contiguous Memory > >> Allocator) backed graphics memory. This patch provides helper > >> functions to be able to share the code. The code technically does > >> not depend on CMA as the backend allocator, the name has been chosen > >> because cma makes for a nice, short but still descriptive function > >> prefix. > >> > >> Signed-off-by: Sascha Hauer > >> --- > >> > >> changes since v3: > >> - *really* use DIV_ROUND_UP(args->width * args->bpp, 8) to calculate the > >> pitch changes since v2: > >> - make drm_gem_cma_create_with_handle static > >> - use DIV_ROUND_UP(args->width * args->bpp, 8) to calculate the pitch > >> - make drm_gem_cma_vm_ops const > >> - add missing #include > >> changes since v1: > >> - map whole buffer at mmap time, not page by page at fault time > >> - several cleanups as suggested by Lars-Peter Clausen and Laurent > >> Pinchart > >> > >> drivers/gpu/drm/Kconfig | 6 + > >> drivers/gpu/drm/Makefile | 1 + > >> drivers/gpu/drm/drm_gem_cma_helper.c | 251 > >> +++++++++++++++++++++++++++++++ > >> include/drm/drm_gem_cma_helper.h | 44 ++++++ > >> 4 files changed, 302 insertions(+) > >> create mode 100644 drivers/gpu/drm/drm_gem_cma_helper.c > >> create mode 100644 include/drm/drm_gem_cma_helper.h > >> > >> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > >> index dc5df12..8f362ec 100644 > >> --- a/drivers/gpu/drm/Kconfig > >> +++ b/drivers/gpu/drm/Kconfig > >> @@ -53,6 +53,12 @@ config DRM_TTM > >> > >> GPU memory types. Will be enabled automatically if a device driver > >> uses it. > >> > >> +config DRM_GEM_CMA_HELPER > >> + tristate > >> + depends on DRM > >> + help > >> + Choose this if you need the GEM CMA helper functions > >> + > >> > >> config DRM_TDFX > >> > >> tristate "3dfx Banshee/Voodoo3+" > >> depends on DRM && PCI > >> > >> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > >> index 0487ff6..8759cda 100644 > >> --- a/drivers/gpu/drm/Makefile > >> +++ b/drivers/gpu/drm/Makefile > >> @@ -15,6 +15,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o > >> drm_cache.o \ drm_trace_points.o drm_global.o drm_prime.o > >> > >> drm-$(CONFIG_COMPAT) += drm_ioc32.o > >> > >> +drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o > > > > This results in a built failure for me with > > > > CONFIG_DRM=y > > CONFIG_DRM_KMS_HELPER=m > > # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set > > CONFIG_DRM_GEM_CMA_HELPER=m > > CONFIG_DRM_KMS_CMA_HELPER=m > > > > drm_gem_cma_helper.o isn't compiled at all. Can you reproduce the problem > > ? > > The Kconfig entry needs to be bool instead of tristate. That's my preferred solution as well. I'll modify the patch in my tree, unless Sascha wants to submit a v5. -- Regards, Laurent Pinchart