[PATCH] drm/shmem-helpers: vunmap: Don't put pages for dma-buf
Thomas Zimmermann
tzimmermann at suse.de
Thu Feb 25 09:52:14 UTC 2021
Hi
Am 25.02.21 um 10:43 schrieb Daniel Vetter:
> On Wed, Feb 24, 2021 at 6:14 PM Noralf Trønnes <noralf at tronnes.org> wrote:
>>
>>
>>
>> Den 19.02.2021 14.54, skrev Thomas Zimmermann:
>>> Hi
>>>
>>> Am 19.02.21 um 13:22 schrieb Noralf Trønnes:
>>>> dma-buf importing was reworked in commit 7d2cd72a9aa3
>>>> ("drm/shmem-helpers: Simplify dma-buf importing"). Before that commit
>>>> drm_gem_shmem_prime_import_sg_table() did set ->pages_use_count=1 and
>>>> drm_gem_shmem_vunmap_locked() could call drm_gem_shmem_put_pages()
>>>> unconditionally. Now without the use count set, put pages is called also
>>>> on dma-bufs. Fix this by only putting pages if it's not imported.
>>>>
>>>> Fixes: 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing")
>>>> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
>>>> Cc: Thomas Zimmermann <tzimmermann at suse.de>
>>>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
>>>
>>> Just when I saw the error. Nice. :)
>>>
>>> Acked-by: Thomas Zimmermann <tzimmermann at suse.de>
>>> Tested-by: Thomas Zimmermann <tzimmermann at suse.de>
>>>
>>
>> Should I apply this to drm-misc-fixes?
>
> drm-misc-next-fixes because we're in the merge window.
Too late. Can/should I cherry-pick the patch from drm-misc-next?
Best regards
Thomas
> -Daniel
>
>>
>> Noralf.
>>
>>> For testing the GUD driver, you may also want to keep an eye at [1]
>>>
>>> Best regards
>>> Thomas
>>>
>>> [1]
>>> https://lore.kernel.org/dri-devel/02a45c11-fc73-1e5a-3839-30b080950af8@amd.com/T/#t
>>>
>>>
>>>> ---
>>>> drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++---
>>>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c
>>>> b/drivers/gpu/drm/drm_gem_shmem_helper.c
>>>> index 9825c378dfa6..c8a6547a1757 100644
>>>> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
>>>> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
>>>> @@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct
>>>> drm_gem_shmem_object *shmem,
>>>> if (--shmem->vmap_use_count > 0)
>>>> return;
>>>> - if (obj->import_attach)
>>>> + if (obj->import_attach) {
>>>> dma_buf_vunmap(obj->import_attach->dmabuf, map);
>>>> - else
>>>> + } else {
>>>> vunmap(shmem->vaddr);
>>>> + drm_gem_shmem_put_pages(shmem);
>>>> + }
>>>> shmem->vaddr = NULL;
>>>> - drm_gem_shmem_put_pages(shmem);
>>>> }
>>>> /*
>>>>
>>>
>
>
>
--
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: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210225/aa9b26a0/attachment-0001.sig>
More information about the dri-devel
mailing list