[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d0be098d-c58f-9866-da6f-a721fa57806b@suse.de>
Date: Fri, 17 Feb 2023 14:42:13 +0100
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Dmitry Osipenko <dmitry.osipenko@...labora.com>,
David Airlie <airlied@...il.com>,
Gerd Hoffmann <kraxel@...hat.com>,
Gurchetan Singh <gurchetansingh@...omium.org>,
Chia-I Wu <olvaffe@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Daniel Almeida <daniel.almeida@...labora.com>,
Gustavo Padovan <gustavo.padovan@...labora.com>,
Daniel Stone <daniel@...ishbar.org>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Rob Clark <robdclark@...il.com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
Qiang Yu <yuq825@...il.com>,
Steven Price <steven.price@....com>,
Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
Rob Herring <robh@...nel.org>, Sean Paul <sean@...rly.run>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Abhinav Kumar <quic_abhinavk@...cinc.com>
Cc: kernel@...labora.com, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v10 09/11] drm/gem: Add drm_gem_pin_unlocked()
I forgot this change.
Am 08.01.23 um 22:04 schrieb Dmitry Osipenko:
> Add unlocked variants of drm_gem_un/pin() functions. These new helpers
> will take care of GEM dma-reservation locking for DRM drivers.
>
> VirtIO-GPU driver will use these helpers to pin shmem framebuffers,
> preventing them from eviction during scanout.
>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@...labora.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>
Best regards
Thomas
> ---
> drivers/gpu/drm/drm_gem.c | 29 +++++++++++++++++++++++++++++
> include/drm/drm_gem.h | 3 +++
> 2 files changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index dbb48fc9dff3..0b8d3da985c7 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -1167,6 +1167,35 @@ void drm_gem_unpin(struct drm_gem_object *obj)
> obj->funcs->unpin(obj);
> }
>
> +int drm_gem_pin_unlocked(struct drm_gem_object *obj)
> +{
> + int ret;
> +
> + if (!obj->funcs->pin)
> + return 0;
> +
> + ret = dma_resv_lock_interruptible(obj->resv, NULL);
> + if (ret)
> + return ret;
> +
> + ret = obj->funcs->pin(obj);
> + dma_resv_unlock(obj->resv);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_gem_pin_unlocked);
> +
> +void drm_gem_unpin_unlocked(struct drm_gem_object *obj)
> +{
> + if (!obj->funcs->unpin)
> + return;
> +
> + dma_resv_lock(obj->resv, NULL);
> + obj->funcs->unpin(obj);
> + dma_resv_unlock(obj->resv);
> +}
> +EXPORT_SYMBOL(drm_gem_unpin_unlocked);
> +
> int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
> {
> int ret;
> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> index 8e5c22f25691..6f6d96f79a67 100644
> --- a/include/drm/drm_gem.h
> +++ b/include/drm/drm_gem.h
> @@ -493,4 +493,7 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru,
>
> bool drm_gem_object_evict(struct drm_gem_object *obj);
>
> +int drm_gem_pin_unlocked(struct drm_gem_object *obj);
> +void drm_gem_unpin_unlocked(struct drm_gem_object *obj);
> +
> #endif /* __DRM_GEM_H__ */
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists