[PATCH 1/2] drm/shmem: Use cached mappings by default

Thomas Zimmermann tzimmermann at suse.de
Mon May 18 08:13:44 UTC 2020


Hi

Am 15.05.20 um 16:10 schrieb Daniel Vetter:
> On Fri, May 15, 2020 at 08:58:02AM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 14.05.20 um 22:36 schrieb Rob Herring:
>>> On Thu, May 14, 2020 at 7:40 AM Daniel Vetter <daniel at ffwll.ch> wrote:
>>>>
>>>> On Wed, May 13, 2020 at 05:03:11PM +0200, Thomas Zimmermann wrote:
>>>>> SHMEM-buffer backing storage is allocated from system memory; which is
>>>>> typically cachable. Currently, only virtio uses cachable mappings; udl
>>>>> uses its own vmap/mmap implementation for cachable mappings. Other
>>>>> drivers default to writecombine mappings.
>>>>
>>>> I'm pretty sure this breaks all these drivers. quick grep on a few
>>>> functions says this is used by lima, panfrost, v3d. And they definitely
>>>> need uncached/wc stuff afaiui. Or I'm completely missing something?
>>>
>>
>> OK. I think I'll just make a patch that adds a .gem_create_object helper
>> that sets the map_cached flag. So drivers can opt-in.
>>
>>> Yes, that would be my guess. DMA is usually non-coherent on Arm.
>>
>> Can one of you give me some pointer to what you're looking at? For
>> example, I grepped for use of vmap within lima and only found [1].
>> That's a for memcpy with no DMA involved. There's got to be something
>> I'm missing.
>>
>> Best regards
>> Thomas
>>
>> [1]
>> https://cgit.freedesktop.org/drm/drm-tip/tree/drivers/gpu/drm/lima/lima_sched.c#n391
> 
> $ git grep drm_gem_shmem_mmap
> 
> We also need correct access from userspace, otherwise the gpu is going to
> be sad.

I've been thinking about this, and I think it means that we can never
have cached mappings anywhere. Even if shmem supports it internally for
most drivers, as soon as the page are exported, the importer could
expect uncached memory.

Given that, I think the correct thing to do is to udl's gem code and use
the default implementation.

Best regards
Thomas


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

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200518/c82400d1/attachment.sig>


More information about the dri-devel mailing list