All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: david@lechnology.com, airlied@linux.ie, hdegoede@redhat.com,
	noralf@tronnes.org, dri-devel@lists.freedesktop.org,
	airlied@redhat.com, sean@poorly.run
Subject: Re: [PATCH 3/7] drm/mipi-dbi: Use framebuffer dma-buf helpers
Date: Tue, 20 Jul 2021 20:36:55 +0200	[thread overview]
Message-ID: <6606be12-e999-02ad-da04-00f2c96fd40e@suse.de> (raw)
In-Reply-To: <YPbXmDGDhCo9M0Rd@phenom.ffwll.local>


[-- Attachment #1.1: Type: text/plain, Size: 3191 bytes --]

Hi

Am 20.07.21 um 16:03 schrieb Daniel Vetter:
> On Fri, Jul 16, 2021 at 04:07:57PM +0200, Thomas Zimmermann wrote:
>> Replace dma_buf_begin_cpu_access() with drm_gem_fb_begin_cpu_access();
>> same for _end_cpu_access(). Remove some boiler-plate code. No functional
>> changes.
>>
>> There's one left-over reference to the imported attachment that we
>> keep. GEM BOs with imported attachment are considered uncached and
>> enables special handling within the drm_fb_swab().
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/drm_mipi_dbi.c | 20 +++++++-------------
>>   1 file changed, 7 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
>> index 10b4e59384ae..71b646c4131f 100644
>> --- a/drivers/gpu/drm/drm_mipi_dbi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
>> @@ -7,7 +7,6 @@
>>   
>>   #include <linux/debugfs.h>
>>   #include <linux/delay.h>
>> -#include <linux/dma-buf.h>
>>   #include <linux/gpio/consumer.h>
>>   #include <linux/module.h>
>>   #include <linux/regulator/consumer.h>
>> @@ -202,21 +201,17 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
>>   {
>>   	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
>>   	struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem);
>> -	struct dma_buf_attachment *import_attach = gem->import_attach;
>>   	void *src = cma_obj->vaddr;
>> -	int ret = 0;
>> +	int ret;
>>   
>> -	if (import_attach) {
>> -		ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
>> -					       DMA_FROM_DEVICE);
>> -		if (ret)
>> -			return ret;
>> -	}
>> +	ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
>> +	if (ret)
>> +		return ret;
>>   
>>   	switch (fb->format->format) {
>>   	case DRM_FORMAT_RGB565:
>>   		if (swap)
>> -			drm_fb_swab(dst, src, fb, clip, !import_attach);
>> +			drm_fb_swab(dst, src, fb, clip, !gem->import_attach);
> 
> I freaked out about this because for dma-buf WC vs WB is undefined, but
> it's purely a perf optimization. So it's fine. Plus we're not even
> bothering with the iomem vs normal memory distinction here.

Indeed. Because of the line above, I made a proto-patchset to store 
caching flags within struct dma_buf_map. But it's a lot of churn, so I 
kept the current heuristic for now.

> 
> Anyway, that aside, all looks good. On the series:
> 
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks.

Best regards
Thomas

> 
>>   		else
>>   			drm_fb_memcpy(dst, src, fb, clip);
>>   		break;
>> @@ -229,9 +224,8 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
>>   		return -EINVAL;
>>   	}
>>   
>> -	if (import_attach)
>> -		ret = dma_buf_end_cpu_access(import_attach->dmabuf,
>> -					     DMA_FROM_DEVICE);
>> +	drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
>> +
>>   	return ret;
>>   }
>>   EXPORT_SYMBOL(mipi_dbi_buf_copy);
>> -- 
>> 2.32.0
>>
> 

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-07-20 18:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 14:07 [PATCH 0/7] drm: Provide framebuffer dma-buf helpers Thomas Zimmermann
2021-07-16 14:07 ` [PATCH 1/7] drm/gem: Provide drm_gem_fb_{begin, end}_cpu_access() helpers Thomas Zimmermann
2021-07-20 14:05   ` Daniel Vetter
2021-07-16 14:07 ` [PATCH 2/7] drm/udl: Use framebuffer dma-buf helpers Thomas Zimmermann
2021-07-16 14:07 ` [PATCH 3/7] drm/mipi-dbi: " Thomas Zimmermann
2021-07-20 14:03   ` Daniel Vetter
2021-07-20 18:36     ` Thomas Zimmermann [this message]
2021-07-16 14:07 ` [PATCH 4/7] drm/gud: " Thomas Zimmermann
2021-07-16 14:07 ` [PATCH 5/7] drm/gm12u320: " Thomas Zimmermann
2021-07-16 14:08 ` [PATCH 6/7] drm/repaper: " Thomas Zimmermann
2021-07-16 14:08 ` [PATCH 7/7] drm/st7586: " Thomas Zimmermann
2021-07-16 17:50   ` David Lechner
2021-07-22 11:35 ` [PATCH 0/7] drm: Provide " Noralf Trønnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6606be12-e999-02ad-da04-00f2c96fd40e@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=noralf@tronnes.org \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.