Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp531235pxf; Wed, 10 Mar 2021 11:06:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/CPeeSwapAr/nwVxuR3KLxJ5Te/xmJYrRb1AW8DLR3IYXp82auO+Bv7qR/hasB9o9PVVw X-Received: by 2002:a17:907:2bdd:: with SMTP id gv29mr4978251ejc.259.1615403192604; Wed, 10 Mar 2021 11:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615403192; cv=none; d=google.com; s=arc-20160816; b=Wy1nstphfSfiXPCTKXSiYxVaZ2RqoiVIyltA1FD4/nzvBjjduCcyhprhjNx2/82X+i g9JQpXbCgcbmBSkf2m61Hh7hxV44GrKM4jGa0BU9WIYcRLMlDVAYqa8cTXULDeSPTokZ jsQRWV4UNWfcPzcSiBG26x03EGjmjA9f5Q0Gc/G1QV+fIs57v2DDqknIWYwfsVWX8USo SeS9EpE13TMsybHvg9Te/GkaEUHM+55bTForPjzYHJLTZif6CN3WEUR4sm8Rq0kUwOIz 2t0+SfYabkezQiYA3jpQ6zvKe86K7Fa3I6JgpYoBrkzhufxHAaaYXQZdXqV5bkI0WaDQ ZHKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date; bh=0DaD8Dd3PrkBRS/gGQHLNxfLFmRsJ7DYlCE06sO14ls=; b=nNKg1sC6uRYALxq5PtBOGkwOUZ5FLD/ZUHhyWQo9BFyxr61eAAOTZd9OILeDg0AzKQ NlITceI+2dc5bnpwDYx+7yw8JaQjUqAP/5gJs3gQ9LqPuNma9aoCElFd6rYShSu9Chbf i8ktuosCmFazwRbWNnHu86meBXBHRCnsFd96b2WJO5/rVit68FfMyTWCnqNnbaRhn2Jj m1tsc6HSdpNe6kk6jsmwryp+da9DzFcIo76AYo87brMWZ1mF1zRZ95cAn4+tP4aeqQgd tjg9EwlEuGpC6DXIEEXROvaXTRlQhPAQywryVCigR6nOmCATnR5XsJOceA6+amAY1oaH GeoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si203899edy.80.2021.03.10.11.06.10; Wed, 10 Mar 2021 11:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233431AbhCJTCl convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 Mar 2021 14:02:41 -0500 Received: from aposti.net ([89.234.176.197]:54112 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhCJTCf (ORCPT ); Wed, 10 Mar 2021 14:02:35 -0500 Date: Wed, 10 Mar 2021 19:02:22 +0000 From: Paul Cercueil Subject: Re: [PATCH v2 0/5] Add option to mmap GEM buffers cached To: Thomas Zimmermann Cc: Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Sam Ravnborg , od@zcrc.me, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Message-Id: In-Reply-To: References: <20210307202835.253907-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, Le lun. 8 mars 2021 ? 9:41, Thomas Zimmermann a ?crit : > Hi Paul, > > having individual functions for each mode only makes sense if the > decision is at compile time. But in patch 5, you're working around > your earlier design by introducing in-driver helpers that select the > correct CMA function. > > In SHMEM helpers we have the flag map_wc in the GEM structure that > selects the pages caching mode (wc vs uncached). I think CMA should > use this design as well. Have a map_noncoherent flag in the CMA GEM > object and set it from the driver's implementation of > gem_create_object. Is that a new addition? That severely reduces the patchset size, which is perfect. I'll send a V3 then. Cheers, -Paul > And in the long run, we could try to consolidate all drivers/helpers > mapping flags in struct drm_gem_object. > > Best regards > Thomas > > Am 07.03.21 um 21:28 schrieb Paul Cercueil: >> Rework of my previous patchset which added support for GEM buffers >> backed by non-coherent memory to the ingenic-drm driver. >> >> Having GEM buffers backed by non-coherent memory is interesting in >> the particular case where it is faster to render to a non-coherent >> buffer then sync the data cache, than to render to a write-combine >> buffer, and (by extension) much faster than using a shadow buffer. >> This is true for instance on some Ingenic SoCs, where even simple >> blits (e.g. memcpy) are about three times faster using this method. >> >> For the record, the previous patchset was accepted for 5.10 then had >> to be reverted, as it conflicted with some changes made to the DMA >> API. >> >> This new patchset is pretty different as it adds the functionality to >> the DRM core. The first three patches add variants to existing >> functions >> but with the "non-coherent memory" twist, exported as GPL symbols. >> The >> fourth patch adds a function to be used with the damage helpers. >> Finally, the last patch adds support for non-coherent GEM buffers to >> the >> ingenic-drm driver. The functionality is enabled through a module >> parameter, and is disabled by default. >> >> Cheers, >> -Paul >> >> Paul Cercueil (5): >> drm: Add and export function drm_gem_cma_create_noncoherent >> drm: Add and export function drm_gem_cma_dumb_create_noncoherent >> drm: Add and export function drm_gem_cma_mmap_noncoherent >> drm: Add and export function drm_gem_cma_sync_data >> drm/ingenic: Add option to alloc cached GEM buffers >> >> drivers/gpu/drm/drm_gem_cma_helper.c | 223 >> +++++++++++++++++++--- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 49 ++++- >> drivers/gpu/drm/ingenic/ingenic-drm.h | 4 + >> drivers/gpu/drm/ingenic/ingenic-ipu.c | 14 +- >> include/drm/drm_gem_cma_helper.h | 13 ++ >> 5 files changed, 273 insertions(+), 30 deletions(-) >> > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 N?rnberg, Germany > (HRB 36809, AG N?rnberg) > Gesch?ftsf?hrer: Felix Imend?rffer >